Added extra image for PR approxBoundingPoly#1179
Closed
Napkin-AI wants to merge 1 commit intoopencv:4.xfrom
Closed
Added extra image for PR approxBoundingPoly#1179Napkin-AI wants to merge 1 commit intoopencv:4.xfrom
Napkin-AI wants to merge 1 commit intoopencv:4.xfrom
Conversation
6 tasks
asmorkalov
pushed a commit
to opencv/opencv
that referenced
this pull request
Jul 9, 2024
…poly Add a new function that approximates the polygon bounding a convex hull with a certain number of sides #25607 merge PR with <opencv/opencv_extra#1179> This PR is based on the paper [View Frustum Optimization To Maximize Object’s Image Area](https://citeseerx.ist.psu.edu/document?repid=rep1&type=pdf&doi=1fbd43f3827fffeb76641a9c5ab5b625eb5a75ba). # Problem I needed to reduce the number of vertices of the convex hull so that the additional area was minimal, andall vertices of the original contour enter the new contour.   # Description Initially in the contour of n vertices, at each stage we consider the intersection points of the lines formed by each adjacent edges. Each of these intersection points will form a triangle with vertices through which lines pass. Let's choose a triangle with the minimum area and merge the two vertices at the intersection point. We continue until there are more vertices than the specified number of sides of the approximated polygon.  # Complexity: Using a std::priority_queue or std::set time complexity is **(O(n\*ln(n))**, memory **O(n)**, n - number of vertices in convex hull. count of sides - the number of points by which we must reduce.  ## Comment If epsilon_percentage more 0, algorithm can return more values than _side_. Algorithm returns OutputArray. If OutputArray.type() equals 0, algorithm returns values with InputArray.type(). New test uses image which are not in opencv_extra, needs to be added. ### 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 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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related with PR opencv/opencv#25607