Add a new function that approximates the polygon bounding a convex hull with a certain number of sides #25607
merge PR with <https://github.com/opencv/opencv_extra/pull/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.
![image](https://github.com/Fest1veNapkin/opencv/assets/98156294/efac35f6-b8f0-46ec-91e4-60800432620c)
![image](https://github.com/Fest1veNapkin/opencv/assets/98156294/2292d9d7-1c10-49c9-8489-23221b4b28f7)
# 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.
![image](https://github.com/Fest1veNapkin/opencv/assets/98156294/b87b21c4-112e-450d-a776-2a120048ca30)
# 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.
![image](https://github.com/Fest1veNapkin/opencv/assets/98156294/31ad5562-a67d-4e3c-bdc2-29f8b52caf88)
## 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
Fix broken paper link for fastNlMeansDenoising
* Fix broken link
* Move citation to `opencv.bib`
* Cite researchgate reference
* Correct citation label
* Use semantic scholar BibTex
[GSoC] High Level API and Samples for Scene Text Detection and Recognition
* APIs and samples for scene text detection and recognition
* update APIs and tutorial for Text Detection and Recognition
* API updates:
(1) put decodeType into struct Voc
(2) optimize the post-processing of DB
* sample update:
(1) add transformation into scene_text_spotting.cpp
(2) modify text_detection.cpp with API update
* update tutorial
* simplify text recognition API
update tutorial
* update impl usage in recognize() and detect()
* dnn: refactoring public API of TextRecognitionModel/TextDetectionModel
* update provided models
update opencv.bib
* dnn: adjust text rectangle angle
* remove points ordering operation in model.cpp
* update gts of DB test in test_model.cpp
* dnn: ensure to keep text rectangle angle
- avoid 90/180 degree turns
* dnn(text): use quadrangle result in TextDetectionModel API
* dnn: update Text Detection API
(1) keep points' order consistent with (bl, tl, tr, br) in unclip
(2) update contourScore with boundingRect
* Implement ASIFT in C++
* '>>' should be '> >' within a nested template
* add a sample for asift usage
* bugfix empty keypoints cause crash
* simpler initialization for mask
* suppress the number of lines
* correct tex document
* type casting
* add descriptorsize for asift
* smaller testdata for asift
* more smaller test data
* add OpenCV short license header
Add URLs, harmonise formatting, and fix parse error in bibliography (#13228)
* Fixed parse error in bibliography
* Removed extra curly braces
* harmonized whitespace
* changed organisation -> publisher where appropriate. Organisation is intended as the author's organisation, not the publishing.
* harmonized capitalisation and whitespace
* Add links to about 1/3 of references
In this tutorial you will learn:
- what is a degradation image model
- what is a PSF of an out-of-focus image
- how to restore a blurred image
- what is the Wiener filter
* Simulated Annealing for ANN_MLP training method
* EXPECT_LT
* just to test new data
* manage RNG
* Try again
* Just run buildbot with new data
* try to understand
* Test layer
* New data- new test
* Force RNG in backprop
* Use Impl to avoid virtual method
* reset all weights
* try to solve ABI
* retry
* ABI solved?
* till problem with dynamic_cast
* Something is wrong
* Solved?
* disable backprop test
* remove ANN_MLP_ANNEALImpl
* Disable weight in varmap
* Add example for SimulatedAnnealing
Adds fitEllipseDirect to imgproc: The Direct least square (Direct) method by Fitzgibbon1999.
New Tests are included for the methods.
fitEllipseAMS Tests
fitEllipseDirect Tests
Comparative examples are added to fitEllipse.cpp in Samples.
New p3p algorithm (accepted by CVPR 2017) (#8301)
* add p3p source code
* indent 4
* update publication info
* fix filename
* interface done
* plug in done, test needed
* debugging
* for test
* a working version
* clean p3p code
* test
* test
* fix warning, blank line
* apply patch from @catree
* add reference info
* namespace, indent 4
* static solveQuartic
* put small functions to anonymous namespace