Skip to content

deleted dublicated "private" createConvexHull and convertTo#20676

Merged
alalek merged 2 commits intoopencv:3.4from
AleksandrPanov:delete_createConvexHull_convertTo
Sep 13, 2021
Merged

deleted dublicated "private" createConvexHull and convertTo#20676
alalek merged 2 commits intoopencv:3.4from
AleksandrPanov:delete_createConvexHull_convertTo

Conversation

@AleksandrPanov
Copy link
Copy Markdown
Contributor

@AleksandrPanov AleksandrPanov commented Sep 8, 2021

Fixes #17585
Function createConvexHull just cast cv::Mat to vector<cv::Point2f> by convertTo() and call ConvexHull.
There is problem: convertTo() can't cast cv::Mat(n, 2, CV_32FC1) to vector<cv::Point2f>. But ConvexHull can take cv::Mat(n, 2, CV_32FC1).
To fix problem can delete createConvexHull (this is "private" function and calls once).

Pull Request Readiness Checklist

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 other license that is incompatible with OpenCV
  • The PR is proposed to proper branch
  • There is reference to 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

Copy link
Copy Markdown
Member

@alalek alalek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me! Thank you 👍

std::vector<cv::Point2f> resultingTriangle, polygon;

createConvexHull(points, polygon);
CV_Assert(points.getMat().checkVector(2) > 0);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets remove this check, because convexHull has similar checks inside through total = points.checkVector(2)

Or replace it with CV_Assert(!points.empty());

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

replaced CV_Assert(points.getMat().checkVector(2) > 0) with CV_Assert(!points.empty())

@AleksandrPanov AleksandrPanov force-pushed the delete_createConvexHull_convertTo branch from b68b9d6 to 6304344 Compare September 13, 2021 15:06
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.

2 participants