mirror of
https://github.com/opencv/opencv.git
synced 2026-09-13 13:55:39 -05:00
Merge pull request #29740 from varun-jaiswal17:imgproc_cleanup
Imgproc test cleanup - #29740 co-authored by: @Prasadayus ### Re-enabled as-is (stale disable reasons) - `FillPolyFully.fillpoly_fully` (`test_drawing.cpp:1142`) - `Resize_Bitexact` (`test_resize_bitexact.cpp:188`, 4 instantiations): `INTER_NEAREST` and `INTER_NEAREST_EXACT` agree exactly at integer upscale factors; measured 0.0 diff on all 4. ### Add assertions - **imgproc** — new `Imgproc_Watershed.regression`: `cv::watershed` had no working coverage at all. ### Pull Request Readiness Checklist See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request - [x] I agree to contribute to the project under Apache 2 License. - [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV - [x] The PR is proposed to the proper branch - [x] There is a reference to the original bug report and related work - [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable Patch to opencv_extra has the same branch name. - [x] The feature is well documented and sample code can be built with the project CMake
This commit is contained in:
@@ -22,8 +22,17 @@ class watershed_test(NewOpenCVTests):
|
||||
if img is None or markers is None:
|
||||
self.assertEqual(0, 1, 'Missing test data')
|
||||
|
||||
# cv.watershed() writes into markers in place, so the CV_32S array must be bound
|
||||
# to a name: np.int32(markers) inline would hand over a temporary.
|
||||
markers = np.int32(markers)
|
||||
before = markers.copy()
|
||||
|
||||
colors = np.int32( list(np.ndindex(3, 3, 3)) ) * 122
|
||||
cv.watershed(img, np.int32(markers))
|
||||
cv.watershed(img, markers)
|
||||
|
||||
self.assertFalse(np.array_equal(before, markers),
|
||||
'cv.watershed() did not modify the markers in place')
|
||||
|
||||
segments = colors[np.maximum(markers, 0)]
|
||||
|
||||
if refSegments is None:
|
||||
|
||||
Reference in New Issue
Block a user