Skip to content

Keep convexHull output indices monotone if possible - #28163

Merged
asmorkalov merged 7 commits into
opencv:4.xfrom
dkurt:d.kurtaev/convexHull_repeats
Dec 19, 2025
Merged

asmorkalov merged 7 commits into
opencv:4.xfrom
dkurt:d.kurtaev/convexHull_repeats

Conversation

@dkurt

@dkurt dkurt commented Dec 10, 2025 •

Copy link
Copy Markdown
Member

Pull Request Readiness Checklist

resolves #24907 ?
resolves #4954

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

  • I agree to contribute to the project under Apache 2 License.
  • 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
  • The PR is proposed to the proper branch
  • There is a reference to the original bug report and related work
  • There is accuracy test, performance test and test data in opencv_extra repository, if applicable
    Patch to opencv_extra has the same branch name.
  • The feature is well documented and sample code can be built with the project CMake

@asmorkalov

Copy link
Copy Markdown
Contributor

@dkurt Please add the last repro with small image as a test.

@asmorkalov asmorkalov added this to the 4.13.0 milestone Dec 10, 2025
@asmorkalov
asmorkalov self-requested a review December 10, 2025 16:53
@asmorkalov

Copy link
Copy Markdown
Contributor
   [ RUN      ] Imgproc_ConvexityDefects.ordering_4539
  /home/ci/opencv/modules/imgproc/test/test_convhull.cpp:309: Failure
  Expected: convexityDefects(contour_, hull_ind, defects) throws an exception of type cv::Exception.
    Actual: it throws nothing.
  /home/ci/opencv/modules/imgproc/test/test_convhull.cpp:325: Failure
  Expected: convexityDefects(contours[0], hull_ind, defects) throws an exception of type cv::Exception.
    Actual: it throws nothing.
  [  FAILED  ] Imgproc_ConvexityDefects.ordering_4539 (8 ms)

@asmorkalov asmorkalov self-assigned this Dec 10, 2025
@dkurt

dkurt commented Dec 11, 2025

Copy link
Copy Markdown
Member Author

@asmorkalov working on it. Need some time understand the desired behavior. For example, another contour with self-intersection:

    std::vector<Point> contour{
        Point(1, 1), Point(1, 0), Point(0, 0), Point(1, 0), Point(0, 1)
    };

@dkurt dkurt changed the title Consider last duplicated point as a part of convex hull Keep convexHull output indices monotone if possible Dec 15, 2025
@dkurt
dkurt requested a review from vpisarev December 15, 2025 12:45
@dkurt
dkurt marked this pull request as ready for review December 15, 2025 12:52
@asmorkalov
asmorkalov merged commit 4307457 into opencv:4.x Dec 19, 2025
@dkurt
dkurt deleted the d.kurtaev/convexHull_repeats branch January 12, 2026 12:43
@asmorkalov asmorkalov mentioned this pull request Feb 11, 2026
SavyaSanchi-Sharma pushed a commit to SavyaSanchi-Sharma/opencv that referenced this pull request Jul 30, 2026
Keep convexHull output indices monotone if possible opencv#28163

### Pull Request Readiness Checklist

resolves opencv#24907 ?
resolves opencv#4954

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.
- [ ] The feature is well documented and sample code can be built with the project CMake
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Incorrect convex hull for contour. convexityDefects result is located on the hull but has a large depth

2 participants