opencv_contrib
                                
                                 opencv_contrib copied to clipboard
                                
                                    opencv_contrib copied to clipboard
                            
                            
                            
                        freetype: fix for huge CtoL param.
The freetype module uses CtoL param to split bezier curve segment to polylines. This patch makes local upper limitation for each segments. It is determined with total length of polylines at anchors. And skip to push_back() same points, likes imgproc::ellipse2Poly().
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
I believe that iCtoL is determined with font glyph path data, so it should be care about the range of it more than before.
- if iCtoL== 0, dounle u is calicurated with i / 0.
- if iCtoL== INT_MAX, int i will be overflow.
I think that such a case is basically impossible. However, it's not absolute, so I'd like to put in some protection just in case.
So in additional patch, iCtoL is fitted to range from 1 to INT_MAX-1.
Test is failed, but it is about unexpected module/function. Maybe it is missjudgement.
I believe this file doesn't reference to freetype module.
- https://github.com/opencv/opencv_contrib/blob/4.x/modules/ximgproc/misc/python/test/test_sparse_match_interpolator.py
Test result is here.
- https://github.com/opencv/opencv_contrib/actions/runs/6809972475/job/18519821850?pr=3585#step:88:350
======================================================================
FAIL: test_ric_interpolator (test_sparse_match_interpolator.Interpolator_test)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/ci/opencv_contrib/modules/ximgproc/misc/python/test/test_sparse_match_interpolator.py", line 67, in test_ric_interpolator
    self.assertTrue(cv.norm(dense_flow, ref_flow, cv.NORM_INF) <= MAX_DIF)
AssertionError: False is not true
----------------------------------------------------------------------
Ran 297 tests in 84.373s