Commit Graph

3485 Commits

Author SHA1 Message Date
Maksim Shabunin
6350bfbf79
Merge pull request #25564 from mshabunin:cleanup-imgproc-2
imgproc: C-API cleanup, drawContours refactor #25564

Changes:
* moved several macros from types_c.h to cvdef.h (assuming we will continue using them)
* removed some cases of C-API usage in _imgproc_ module (`CV_TERMCRIT_*` and `CV_CMP_*`)
* refactored `drawContours` to use C++ API instead of calling `cvDrawContours` + test for filled contours with holes (case with non-filled contours is simpler and is covered in some other tests)

#### Note:
There is one case where old drawContours behavior doesn't match the new one - when `contourIdx == -1` (means "draw all contours") and `maxLevel == 0` (means draw only selected contours, but not what is inside).

From the docs:
> **contourIdx**	Parameter indicating a contour to draw. If it is negative, all the contours are drawn.

> **maxLevel**	Maximal level for drawn contours. If it is 0, only the specified contour is drawn. If it is 1, the function draws the contour(s) and all the nested contours. If it is 2, the function draws the contours, all the nested contours, all the nested-to-nested contours, and so on. This parameter is only taken into account when there is hierarchy available.


Old behavior - only one first contour is drawn:
![actual_screenshot_08 05 2024](https://github.com/opencv/opencv/assets/3304494/d0ae1d64-ddad-46bb-8acc-6f696874f71b)
a
New behavior (also expected by the test) - all contours are drawn:
![expected_screenshot_08 05 2024](https://github.com/opencv/opencv/assets/3304494/57ccd980-9dde-4006-90ee-19d6ce76912a)
2024-05-17 15:01:05 +03:00
Alexander Smorkalov
f4e5438401
Merge pull request #25566 from asmorkalov:as/moments_documentation
Synchornized cv::moments documentation with actual implementation.
2024-05-14 17:19:41 +03:00
Alexander Smorkalov
58e007e183
Merge pull request #25583 from mshabunin:fix-emd-32bit
imgproc: fix allocation issue in EMD
2024-05-14 16:43:02 +03:00
Maksim Shabunin
1614b8df4e imgproc: fix allocation issue in EMD 2024-05-14 12:51:26 +03:00
Rostislav Vasilikhin
1d9a4120fa
Merge pull request #25565 from savuor:rv/hal_eq_hist
Merge pull request #25565 from savuor/rv/hal_eq_hist

HAL for equalizeHist() added #25565

fixes #25530

### 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
2024-05-09 08:37:55 +03:00
Alexander Smorkalov
55eebe81c3 Synchornized cv::moments documentation with actual implementation. 2024-05-09 08:30:36 +03:00
Alexander Smorkalov
392fd4edd1 Tune sanity threshold in Moments performance test for Android aarch64. 2024-05-07 18:24:43 +03:00
Alexander Smorkalov
8bc90a4bff
Merge pull request #25484 from mshabunin:bounding-rect-alignment
imgproc: improved test for boundingRect
2024-05-07 08:58:07 +03:00
Maksim Shabunin
a8df49f170 doc: fixed modern Javadoc issue 2024-05-03 22:09:19 +03:00
Maksim Shabunin
c4ce94232b imgproc: fixed alignment issue and improved test for boundingRect 2024-05-03 21:26:40 +03:00
Alexander Smorkalov
02c3132f02 Fix moments integration to OpenCV HAL. 2024-05-03 08:40:43 +03:00
Rostislav Vasilikhin
bc95f27e56
Merge pull request #25509 from savuor:rv/hal_otsu
HAL added for Otsu threshold #25509

fixes #25393

### 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
2024-05-02 20:50:08 +03:00
Alexander Smorkalov
b5cf4f1483
Merge pull request #25514 from xndcn:patch-1
Fix doc about uniform parameter for imgproc calcBackProject function
2024-05-01 21:03:00 +03:00
zihaomu
22de887c00 fix statckblur big kernel case 2024-04-30 18:07:21 +08:00
xndcn
e3fc850ec2
Fix doc about uniform parameter for imgproc calcBackProject function
It is said "see above" because calcBackProject is listed under calcHist function in source file, while it is listed before due to the lexicographic ordering.
2024-04-30 16:58:51 +08:00
Alexander Smorkalov
d0978cea39 Added moments interface to HAL. 2024-04-25 17:19:34 +03:00
Maksim Shabunin
7e56908306
Merge pull request #25469 from mshabunin:cpp-emd
imgproc: refactor EMD to reduce C-API usage #25469

- added more tests for EMD
- refactored to remove CvArr
- used BufferArea for memory allocations
- renamed functions and variables and formatted the code
- kept legacy functions intact in separate header
2024-04-24 14:28:31 +03:00
Maksim Shabunin
d77dbbe7a0 imgproc: sync boundingRect function with 5.x 2024-04-17 23:01:31 +03:00
Alexander Smorkalov
05a54b1405
Merge pull request #25397 from asmorkalov:as/HAL_GaussianBlur_bit_exact
Added HAL function for popular bit-exact branch of GaussianBlur with sigma=0
2024-04-17 14:24:17 +03:00
Alexander Smorkalov
577ad0a5ad
Merge pull request #25399 from asmorkalov:as/HAL_remap
New HAL API for remap
2024-04-17 14:14:21 +03:00
Alexander Smorkalov
a4b4808d9d New HAL API for remap 2024-04-17 11:17:32 +03:00
Alexander Smorkalov
f643964c68 Added HAL function for popular bit-exact branch of GaussianBlur with sigma=0. 2024-04-17 10:13:35 +03:00
Kumataro
2eb9e915d9 imgproc: doc: fix arrow symbols in header 2024-04-13 06:15:11 +09:00
Maksim Shabunin
c081efe3c6 imgproc: add 512mb tag for FindContours.accuracy test 2024-04-11 14:37:32 +03:00
Alexander Smorkalov
2c5b296ab2
Merge pull request #25343 from asmorkalov:as/HAL_bilaterialFilter
HAL interface for bilaterialFilter
2024-04-11 09:15:15 +03:00
Alexander Smorkalov
17c7f76da3 HALL interface for bilaterialFilter. 2024-04-11 09:02:45 +03:00
Alexander Smorkalov
5bad694b7f Removed old C API usage in new findContours implementation. 2024-04-10 11:19:55 +03:00
Maksim Shabunin
f37924796f
Merge pull request #25364 from mshabunin:fix-unaligned-filter
imgproc: fix unaligned memory access in filters and Gaussian blur #25364

* filter/SIMD: removed parts which casted 8u pointers to int causing unaligned memory access on RISC-V platform.
* GaussianBlur/fixed_point: replaced casts from s16 to u32 with union operations

Performance comparison:
- [x] check performance on x86_64 - (4 threads, `-DCPU_BASELINE=AVX2`, GCC 11.4, Ubuntu 22) - [report_imgproc_x86_64.ods](https://github.com/opencv/opencv/files/14904702/report_x86_64.ods)
- [x] check performance on AArch64 - (4 cores of RK3588, GCC 11.4 aarch64, Raspbian) - [report_imgproc_aarch64.ods](https://github.com/opencv/opencv/files/14908437/report_aarch64.ods)

Note: for some reason my performance results are quite unstable, unaffected functions show speedups and slowdowns in many cases. Filter2D and GaussianBlur seem to be OK.

Slightly related PR: https://github.com/opencv/ci-gha-workflow/pull/165
2024-04-09 17:44:36 +03:00
Alexander Smorkalov
b0d905864d
Merge pull request #25371 from alexlyulkov:al/adaptive-threshold-tests
Added tests for adaptiveThreshold and sepFilter2D
2024-04-09 11:51:00 +03:00
Maksim Shabunin
a25132986a
Merge pull request #25146 from mshabunin:cpp-contours
Reworked findContours to reduce C-API usage #25146

What is done:
* rewritten `findContours` and `icvApproximateChainTC89` using C++ data structures
* extracted LINK_RUNS mode to separate new public functions - `findContoursLinkRuns` (it uses completely different algorithm)
* ~added new public `cv::approximateChainTC89`~ - ** decided to hide it**
* enabled chain code output (method = 0, no public enum value for this in C++ yet)
* kept old function as `findContours_old` (exported, but not exposed to user)
* added more tests for findContours (`test_contours_new.cpp`), some tests compare results of old function with new one. Following tests have been added:
  * contours of random rectangle
  * contours of many small (1-2px) blobs
  * contours of random noise
  * backport of old accuracy test
  * separate test for LINK RUNS variant

What is left to be done (can be done now or later):
* improve tests: 
  * some tests have limited verification (e.g. only verify contour sizes)
  * perhaps reference data can be collected and stored
  * maybe more test variants can be added (?)
* add enum value for chain code output and a method of returning starting points (e.g. first 8 elements of returned `vector<uchar>` can represent 2 int point coordinates)
* add documentation for new functions - **✔️ DONE**
* check and improve performance (my experiment showed 0.7x-1.1x some time ago)
* remove old functions completely (?)
* change contour return order (BFS) or allow to select it (?)
* return result tree as-is (?) (new data structures should be exposed, bindings should adapt)
2024-04-09 09:37:49 +03:00
Alexander Lyulkov
30889f4a90 Added tests for adaptiveThreshold and sepFilter2D 2024-04-08 13:04:50 +03:00
Tsukasa Sugiura
5528e70f3c remove floating point literal 2024-04-08 14:52:53 +09:00
MaximSmolskiy
ed93384817 Fix bug in maskBoundingRect 2024-03-08 03:25:40 +03:00
Maksim Shabunin
bf06e3d09f
Merge pull request #25042 from mshabunin:doc-upgrade
Documentation transition to fresh Doxygen #25042

* current Doxygen version is 1.10, but we will use 1.9.8 for now due to issue with snippets (https://github.com/doxygen/doxygen/pull/10584)
* Doxyfile adapted to new version
* MathJax updated to 3.x
* `@relates` instructions removed temporarily due to issue in Doxygen (to avoid warnings)
* refactored matx.hpp - extracted matx.inl.hpp
* opencv_contrib - https://github.com/opencv/opencv_contrib/pull/3638
2024-03-05 16:19:45 +03:00
Alexander Smorkalov
daa8f7dfc6 Partially back-port #25075 to 4.x 2024-03-05 12:15:39 +03:00
Alexander Smorkalov
fc98b31c3e Partially backport C API removal in imgproc module to reduce conflicts with 5.x 2024-02-29 12:42:19 +03:00
Pierre Chatelier
5e5a035c5b
Merge pull request #24621 from chacha21:remap_relative
First proposal of cv::remap with relative displacement field (#24603) #24621

Implements #24603

Currently, `remap()` is applied as `dst(x, y) <- src(mapX(x, y), mapY(x, y))` It means that the maps must be filled with absolute coordinates.

However, if one wants to remap something according to a displacement field ("warp"), the operation should be `dst(x, y) <- src(x+displacementX(x, y), y+displacementY(x, y))`

It is trivial to build a mapping from a displacement field, but it is an undesirable overhead for CPU and memory.

This PR implements the feature as an experimental option, through the optional flag WARP_RELATIVE_MAP than can be ORed to the interpolation mode.

Since the xy maps might be const, there is no attempt to add the coordinate offset to those maps, and everything is postponed on-the-fly to the very last coordinate computation before fetching `src`. Interestingly, this let `cv::convertMaps()` unchanged since the fractional part of interpolation does not care of the integer coordinate offset.

### 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.
- [ ] The feature is well documented and sample code can be built with the project CMake
2024-02-28 17:20:33 +03:00
Alexander Smorkalov
62ef27ac1e
Merge pull request #24750 from YusukeKameda:4.x
Update applyColorMap document
2024-01-18 15:06:36 +03:00
MaximSmolskiy
315d0f581e Fix typos in imgproc/src/contours.cpp 2023-12-22 22:03:16 +03:00
Yusuke Kameda
95b84a0a9b
Update applyColorMap document 2023-12-22 21:22:52 +09:00
Alexander Alekhin
3340c71a2a ocl: fix kernels compilation 2023-12-21 14:29:23 +00:00
Maksim Shabunin
adde942e34 OCL: fix incompatibility with Mali ruintime 2023-12-21 00:30:44 +03:00
Kirin Chu
fb9f75c5ba
Fix typo
Changed "shough" to "should" for better clarity.
2023-12-15 09:21:23 +08:00
Vincent Rabaud
06f62a3dd1
Merge pull request #24581 from vrabaud:tsan
Fix race condition in color_lab.cpp initLabTabs(). #24581

There is a race condition between when the static bool is initialized (which is thread safe) and its value check. This PR changes the static bool to a static lambda call to make it thread safe. The static_cast<void> in the end is to prevent unused variables warnings.

### 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
2023-11-28 15:01:41 +03:00
Maxim Smolskiy
2c1ec4245d
Merge pull request #24527 from MaximSmolskiy:fix-out-of-image-corners-in-cv-cornersubpix
Fix out of image corners in cv::cornerSubPix #24527

### 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
- [ ] 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
2023-11-21 15:36:43 +03:00
Dmitry Kurtaev
ec97c38ff9
Merge pull request #24535 from dkurt:ipp_distransform_update
Handle huge images in IPP distanceTransform #24535

### Pull Request Readiness Checklist

* Do not use IPP for huge Mat (reproduced with https://github.com/opencv/opencv/issues/23895#issuecomment-1708132367 on `DIST_MASK_5`)

  I have observed two types of errors on the reproducer from the issue:

  1. When `temp` is not allocated:

    ```
    Thread 1 "app" received signal SIGSEGV, Segmentation fault.
    0x00007ffff65dc755 in icv_l9_ownDistanceTransform_5x5_8u32f_C1R_21B_g9e9 () from /home/dkurtaev/opencv_install/bin/../lib/libopencv_imgproc.so.408
    (gdb) bt
    #0  0x00007ffff65dc755 in icv_l9_ownDistanceTransform_5x5_8u32f_C1R_21B_g9e9 () from /home/dkurtaev/opencv_install/bin/../lib/libopencv_imgproc.so.408
    #1  0x00007ffff659e8df in icv_l9_ippiDistanceTransform_5x5_8u32f_C1R () from /home/dkurtaev/opencv_install/bin/../lib/libopencv_imgproc.so.408
    #2  0x00007ffff5c390f0 in cv::distanceTransform (_src=..., _dst=..., _labels=..., distType=2, maskSize=5, labelType=1) at /home/dkurtaev/opencv/modules/imgproc/src/distransform.cpp:854
    #3  0x00007ffff5c396ef in cv::distanceTransform (_src=..., _dst=..., distanceType=2, maskSize=5, dstType=5) at /home/dkurtaev/opencv/modules/imgproc/src/distransform.cpp:903
    #4  0x000055555555669e in main (argc=1, argv=0x7fffffffdef8) at /home/dkurtaev/main.cpp:18
    ```

  2. When we keep `temp` allocated every time:

    ```
    OpenCV(4.8.0-dev) Error: Assertion failed (udata < (uchar*)ptr && ((uchar*)ptr - udata) <= (ptrdiff_t)(sizeof(void*)+64)) in fastFree, file /home/dkurtaev/opencv/modules/core/src/alloc.cpp, line 191
    terminate called after throwing an instance of 'cv::Exception'
      what():  OpenCV(4.8.0-dev) /home/dkurtaev/opencv/modules/core/src/alloc.cpp:191: error: (-215:Assertion failed) udata < (uchar*)ptr && ((uchar*)ptr - udata) <= (ptrdiff_t)(sizeof(void*)+64) in function 'fastFree'
    ```

* Try enable IPP for 3x3 (see https://github.com/opencv/opencv/issues/15904)
* Reduce memory footprint with IPP

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
2023-11-14 11:44:17 +03:00
Alexander Smorkalov
1c0ca41b6e
Merge pull request #24371 from hanliutong:clean-up
Clean up the obsolete API of Universal Intrinsic
2023-10-20 12:50:26 +03:00
Vincent Rabaud
c96f48e7c9
Merge pull request #24412 from vrabaud:inter_area1
Speed up line merging in INTER_AREA #24412

This provides a 10 to 20% speed-up.

Related perf test fix: https://github.com/opencv/opencv/pull/24417
This is a split of https://github.com/opencv/opencv/pull/23525 that will be updated to only deal with column merging.

### 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
2023-10-19 14:06:50 +03:00
Alexander Smorkalov
14b21f7271 Ensure interarea algorithm usage in resize perfomance test. 2023-10-17 09:43:15 +03:00
Liutong HAN
a287605c3e Clean up the Universal Intrinsic API. 2023-10-13 19:23:30 +08:00
definitelyuncertain
a1028efdcf
Merge pull request #24333 from definitelyuncertain:CvtRGB2YUV422
Implement color conversion from RGB to YUV422 family #24333

Related PR for extra: https://github.com/opencv/opencv_extra/pull/1104

Hi,

This patch provides CPU and OpenCL implementations of color conversions from RGB/BGR to YUV422 family (such as UYVY and YUY2).

These features would come in useful for enabling standard RGB images to be supplied as input to algorithms or networks that make use of images in YUV422 format directly (for example, on resource constrained devices working with camera images captured in YUV422).

The code, tests and perf tests are all written following the existing pattern. There is also an example `bin/example_cpp_cvtColor_RGB2YUV422` that loads an image from disk, converts it from BGR to UYVY and then back to BGR, and displays the result as a visual check that the conversion works.

The OpenCL performance for the forward conversion implemented here is the same as the existing backward conversion on my hardware. The CPU implementation, unfortunately, isn't very optimized as I am not yet familiar with the SIMD code.

Please let me know if I need to fix something or can make other modifications.

Thanks!

### 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
- [x] The feature is well documented and sample code can be built with the project CMake
2023-10-12 10:18:24 +03:00
Sean McBride
5fb3869775
Merge pull request #23109 from seanm:misc-warnings
* Fixed clang -Wnewline-eof warnings
* Fixed all trivial clang -Wextra-semi and -Wc++98-compat-extra-semi warnings
* Removed trailing semi from various macros
* Fixed various -Wunused-macros warnings
* Fixed some trivial -Wdocumentation warnings
* Fixed some -Wdocumentation-deprecated-sync warnings
* Fixed incorrect indentation
* Suppressed some clang warnings in 3rd party code
* Fixed QRCodeEncoder::Params documentation.

---------

Co-authored-by: Alexander Smorkalov <alexander.smorkalov@xperience.ai>
2023-10-06 13:33:21 +03:00
HAN Liutong
07bf9cb013
Merge pull request #24325 from hanliutong:rewrite
Rewrite Universal Intrinsic code: float related part #24325

The goal of this series of PRs is to modify the SIMD code blocks guarded by CV_SIMD macro: rewrite them by using the new Universal Intrinsic API.

The series of PRs is listed below:
#23885 First patch, an example
#23980 Core module
#24058 ImgProc module, part 1
#24132 ImgProc module, part 2
#24166 ImgProc module, part 3
#24301 Features2d and calib3d module
#24324 Gapi module

This patch (hopefully) is the last one in the series. 

This patch mainly involves 3 parts
1. Add some modifications related to float (CV_SIMD_64F)
2. Use `#if (CV_SIMD || CV_SIMD_SCALABLE)` instead of `#if CV_SIMD || CV_SIMD_SCALABLE`, 
    then we can get the `CV_SIMD` module that is not enabled for `CV_SIMD_SCALABLE` by looking for `if CV_SIMD`
3. Summary of `CV_SIMD` blocks that remains unmodified: Updated comments
    - Some blocks will cause test fail when enable for RVV, marked as `TODO: enable for CV_SIMD_SCALABLE, ....`
    - Some blocks can not be rewrited directly. (Not commented in the source code, just listed here)
      - ./modules/core/src/mathfuncs_core.simd.hpp (Vector type wrapped in class/struct)
      - ./modules/imgproc/src/color_lab.cpp (Array of vector type)
      - ./modules/imgproc/src/color_rgb.simd.hpp (Array of vector type)
      - ./modules/imgproc/src/sumpixels.simd.hpp (fixed length algorithm, strongly ralated with `CV_SIMD_WIDTH`)
      These algorithms will need to be redesigned to accommodate scalable backends.

### 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
2023-10-05 17:57:25 +03:00
Dmitry Kurtaev
d752bac43f
Merge pull request #24234 from dkurt:distanceTransform_max_dist
Change max distance at distanceTransform #24234

### Pull Request Readiness Checklist

resolves https://github.com/opencv/opencv/issues/23895
related: https://github.com/opencv/opencv/pull/12278

* DIST_MASK_3 and DIST_MASK_5 maximal distance increased from 8192 to 65533 +/- 1
* Fix squares processing at DIST_MASK_PRECISE
* - [ ] TODO: Check with IPP

```cpp
    cv::Mat gray = cv::imread("opencv/samples/data/stuff.jpg", cv::ImreadModes::IMREAD_GRAYSCALE);

    cv::Mat gray_resize;
    cv::resize(gray, gray_resize, cv::Size(70000,70000), 0.0, 0.0, cv::INTER_LINEAR);

    gray_resize = gray_resize >= 100;

    cv::Mat dist;
    cv::distanceTransform(gray_resize, dist, cv::DIST_L2, cv::DIST_MASK_5, CV_32F);

    double minVal, maxVal;
    minMaxLoc(dist, &minVal, &maxVal);
    dist = 255 * (dist - minVal) / (maxVal - minVal);
    std::cout << minVal << " " << maxVal << std::endl;

    cv::Mat dist_resize;
    cv::resize(dist, dist_resize, cv::Size(1024,1024), 0.0, 0.0, cv::INTER_LINEAR);

    cv::String outfilePath = "test_mask_5.png";
    cv::imwrite(outfilePath, dist_resize);
```

mask | 4.x | PR |
----------|--------------|--------------
DIST_MASK_3 | <img src="https://github.com/opencv/opencv/assets/25801568/23e5de76-a8ba-4eb8-ab03-fa55672834be" width="128"> | <img src="https://github.com/opencv/opencv/assets/25801568/e1149f6a-49d6-47bd-a2a8-20bb7e4dafa4" width="128"> |
DIST_MASK_5 | <img src="https://github.com/opencv/opencv/assets/25801568/98aba29b-8865-4b9a-8066-669b16d175c9" width="128"> | <img src="https://github.com/opencv/opencv/assets/25801568/54f62ed2-9ef6-485f-bd63-48cc96accd7d" width="128"> |
DIST_MASK_PRECISE | <img src="https://github.com/opencv/opencv/assets/25801568/c4d79451-fd7a-461f-98fc-13060c63f473" width="128"> | <img src="https://github.com/opencv/opencv/assets/25801568/b5bfcaf5-bc48-40ba-b8e3-d000e5ab48db" width="128">|

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
2023-10-03 17:23:32 +03:00
HAN Liutong
320c0bf419
Merge pull request #24166 from hanliutong:rewrite-remaining
Rewrite Universal Intrinsic code: ImgProc (CV_SIMD_WIDTH related Part) #24166

Related PR: #24058, #24132. The goal of this series of PRs is to modify the SIMD code blocks in the opencv/modules/imgproc folder by using the new Universal Intrinsic API.

The modification of this PR mainly focuses on the code that uses the `CV_SIMD_WIDTH` macro. This macro is sometimes used for loop tail processing, such as `box_filter.simd.hpp` and `morph.simd.hpp`.

```cpp
#if CV_SIMD
int i = 0;
for (i < n - v_uint16::nlanes; i += v_uint16::nlanes) {
// some universal intrinsic code
// e.g. v_uint16...
}
#if CV_SIMD_WIDTH > 16
for (i < n - v_uint16x8::nlanes; i += v_uint16x8::nlanes) {
// handle loop tail by 128 bit SIMD
// e.g. v_uint16x8
}
#endif //CV_SIMD_WIDTH 
#endif// CV_SIMD
```
The main contradiction is that the variable-length Universal Intrinsic backend cannot use 128bit fixed-length data structures. Therefore, this PR uses the scalar loop to handle the loop tail.

This PR is marked as draft because the modification of the `box_filter.simd.hpp` file caused a compilation error. The cause of the error is initially believed to be due to an internal error in the GCC compiler.

```bash
box_filter.simd.hpp:1162:5: internal compiler error: Segmentation fault
 1162 |     }
      |     ^
0xe03883 crash_signal
        /wafer/share/gcc/gcc/toplev.cc:314
0x7ff261c4251f ???
        ./signal/../sysdeps/unix/sysv/linux/x86_64/libc_sigaction.c:0
0x6bde48 hash_set<rtl_ssa::set_info*, false, default_hash_traits<rtl_ssa::set_info*> >::iterator::operator*()
        /wafer/share/gcc/gcc/hash-set.h:125
0x6bde48 extract_single_source
        /wafer/share/gcc/gcc/config/riscv/riscv-vsetvl.cc:1184
0x6bde48 extract_single_source
        /wafer/share/gcc/gcc/config/riscv/riscv-vsetvl.cc:1174
0x119ad9e pass_vsetvl::propagate_avl() const
        /wafer/share/gcc/gcc/config/riscv/riscv-vsetvl.cc:4087
0x119ceaf pass_vsetvl::execute(function*)
        /wafer/share/gcc/gcc/config/riscv/riscv-vsetvl.cc:4344
0x119ceaf pass_vsetvl::execute(function*)
        /wafer/share/gcc/gcc/config/riscv/riscv-vsetvl.cc:4325
Please submit a full bug report, with preprocessed source (by using -freport-bug).
Please include the complete backtrace with any bug report.
```

This PR can be compiled with Clang 16, and `opencv_test_imgproc` is passed on QEMU.

### 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
2023-09-19 15:12:52 +03:00
HAN Liutong
f617fbe166
Merge pull request #24132 from hanliutong:rewrite-imgproc2
Rewrite Universal Intrinsic code by using new API: ImgProc module Part 2 #24132

The goal of this series of PRs is to modify the SIMD code blocks guarded by CV_SIMD macro in the opencv/modules/imgproc folder: rewrite them by using the new Universal Intrinsic API.

This is the second part of the modification to the Imgproc module ( Part 1: #24058 ), And I tested this patch on RVV (QEMU) and AVX devices, `opencv_test_imgproc` is passed.

The patch is partially auto-generated by using the [rewriter](https://github.com/hanliutong/rewriter).

### 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
2023-09-19 08:52:42 +03:00
HAN Liutong
5e9191558d
Merge pull request #24058 from hanliutong:rewrite-imgporc
Rewrite Universal Intrinsic code by using new API: ImgProc module. #24058

The goal of this series of PRs is to modify the SIMD code blocks guarded by CV_SIMD macro in the `opencv/modules/imgproc` folder: rewrite them by using the new Universal Intrinsic API. 

For easier review, this PR includes a part of the rewritten code, and another part will be brought in the next PR (coming soon). I tested this patch on RVV (QEMU) and AVX devices, `opencv_test_imgproc` is passed.

The patch is partially auto-generated by using the [rewriter](https://github.com/hanliutong/rewriter), related PR https://github.com/opencv/opencv/pull/23885 and https://github.com/opencv/opencv/pull/23980.



### 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
2023-09-14 20:37:46 +03:00
Yuriy Chernyshov
8a415c881a Add missing std namespace qualifiers 2023-09-06 13:46:39 +03:00
Dmitry Kurtaev
c4c2e2e796
Merge pull request #24214 from dkurt:distanceTransform_big_step
Fix distanceTransform for inputs with large step and height #24214

### Pull Request Readiness Checklist

resolves https://github.com/opencv/opencv/issues/23895

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
2023-09-05 15:21:10 +03:00
Dmitry Kurtaev
6ae7caaa01
Merge pull request #24216 from dkurt:inter_lines_less_compute
Minor optimization of two lines intersection #24216

### Pull Request Readiness Checklist

Not significant, but we can reduce number of multiplications while compute two lines intersection. Both methods are used heavily in their modules.

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
- [ ] 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
2023-09-05 10:44:56 +03:00
Kumataro
81cc89a3ce
Merge pull request #24179 from Kumataro:fix24145
* core:add OPENCV_IPP_MEAN/MINMAX/SUM option to enable IPP optimizations

* fix: to use guard HAVE_IPP and ocv_append_source_file_compile_definitions() macro.

* support OPENCV_IPP_ENABLE_ALL

* add document for OPENCV_IPP_ENABLE_ALL

* fix OPENCV_IPP_ENABLE_ALL comment
2023-08-23 22:53:11 +03:00
Ginkgo
a301d1c298 fix ipp_warpAffine return value error 2023-08-14 20:58:35 +08:00
Vincent Rabaud
94de7e5d21
Merge pull request #24042 from vrabaud:circle
Fix harmless ASAN error. #24042

For an empty radius, &v[0] would be accessed (though the called functions would not use it due to v.size() being 0). Also add checks for emptyness and fix the first element checks, in case we get INT_MAX to compare to.

### 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
2023-07-26 20:00:22 +03:00
Alexander Smorkalov
b22c2505a8 Disable warning C5054 in VS 2022 C++20 2023-07-26 09:23:32 +03:00
Alexander Smorkalov
09d2f4ea46
Merge pull request #23931 from asmorkalov:as/drawing_overflow
Fixed possible out-of-bound access in circles drawing
2023-07-21 12:28:14 +03:00
Alexander Smorkalov
81f07f001e
Merge pull request #24008 from iarspider:patch-1
test_houghlines: Fix C++20 compatibility
2023-07-18 15:37:43 +03:00
iarspider
55906457e6
test_houghlines: Fix C++20 compatibility
C++20 made it invalid to use simple-template-ids for constructors and destructors: https://eel.is/c++draft/diff.cpp17.class#2
GCC 11 and later throw an error on this, with the unhelpful message `expected unqualified-id before ')' token`. This PR fixes the problem.
2023-07-18 09:18:17 +02:00
Alexander Smorkalov
52d9685cb9 Fixed possible out-of-bound access in circles drawing. 2023-07-14 09:21:33 +03:00
Vincent Rabaud
fdfb875208
Merge pull request #23922 from vrabaud:imgwarp
Fix imgwarp at borders when transparent. #23922

I believe this is a proper fix to #23562

The PR #23754 overwrites data while that should not be the case with transparent data. The original test is failing because points at the border do not get computed because they do not have 4 neighbors to be computed. Still ,we can approximate their computation with whatever neighbors that are available.

### 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
2023-07-12 15:20:01 +03:00
Maksim Shabunin
3f0707234f risc-v: fix unaligned loads and stores 2023-07-11 19:23:12 +03:00
Maksim Shabunin
09944a83d9 build: w/a compiler warnings for GCC 11-12 and Clang 13, reduce build output 2023-07-10 11:27:59 +03:00
Alexander Smorkalov
004801f1c5 Merge remote-tracking branch 'origin/3.4' into merge-3.4 2023-06-20 09:56:57 +03:00
lamm45
ddcbd2cc26
Merge pull request #22798 from lamm45:distransform-large
Fix distransform to work with large images #22798

This attempts to fix the following bug which was caused by storing squares of large integers into 32-bit floating point variables:
https://github.com/opencv/opencv/issues/22732


### 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.
- [ ] The feature is well documented and sample code can be built with the project CMake
2023-06-19 15:11:01 +03:00
Dmitry Kurtaev
ec95efca10
Merge pull request #23754 from dkurt:remap_linear_transparent
Keep inliers for linear remap with BORDER_TRANSPARENT #23754

Address https://github.com/opencv/opencv/issues/23562

### Pull Request Readiness Checklist

resolves https://github.com/opencv/opencv/issues/23562

I do think that this is a bug because with `INTER_CUBIC + BORDER_TRANSPARENT` the last column and row are preserved. So same should be done for `INTER_LINEAR`

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
2023-06-16 18:30:21 +03:00
Christine Poerschke
f597838685 imgproc: optimise local cost computation in IntelligentScissorsMB::buildMap 2023-06-07 22:06:52 +01:00
Christine Poerschke
d3e7968927
Merge pull request #23688 from cpoerschke:4.x-pr-21959-prep
imgproc: add contour values check to IntelligentScissorsMB tests

Preparation for the #21959 changes as per @asmorkalov's https://github.com/opencv/opencv/pull/21959#issuecomment-1560511500 suggestion.

### 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
- [ ] 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
2023-06-07 11:32:17 +03:00
Maksim Shabunin
adab462e42 imgproc/cvtColor: fixed invalid read in BGR2HLS 2023-06-05 23:25:44 +03:00
Pierre Chatelier
93d490213f
Merge pull request #23690 from chacha21:rotatedRectangleIntersection_precision
better accuracy for _rotatedRectangleIntersection() (proposal for #23546) #23690

_rotatedRectangleIntersection() can be (statically) customized to use double instead of float for better accuracy
this is a proposal for experimentation around #23546

for better accuracy, _rotatedRectangleIntersection() could use double. It will still return cv::Point2f list for backward compatibility, but the inner computations are controlled by a typedef

- [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
2023-05-30 17:46:39 +03:00
Alexander Smorkalov
02397ef851
Merge pull request #23567 from seanm:UBSan-overflow
Reformulated some pointer arithmetic to avoid (unsigned) overflow
2023-05-29 12:19:34 +03:00
Christine Poerschke
b5e9eb742c
Merge pull request #23698 from cpoerschke:4.x-pr-21959-perf
imgproc: add basic IntelligentScissorsMB performance test #23698

Adding basic performance test that can be used before and after the #21959 changes etc. as per @asmorkalov's https://github.com/opencv/opencv/pull/21959#issuecomment-1565240926 comment.

### 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
- [ ] 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
2023-05-29 11:02:59 +03:00
Sean McBride
2083fdc9c0 Fixed UBSan warning about undefined pointer arithmetic overflow
Pointer arithmetic overflow is always undefined, whether signed or unsigned.

It warned here:

`Addition of unsigned offset to 0x00017fd31b97 overflowed to 0x00017fd30c97`

Convert the offset to a signed number, so that we can offset either forward or backwards.

In my own use of OpenCV at least, this is the only case of pointer arithmetic overflow.
2023-05-26 15:54:52 -04:00
Dmitry Kurtaev
c97942cf78 Fix mask thresholding 2023-05-26 18:51:33 +03:00
captain-n3m0
6157db6462 Fixed matchTemplate function. #23585 2023-05-26 18:51:01 +03:00
Alexander Smorkalov
d4861bfd1f Merge remote-tracking branch 'origin/3.4' into merge-3.4 2023-05-24 14:37:48 +03:00
Akshat Chauhan
c07145fe28
Merge pull request #23662 from akormous:docfix
Fix truncated sentenced in boxPoints documentation #22975 #23662

Resolves #22975

Completed the sentence as per the suggestion given in the issue #22975
### 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
2023-05-24 11:41:25 +03:00
Alexander Smorkalov
98d678c2d2 Added check that YUYV input of cvtColor has even width. 2023-05-23 14:17:43 +03:00
Dmitry Kurtaev
c92135bdd1
Merge pull request #23634 from dkurt:fix_nearest_exact
Fix even input dimensions for INTER_NEAREST_EXACT #23634

### Pull Request Readiness Checklist

resolves https://github.com/opencv/opencv/issues/22204
related: https://github.com/opencv/opencv/issues/9096#issuecomment-1551306017

/cc @Yosshi999

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
2023-05-19 20:32:04 +03:00
Sean McBride
58e4a880a2 Deprecated convertTypeStr and made new variant that also takes the buffer size
This allows removing the unsafe sprintf.
2023-04-26 09:48:15 -04:00
Alexander Smorkalov
e4a29d93fe Merge remote-tracking branch 'origin/3.4' into merge-3.4 2023-04-21 10:55:04 +03:00
Alexander Smorkalov
4c06a721ef
Merge pull request #23503 from seanm:issue13729
Fixed undefined left shifting of negative number
2023-04-20 12:10:04 +03:00
Sean McBride
47bea69322
Merge pull request #23055 from seanm:sprintf2
* Replaced most remaining sprintf with snprintf
* Deprecated encodeFormat and introduced new method that takes the buffer length
* Also increased buffer size at call sites to be a little bigger, in case int is 64 bit
2023-04-18 09:22:59 +03:00
Sean McBride
aa2fabcba5 Fixed undefined left shifting of negative number
Added explicit cast to unsigned before doing the left shift.

This was caught by UBSan which reported things like:

drawing.cpp:361:22: runtime error: left shift of negative value -26214
drawing.cpp:383:22: runtime error: left shift of negative value -78642
2023-04-17 15:39:37 -04:00
Gaotianhong
f1dbc7d724 fix warning in pointPolygonTest 2023-04-13 13:13:27 +08:00
Simon Lynen
6033599c88
Make LineSegmentDetector deterministic by using stable_sort for ordering keypoints prior to region growing
This makes LineSegmentDetector deterministic by using stable_sort for ordering points by norm. Without this change the region growing in LSD is non-determinstic and thus the returned lines are changing between invocations.

This is a replacement for https://github.com/opencv/opencv/pull/23370
2023-03-22 04:12:51 +01:00
Vincent Rabaud
8ad8ec679f
Merge pull request #22441 from vrabaud:hls_while
In case of huge (and probably invalid) input, make sure we do not
rely only on the while loops for truncation.

### 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
2023-03-07 15:05:38 +03:00
Alexander Alekhin
47293f28cf Merge remote-tracking branch 'upstream/3.4' into merge-3.4 2023-02-11 18:35:00 +00:00
Ibai Gorordo
c280cd7290
Merge pull request #23210 from ibaiGorordo:rect_nfa_bugfix
Fix rect_nfa (lsd)

* Fix missing log_gamma in nfa()

Comparing the nfa function with the function in the binomial_nfa repository (https://github.com/rafael-grompone-von-gioi/binomial_nfa/blob/main/C99/log_binomial_nfa.c#L152), the first log_gamma call is missing.

* Fix rect_nfa pixel index

* Replace std::rotate

* Rename tmp to v_tmp

* Replace auto and std::min_element

* Change slope equality check to int

* Fix left limit check
2023-02-08 17:33:06 +00:00
Maksim Shabunin
e4acd74e87 Fix some clang 14 warnings 2023-02-07 01:19:00 +03:00
Alexander Alekhin
d3ae175bca Merge remote-tracking branch 'upstream/3.4' into merge-3.4 2023-01-28 10:01:23 +00:00
Alexander Alekhin
c67d4fc633 Merge pull request #23076 from inayd:22012-bugfixFillPoly 2023-01-28 09:55:02 +00:00