Commit Graph

24766 Commits

Author SHA1 Message Date
Kumataro
da3debda6d
Merge pull request #25981 from Kumataro:fix25971
imgproc: add specific error code when cvtColor is used on an image with an invalid number of channels #25981

close #25971

### 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-08-09 14:22:02 +03:00
Alexander Smorkalov
67d0338c9c
Merge pull request #26004 from ericmariasis:eric-mariasis-issue-26000
got rid of std prefix
2024-08-07 10:26:24 +03:00
ericmariasis
3f92884520 got rid of std prefix 2024-08-07 00:17:04 -04:00
James Choi
582a7f32d5
Merge pull request #25832 from chachoi-world:4.x
Add support for QNX #25832

Build and test instruction for QNX:
https://github.com/chachoi-world/qnx-ports/blob/main/opencv/README.md

### 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
2024-08-06 20:25:39 +03:00
Alexander Smorkalov
d8bcc2c85d
Merge pull request #25996 from asmorkalov:as/fillPoly_check
Fixed asserts in fillPoly
2024-08-06 17:56:22 +03:00
Rostislav Vasilikhin
1acf722e24
Merge pull request #25970 from savuor:rv/hal_pyrdown
pyrDown: offset HAL added, IPP removed #25970

Resolves #25976

### Changes
* HAL added for offset support so that border pixels can be fetched from outside of the image ROI (see `BORDER_ISOLATED` parameter)
* IPP removed since there is `pyrUp` instead of `pyrDown` and there's no easy way to fix this other than rewriting it from scratch
* replaced old C call by modern `cv::pyrDown`

### 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.
- [x] The feature is well documented and sample code can be built with the project CMake
2024-08-06 15:04:53 +03:00
Alexander Smorkalov
9dee2c6e67 Fixed asserts in fillPoly. 2024-08-06 12:02:01 +03:00
Alexander Smorkalov
49459d46e2
Merge pull request #25932 from asmorkalov:as/HAL_cvtColor_aprox
Added xxxApprox overloads for YUV color conversions in HAL and AlgorithmHint to cvtColor #25932

The xxxApprox to implement HAL functions with less bits for arithmetic of FP.

The hint was introduced in #25792 and #25911

### 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-08-06 11:40:58 +03:00
Alexander Smorkalov
333054e05e
Merge pull request #25943 from asmorkalov:as/fisheye_distrort_newk
Added fisheye::distortPoints with non-identity projection matrix
2024-08-05 19:33:18 +03:00
Alexander Smorkalov
ea2a3cb264
Merge pull request #25643 from cpoerschke:issue-25635-find-existing-file-tests
replace lena.jpg in find-existing-file tests
2024-08-05 15:28:16 +03:00
Alexander Smorkalov
ecbff5a20c
Merge pull request #25786 from plctlab:rvp_3rdparty
3rdparty: NDSRVP - Part 1.5: New Interfaces
2024-08-05 15:26:31 +03:00
Alexander Smorkalov
75fca7d9d0 Added fisheye::distort with non-identity projection matrix. 2024-08-05 15:22:00 +03:00
Maxim Smolskiy
6ed603e917
Merge pull request #25991 from MaximSmolskiy:improve-corners-matching-in-ChessBoardDetector-NeighborsFinder-findCornerNeighbor
Improve corners matching in ChessBoardDetector::NeighborsFinder::findCornerNeighbor #25991

### Pull Request Readiness Checklist

Idea was mentioned in `Section III-B. New Heuristic for Quadrangle Linking` of `Rufli, Martin & Scaramuzza, Davide & Siegwart, Roland. (2008). Automatic Detection of Checkerboards on Blurred and Distorted Images. 2008 IEEE/RSJ International Conference on Intelligent Robots and Systems, IROS. 3121-3126. 10.1109/IROS.2008.4650703` (https://rpg.ifi.uzh.ch/docs/IROS08_scaramuzza_b.pdf):
![Снимок экрана от 2024-08-05 09-51-27](https://github.com/user-attachments/assets/7a090ccc-c24c-4dfb-b0dd-259c8709eb72)
```
* For each candidate pair, focus on the quadrangles they belong to and draw two straight lines passing through the midsections of the respective quadrangle edges (see Fig. 6).
* If the candidate corner and the source corner are on the same side of every of the four straight lines drawn this way (this corresponds to the yellow shaded area in Fig. 6), then the corners are successfully matched.
```

By improving corners matching, we can increase the search radius (`thresh_scale`).

I tested this PR with benchmark
```
python3 objdetect_benchmark.py --configuration=generate_run --board_x=7 --path=res_chessboard --synthetic_object=chessboard
```
PR increases detected chessboards number by `3/7%`:
```
cell_img_size = 100 (default)

before
                                 category  detected chessboard  total detected chessboard  total chessboard  average detected error chessboard
                                      all             0.910417                      13110             14400                           0.599746
Total detected time:  147.50906700000002 sec

after
                                 category  detected chessboard  total detected chessboard  total chessboard  average detected error chessboard
                                      all             0.941667                      13560             14400                           0.596726
Total detected time:  136.68963200000007 sec

----------------------------------------------------------------------------------------------------------------------------------------------

cell_img_size = 10

before
                                 category  detected chessboard  total detected chessboard  total chessboard  average detected error chessboard
                                      all             0.539792                       7773             14400                           4.208237
Total detected time:  2.668964 sec

after
                                 category  detected chessboard  total detected chessboard  total chessboard  average detected error chessboard
                                      all             0.579167                       8340             14400                           4.198448
Total detected time:  2.535998999999999 sec
```

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
- [ ] 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-08-05 13:28:07 +03:00
Alexander Smorkalov
ab99f87b6a
Merge pull request #25979 from asmorkalov:as/custom_allocator
Set and check allocator pointer for all cv::Mat instances
2024-08-05 11:52:00 +03:00
Alexander Smorkalov
9de2ebbec1
Merge pull request #25978 from chacha21:cuda_stdallocator
Adding getStdAllocator() to cv::cuda::GpuMat
2024-08-05 10:58:33 +03:00
Alexander Smorkalov
a15cd4b63d Set and check allocator pointer for all cv::Mat instances. 2024-08-05 10:07:14 +03:00
Aven
796974cccc fix compilation errors caused by namespace
related: #25199
2024-08-04 05:04:03 +08:00
stepkamipt
340a390ea2 Fix path to 3rdparty cmake.
Current code using CMAKE_SOURCE_DIR and it works well if opencv is standalone CMake project,
but in case of building OpenCV as part of a larger CMake project (e.g. one that includes
opencv and opencv_contrib) this path is incorrect, unlike OpenCV_SOURCE_DIR
2024-08-02 10:07:36 +02:00
Junyan721113
35463e079c feat: Part 1.5 - New Interfaces 2024-08-02 13:47:45 +08:00
chacha21
f67d4852bf Added no-imp placeholder when HAVE_CUDA is false 2024-08-01 10:00:31 +02:00
chacha21
2db7f8e827 Adding getStdAllocator() to cv::cuda::GpuMat
To be on par with `cv::Mat`, let's add `cv::cuda::GpuMat::getStdAllocator()`
This is useful anyway, because when a user wants to use custom allocators, he might want to resort to the standard default allocator behaviour, not some other allocator that could have been set by `setDefaultAllocator()`
2024-08-01 09:36:08 +02:00
Alexander Smorkalov
93745245a3 Improved error handling in image codecs. 2024-08-01 08:34:29 +03:00
Daniele Affinita
2a333a6c86
Merge pull request #25644 from DaniAffCH:blockwise-quantization
[GSoC] dnn: Blockwise quantization support #25644

This PR introduces blockwise quantization in DNN allowing the parsing of ONNX models quantized in blockwise style. In particular it modifies the `Quantize` and `Dequantize` operations. The related PR opencv/opencv_extra#1181 contains the test data.

Additional notes:
- The original quantization issue has been fixed. Previously, for 1D scale and zero-point, the operation applied was  $y = int8(x/s - z)$ instead of $y = int8(x/s + z)$. Note that the operation was already correctly implemented when the scale and zero-point were scalars. The previous implementation failed the ONNX test cases, but now all have passed successfully.  [Reference](https://github.com/onnx/onnx/blob/main/docs/Operators.md#QuantizeLinear)
- the function `block_repeat` broadcasts scale and zero-point to the input shape. It repeats all the elements of a given axis n times. This function generalizes the behavior of `repeat` from the core module which is defined just for 2 axis assuming `Mat` has 2 dimensions. If appropriate and useful, you might consider moving `block_repeat` to the core module.
- Now, the scale and zero-point can be taken as layer inputs. This increases the ONNX layers' coverage and enables us to run the ONNX test cases (previously disabled) being fully compliant with ONNX standards. Since they are now supported, I have enabled the test cases for: `test_dequantizelinear`, `test_dequantizelinear_axis`, `test_dequantizelinear_blocked`, `test_quantizelinear`, `test_quantizelinear_axis`, `test_quantizelinear_blocked` just in CPU backend. All of them pass successfully.
   
### 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.
- [x] The feature is well documented and sample code can be built with the project CMake
2024-07-30 14:16:08 +03:00
Alexander Smorkalov
89fff355c8
Merge pull request #25961 from gblikas:gblikas_4.x_ts_js
fix: js/html perf tests
2024-07-30 08:53:04 +03:00
gblikas
99672a2691 fix: js perf tests
modules/js/perf/perf_helpfunc.js and target tests, e.g. perf_gaussianBlur.js contained "const isNodeJs", leading to re-definition when using associated *.html files.
2024-07-26 13:24:26 -07:00
Alexander Smorkalov
1ca526dcdb
Merge pull request #25940 from Kumataro:fix25928
python: prefer cv::Mat over cv::UMat in python binding
2024-07-26 14:39:49 +03:00
Kumataro
be3c519956 core: FileStorage: detect invalid attribute value 2024-07-26 05:55:00 +09:00
Alexander Lyulkov
0b3dbdd4b3 Added Java ORB test 2024-07-25 16:47:41 +03:00
Alexander Smorkalov
eab21b6106
Merge pull request #25814 from sturkmen72:numFrames
add getFrameCount() member function to BaseImageDecoder
2024-07-24 17:13:15 +03:00
Alexander Smorkalov
c5de090964
Merge pull request #25944 from vrabaud:depth_check
Avoid future integer overflow in _OutputArray::create
2024-07-24 16:38:42 +03:00
武士风度的牛
160879c100
Merge pull request #25807 from spdfghi:4.x
Search in two directions when try to add new quad in addOuterQuad #25807

In ChessBoardDetector::addOuterQuad, previous code try to connect new quad with inner quad, if possible, but only search for one direction. I have made  three test images, one is normal(a.jpg), one lossed an outer quad(b.jpg), and then i flipped it vertically(c.jpg). Only last one fails. I fixed it by check two directions and row/col.

Here is the test code and images:
```
Mat img;
vector<Point2f> corners;
auto size = cv::Size(6, 6);
img = imread("D:/tmp/a.jpg", 0);
std::cout<<cv::findChessboardCorners(img, size, corners)<<"\n";
std::cout << corners.size() << "\n";
img = imread("D:/tmp/b.jpg", 0);
std::cout<<cv::findChessboardCorners(img, size, corners)<<"\n";
std::cout << corners.size() << "\n";
img = imread("D:/tmp/c.jpg", 0);
std::cout<<cv::findChessboardCorners(img, size, corners)<<"\n";
std::cout << corners.size() << "\n";
```
![a](https://github.com/opencv/opencv/assets/92856207/0dc7f5bf-7637-4333-9a9f-ec4ede790027)
a
![b](https://github.com/opencv/opencv/assets/92856207/39793485-ca0c-44c0-b44d-a593d36c1888)
b
![c](https://github.com/opencv/opencv/assets/92856207/2e7789c8-cfa5-438c-9530-2862a8a3741f)
c
2024-07-24 15:29:13 +03:00
Vincent Rabaud
c16927605d
Merge pull request #25938 from vrabaud:charuco
Properly check markers when none are provided. #25938

CharucoDetectorImpl::detectBoard finds temporary markers when none are provided but those are discarded when
charucoDetectorImpl::checkBoard is called.

### 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-07-24 09:27:07 +03:00
Vincent Rabaud
e1b57057bf Avoid future integer overflow in _OutputArray::create
This fix is useless in 4.x and fixes harmless overflows in 5.x
This belongs to 4.x as it is closer to the intended meaning.
2024-07-23 16:22:55 +02:00
Alexander Smorkalov
38cfea981f Report used HAL to test log and xml 2024-07-23 12:03:39 +03:00
Rostislav Vasilikhin
44c814e334
Merge pull request #25936 from savuor:rv/hal_dot
HAL for dot product added #25936

### 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.
- [x] The feature is well documented and sample code can be built with the project CMake
2024-07-23 08:06:15 +03:00
cudawarped
c9b57819b1
Merge pull request #25874 from cudawarped:videoio_ffmpeg_fix_encapsulate_ts
videoio: fix cv::VideoWriter with FFmpeg encapsulation timestamps #25874

Fix https://github.com/opencv/opencv/issues/25873 by modifying `cv::VideoWriter` to use provided presentation indices (pts).

### 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-07-22 17:41:39 +03:00
Kumataro
db3654ef51 python: prefer cv::Mat over cv::UMat in python binding 2024-07-21 10:00:29 +09:00
Yuantao Feng
23b244d3a3
Merge pull request #25881 from fengyuentau:dnn/cpu/optimize_activations_with_v_exp
dnn: optimize activations with v_exp #25881

Merge with https://github.com/opencv/opencv_extra/pull/1191.

This PR optimizes the following activations:

- [x] Swish
- [x] Mish
- [x] Elu
- [x] Celu
- [x] Selu
- [x] HardSwish

### Performance (Updated on 2024-07-18)

#### AmLogic A311D2 (ARM Cortex A73 + A53)

```
Geometric mean (ms)

            Name of Test              activations activations.patch activations.patch
                                                                              vs
                                                                         activations
                                                                          (x-factor)
Celu::Layer_Elementwise::OCV/CPU        115.859          27.930              4.15
Elu::Layer_Elementwise::OCV/CPU          27.846          27.003              1.03
Gelu::Layer_Elementwise::OCV/CPU         0.657           0.602               1.09
HardSwish::Layer_Elementwise::OCV/CPU    31.885          6.781               4.70
Mish::Layer_Elementwise::OCV/CPU         35.729          32.089              1.11
Selu::Layer_Elementwise::OCV/CPU         61.955          27.850              2.22
Swish::Layer_Elementwise::OCV/CPU        30.819          26.688              1.15
```

#### Apple M1

```
Geometric mean (ms)

               Name of Test                activations activations.patch activations.patch
                                                                                   vs
                                                                              activations
                                                                               (x-factor)
Celu::Layer_Elementwise::OCV/CPU              16.184          2.118               7.64
Celu::Layer_Elementwise::OCV/CPU_FP16         16.280          2.123               7.67
Elu::Layer_Elementwise::OCV/CPU               9.123           1.878               4.86
Elu::Layer_Elementwise::OCV/CPU_FP16          9.085           1.897               4.79
Gelu::Layer_Elementwise::OCV/CPU              0.089           0.081               1.11
Gelu::Layer_Elementwise::OCV/CPU_FP16         0.086           0.074               1.17
HardSwish::Layer_Elementwise::OCV/CPU         1.560           1.555               1.00
HardSwish::Layer_Elementwise::OCV/CPU_FP16    1.536           1.523               1.01
Mish::Layer_Elementwise::OCV/CPU              6.077           2.476               2.45
Mish::Layer_Elementwise::OCV/CPU_FP16         5.990           2.496               2.40
Selu::Layer_Elementwise::OCV/CPU              11.351          1.976               5.74
Selu::Layer_Elementwise::OCV/CPU_FP16         11.533          1.985               5.81
Swish::Layer_Elementwise::OCV/CPU             4.687           1.890               2.48
Swish::Layer_Elementwise::OCV/CPU_FP16        4.715           1.873               2.52
```

#### Intel i7-12700K

```
Geometric mean (ms)

            Name of Test              activations activations.patch activations.patch
                                                                    vs
                                                               activations
                                                                (x-factor)
Celu::Layer_Elementwise::OCV/CPU        17.106       3.560         4.81
Elu::Layer_Elementwise::OCV/CPU          5.064       3.478         1.46
Gelu::Layer_Elementwise::OCV/CPU         0.036       0.035         1.04
HardSwish::Layer_Elementwise::OCV/CPU    2.914       2.893         1.01
Mish::Layer_Elementwise::OCV/CPU         3.820       3.529         1.08
Selu::Layer_Elementwise::OCV/CPU        10.799       3.593         3.01
Swish::Layer_Elementwise::OCV/CPU        3.651       3.473         1.05
```

### 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-07-19 16:03:19 +03:00
Alexander Smorkalov
26714f9a34
Merge pull request #25905 from tintou:tintou/glib-cleanup
highgui: Make GThread mandatory with GTK
2024-07-19 14:42:32 +03:00
HAN Liutong
b5ea32158a
Merge pull request #25883 from hanliutong:rvv-intrin-upgrade
Upgrade RISC-V Vector intrinsic and cleanup the obsolete RVV backend. #25883

This patch upgrade RISC-V Vector intrinsic from `v0.10` to `v0.12`/`v1.0`:
- Update cmake check and options;
- Upgrade RVV implement for Universal Intrinsic;
- Upgrade RVV optimized DNN kernel.
- Cleanup the obsolete RVV backend (`intrin_rvv.hpp`) and compatable header file.

With this patch, RVV backend require Clang 17+ or GCC 14+ (which means `__riscv_v_intrinsic >= 12000`, see https://godbolt.org/z/es7ncETE3)

This patch is test with Clang 17.0.6 (require extra `-DWITH_PNG=OFF` due to ICE), Clang 18.1.8 and GCC 14.1.0 on QEMU and k230 (with `--gtest_filter="*hal_*"`).

### 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
- [ ] 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
2024-07-19 11:41:42 +03:00
_Ayaka
4dd54bbec9
Merge pull request #25898 from Octopus136:issue-25853
Add a check for src == dst in ocl warpTransform #25898

As mentioned in #25853, when doing WarpAffine with Mat and UMat respectively, if you force the use of the in-place operation (so that src and dst are passed the same variables), Mat produces the correct results, but UMat produces unexpected results.

Obviously in-place operations are not possible with this transformation. When Mat performs the operation, if dst and src are the same variable, the function inherently makes a copy of src without telling the user. 

74b50c7af0/modules/imgproc/src/imgwarp.cpp (L2831-L2834)

So I did the same check in UMat, but I'm not sure if it's appropriate, should we just do a copy operation without telling the user (even if the user thinks he's doing an in-place operation), or should we throw an exception to indicate that we shouldn't pass in two same variables here?

The possible reason for this problem is that there is a create function here, so it gives the developer the false impression that this create function has allocated new memory for dst, however it does not.

74b50c7af0/modules/imgproc/src/imgwarp.cpp (L2607-L2609)

Because by the time the check is done here, the function has returned back.

74b50c7af0/modules/core/src/umatrix.cpp (L668-L675)

### 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-07-19 09:08:19 +03:00
zihaomu
1125755345
Merge pull request #25931 from zihaomu:clean_code
code clean #25931

Align code and remove redundant CMake code

### 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
2024-07-18 17:18:37 +03:00
Alexander Smorkalov
0020831414
Merge pull request #25927 from yeatse:fix-swift-name
Resolve Swift method name conflicts by adding missing namespace
2024-07-18 11:17:49 +03:00
Alexander Smorkalov
0c2da1dc9b
Merge pull request #25914 from r-barnes:4.x
throw() -> noexcept
2024-07-17 19:21:16 +03:00
Yang Chao
bcce38c05a
fix: resolve Swift method name conflicts by adding missing namespace 2024-07-18 00:20:17 +08:00
Richard Barnes
d1505693dd throw() -> noexcept 2024-07-16 06:36:52 -07:00
Alexander Smorkalov
53a5b85d9f
Merge pull request #25913 from asmorkalov:as/chessboard_debug_logs
Use CV_LOG_DEBUG for debug logging in chessboard detector.
2024-07-16 08:28:28 +03:00
Alexander Smorkalov
7b176d898b
Merge pull request #25912 from asmorkalov:as/round_pair_f64_restore
Restored removed test_round_pair_f64 test after PR 24941
2024-07-15 20:30:49 +03:00
Alexander Smorkalov
9ebf387850
Merge pull request #25911 from asmorkalov:as/HAL_fast_GaussianBlur
Post-merge fixes for algorithm hint API
2024-07-15 20:30:24 +03:00
Corentin Noël
da078c4b75 highgui: Make GThread mandatory with GTK
The GThread API is available since more than 11 years with GLib, it is now safe
to assume that it is always available.
2024-07-15 16:30:39 +02:00
Yoshiki Obinata
4842043c6a
Merge pull request #25822 from mqcmd196:gtk3-gl-support
Support OpenGL GTK3 New API #25822

Fixes #20001

GSoC2024 Project

### 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
- [ ] 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-07-15 17:06:30 +03:00
Alexander Smorkalov
c53c2f6844 Use CV_LOG_DEBUG for debug logging in chessboard detector. 2024-07-15 16:11:27 +03:00
j3knk
e90935e81c
Merge pull request #25824 from j3knk:calib3d/fix_projectpoints
calib3d: fix Rodrigues CV_32F and CV_64F type mismatch in projectPoints #25824

Fixes #25318

### 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
- [ ] 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-07-15 15:10:08 +03:00
Alexander Smorkalov
a6b8ea892b Post-merge fixes for algorithm hint API. 2024-07-15 14:44:03 +03:00
Alexander Smorkalov
04f9e3cd4f Restored removed test_round_pair_f64 test afetr PR 24941. 2024-07-15 12:59:12 +03:00
Kumataro
e906f0f3b3 core: hal: disable _tzcnt_u32 for ARM64EC 2024-07-13 11:16:45 +09:00
Alexander Smorkalov
15783d6598
Merge pull request #25792 from asmorkalov:as/HAL_fast_GaussianBlur
Added flag to GaussianBlur for faster but not bit-exact implementation #25792

Rationale:
Current implementation of GaussianBlur is almost always bit-exact. It helps to get predictable results according platforms, but prohibits most of approximations and optimization tricks.

The patch converts `borderType` parameter to more generic `flags` and introduces `GAUSS_ALLOW_APPROXIMATIONS` flag to allow not bit-exact implementation. With the flag IPP and generic HAL implementation are called first. The flag naming and location is a subject for discussion.

Replaces https://github.com/opencv/opencv/pull/22073
Possibly related issue: https://github.com/opencv/opencv/issues/24135

### 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
2024-07-12 15:03:33 +03:00
Vincent Rabaud
3ff97c5580
Merge pull request #25899 from vrabaud:move_no_except
Mark cv::Mat(Mat&&) as noexcept #25899

This fixes https://github.com/opencv/opencv/issues/25065

### 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
- [ ] 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-07-12 14:41:17 +03:00
lamiayous
78195bc3df
Merge pull request #25817 from lamiayous:ly/extend_onnxrt_gapi_backend_handle_i32_i64_type
Handling I32/I64 data types in G-API ONNX back-end #25817

### 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
2024-07-12 11:38:43 +03:00
Alexander Smorkalov
c6ace77e21
Merge pull request #25893 from fengyuentau:core/fix_v_erf
core: fix compilation problem with v_erf
2024-07-11 12:57:18 +03:00
Suleyman TURKMEN
63b9cbc2d0 Update imgcodecs.hpp 2024-07-10 15:24:37 +03:00
Alexander Smorkalov
7dcc305301
Merge pull request #25894 from mshabunin:fix-test-templ-match
imgproc: reduce template sizes in templMatch test
2024-07-10 12:40:48 +03:00
Aliaksei Urbanski
35ca2f78d6
Merge pull request #25880 from Jamim:fix/cuda-no-fp16
Fix CUDA for old GPUs without FP16 support #25880

Fixes #21461

~This is a build-time solution that reflects https://github.com/opencv/opencv/blob/4.10.0/modules/dnn/src/cuda4dnn/init.hpp#L68-L82.~
~We shouldn't add an invalid target while building with `CUDA_ARCH_BIN` < 53.~
_(please see [this discussion](https://github.com/opencv/opencv/pull/25880#discussion_r1668074505))_

This is a run-time solution that basically reverts [these lines](d0fe6ad109 (diff-757c5ab6ddf2f99cdd09f851e3cf17abff203aff4107d908c7ad3d0466f39604L245-R245)).

I've debugged these changes, [coupled with other fixes](https://github.com/gentoo/gentoo/pull/37479), on [Gentoo Linux](https://www.gentoo.org/) and [related tests passed](https://github.com/user-attachments/files/16135391/opencv-4.10.0.20240708-224733.log.gz) on my laptop with `GeForce GTX 960M`.

Alternative solution:
  - #21462

_Best regards!_

### Pull Request Readiness Checklist

- [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
- [ ] `n/a` There is accuracy test, performance test and test data in opencv_extra repository, if applicable
- [ ] `n/a` The feature is well documented and sample code can be built with the project CMake
2024-07-10 12:39:30 +03:00
Maksim Shabunin
06b9db6a71 imgproc: reduce template sizes in templMatch test 2024-07-10 11:06:25 +03:00
fengyuentau
11fde3bb89 fix 2024-07-10 14:48:45 +08:00
Mironov Arseny
b964943517
Merge pull request #25607 from Fest1veNapkin:imgproc_approx_bounding_poly
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
2024-07-09 17:11:23 +03:00
Sourav Kumar
e962395565
Update imgcodecs.hpp 2024-07-09 06:53:16 +05:30
Yuantao Feng
e3858cc5a3
Merge pull request #25147 from fengyuentau:dnn/elementwise_layers/speedup
* added v_erf and implemented gelu acceleration via vectorization

* remove anonymous v_erf and use v_erf from intrin_math

* enable perf for ov and cuda backend
2024-07-08 14:24:36 +03:00
Dmitry Yurov
31b308f882
Merge pull request #25808 from DmitryYurov:bug-25806-checkerboard-marker-black-tile
Enable checkerboard detection with a central / corner marker on a black tile #25808

This pull request closes the issue #25806.

The issue doesn't require any documentation - it's quite intuitive that the detection result shouldn't depend on the color of the marker's tile.

### 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-07-08 12:36:56 +03:00
Kumataro
0b5b40179c calib3d: doc: enable line breaks in formulas 2024-07-07 07:15:28 +09:00
Yuantao Feng
d30b9450c1
Merge pull request #25872 from fengyuentau:core/v_erf
core: add v_erf #25872

This patch adds v_erf, which is needed by https://github.com/opencv/opencv/pull/25147.

### 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-07-05 15:46:01 +03:00
Suleyman TURKMEN
cdd8395f68 add getFrameCount() 2024-07-05 14:43:30 +03:00
Alexander Smorkalov
88b28ee2a0
Merge pull request #25844 from dietmar:dont_rely_on_nb_frames
Don't rely on nb_frames to be correct
2024-07-05 11:23:20 +03:00
Vincent Rabaud
dfbd18e9aa
Merge pull request #25864 from vrabaud:legacy
Make sure all the lines of a JPEG are read #25864

In case of corrupted JPEG, imread would still return a JPEG of the proper size (as indicated by the header) but with some uninitialized values. I do not have a short reproducer I can add as a test as this was found by our fuzzers.

### 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
2024-07-05 08:53:28 +03:00
Maksim Shabunin
94b7a2d320
Merge pull request #25842 from mshabunin:cpp-imgproc-test-4.x
imgproc: remove C-API usage from tests #25842

Final cleanup will be done in 5.x after regular merge.

Some tests have been reworked, some required only slight modifications.
2024-07-04 16:29:08 +03:00
Abduragim Shtanchaev
efbc9f0b66
Merge pull request #25861 from Abdurrahheem:ash/torch-attention-export-fix-4x
Merge pull request #25861 from Abdurrahheem:ash/torch-attention-export-fix-4x

Support for Unflatten operation requred by Attention layer - 4.x #25861

### Pull Request Readiness Checklist

All test data and models for PR are located [#1190](https://github.com/opencv/opencv_extra/pull/1190)

This PR fixes issue reised when importing batched  vanilla `Attention` layer from `PyTorch` via ONNX. Currently batched version of `Attention` layer in PyTorch [has unflatten operation inside](e3b3431c42/torch/nn/functional.py (L5500C17-L5500C31)). `unflatten` operation causes issue in `reshape` layer (see the Reshape_2 in the graph below) due to incorrect output of `slice` layer. This PR particularly fixes `slice` and `concat` layers to handle `unflatten` operation. 


<img width="673" alt="image" src="https://github.com/opencv/opencv/assets/44877829/5b612b31-657a-47f1-83a4-0ac35a950abd">


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-07-04 16:25:31 +03:00
Alexander Smorkalov
9f5139b575
Merge pull request #25865 from asmorkalov:as/gtk_2_opengl_fix
Hacked gtkglext search in cmake
2024-07-04 16:20:51 +03:00
alexlyulkov
20e72b0b30
Merge pull request #25856 from alexlyulkov:al/android-optional-kotlin
Fixed kotlin requirement in Android build.gradle #25856

Now OpenCV Android SDK doesn't always require kotlin plugin. Kotlin code is compiled only if the application uses kotlin plugin.

Fixes #24663

### 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
- [ ] 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-07-04 13:26:37 +03:00
Yuantao Feng
5510718381
Merge pull request #25810 from fengyuentau:python/fix_parsing_3d_mat_in_dnn
python: attempts to fix 3d mat parsing problem for dnn #25810

Fixes https://github.com/opencv/opencv/issues/25762 https://github.com/opencv/opencv/issues/23242
Relates https://github.com/opencv/opencv/issues/25763 https://github.com/opencv/opencv/issues/19091

Although `cv.Mat` has already been introduced to workaround this problem, people do not know it and it kind of leads to confusion with `numpy.array`. This patch adds a "switch" to turn off the auto multichannel feature when the API is from cv::dnn::Net (more specifically, `setInput`) and the parameter is of type `Mat`. This patch only leads to changes of three places in `pyopencv_generated_types_content.h`:

```.diff
static PyObject* pyopencv_cv_dnn_dnn_Net_setInput(PyObject* self, PyObject* py_args, PyObject* kw)
{
...
- pyopencv_to_safe(pyobj_blob, blob, ArgInfo("blob", 0)) &&
+ pyopencv_to_safe(pyobj_blob, blob, ArgInfo("blob", 8)) &&
...
}

// I guess we also need to change this as one-channel blob is expected for param
static PyObject* pyopencv_cv_dnn_dnn_Net_setParam(PyObject* self, PyObject* py_args, PyObject* kw)
{
...
- pyopencv_to_safe(pyobj_blob, blob, ArgInfo("blob", 0)) )
+ pyopencv_to_safe(pyobj_blob, blob, ArgInfo("blob", 8)) )
...
- pyopencv_to_safe(pyobj_blob, blob, ArgInfo("blob", 0)) )
+ pyopencv_to_safe(pyobj_blob, blob, ArgInfo("blob", 8)) )
...
}
```

Others are unchanged, e.g. `dnn_SegmentationModel` and stuff like that.

### 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-07-04 08:33:20 +03:00
Alexander Smorkalov
e28c6eb3b6 Fixed gtkglext search in cmake. 2024-07-03 19:22:06 +03:00
Alexander Smorkalov
25fb55601b Fixed narrowing conversion warning with MSVC compiler. 2024-07-03 12:10:31 +03:00
Wanli
bef6c110a4
Merge pull request #25781 from WanliZhong:v_log
Add support for v_log (Natural Logarithm) #25781

This PR aims to implement `v_log(v_float16 x)`, `v_log(v_float32 x)` and `v_log(v_float64 x)`. 
Merged after https://github.com/opencv/opencv/pull/24941

TODO:
- [x] double and half float precision
- [x] tests for them
- [x] doc to explain the implementation

### 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
2024-07-03 10:59:44 +03:00
zihaomu
934e6899f8
Merge pull request #25809 from zihaomu:imread_rgb_flag
imgcodecs: Add rgb flag for imread and imdecode #25809

Try to `imread` images by RGB to save R-B swapping costs.

## How to use it?
```
img_rgb = cv2.imread("PATH", IMREAD_COLOR_RGB) # OpenCV decode the image by RGB format.
```

## TODO
- [x] Fix the broken code
- [x] Add imread rgb test
- [x] Speed test of rgb mode.

## Performance test

| file name | IMREAD_COLOR  | IMREAD_COLOR_RGB |
| --------- | ------ | --------- |
| jpg01     | 284 ms | 277 ms    |
| jpg02     | 376 ms | 366 ms    |
| png01     | 62 ms  | 60 ms     |
| Png02     | 97 ms  | 94 ms     |

Test with [image_test.zip](https://github.com/user-attachments/files/15982949/image_test.zip)
```.cpp
string img_path = "/Users/mzh/work/data/image_test/png02.png";
int loop = 20;

TickMeter t;

double t0 = 10000;
for (int i = 0; i < loop; i++)
{
    t.reset();
    t.start();
    img_bgr = imread(img_path, IMREAD_COLOR);
    t.stop();

    if (t.getTimeMilli() < t0) t0 = t.getTimeMilli();
}

std::cout<<"bgr time = "<<t0<<std::endl;

t0 = 10000;
for (int i = 0; i < loop; i++)
{
    t.reset();
    t.start();
    img_rgb = imread(img_path, IMREAD_COLOR_RGB);
    t.stop();
    if (t.getTimeMilli() < t0) t0 = t.getTimeMilli();
}
std::cout<<"rgb time = "<<t0<<std::endl;
``` 
### 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
2024-07-03 10:58:25 +03:00
Yuantao Feng
a7fd9446cf
Merge pull request #25630 from fengyuentau:nary-multi-thread
dnn: parallelize nary elementwise forward implementation & enable related conformance tests #25630

This PR introduces the following changes:

- [x] Parallelize binary forward impl
- [x] Parallelize ternary forward impl (Where)
- [x] Parallelize nary (Operator that can take >=1 operands)
- [x] Enable conformance tests if workable

## Performance

### i7-12700K, RAM 64GB, Ubuntu 22.04

```
Geometric mean (ms)

                Name of Test                     opencv        opencv        opencv
                                                  perf          perf          perf
                                              core.x64.0606 core.x64.0606 core.x64.0606
                                                                               vs
                                                                             opencv
                                                                              perf
                                                                          core.x64.0606
                                                                           (x-factor)
NCHW_C_sum::Layer_NaryEltwise::OCV/CPU           16.116        11.161         1.44
NCHW_NCHW_add::Layer_NaryEltwise::OCV/CPU        17.469        11.446         1.53
NCHW_NCHW_div::Layer_NaryEltwise::OCV/CPU        17.531        11.469         1.53
NCHW_NCHW_equal::Layer_NaryEltwise::OCV/CPU      28.653        13.682         2.09
NCHW_NCHW_greater::Layer_NaryEltwise::OCV/CPU    21.899        13.422         1.63
NCHW_NCHW_less::Layer_NaryEltwise::OCV/CPU       21.738        13.185         1.65
NCHW_NCHW_max::Layer_NaryEltwise::OCV/CPU        16.172        11.473         1.41
NCHW_NCHW_mean::Layer_NaryEltwise::OCV/CPU       16.309        11.565         1.41
NCHW_NCHW_min::Layer_NaryEltwise::OCV/CPU        16.166        11.454         1.41
NCHW_NCHW_mul::Layer_NaryEltwise::OCV/CPU        16.157        11.443         1.41
NCHW_NCHW_pow::Layer_NaryEltwise::OCV/CPU        163.459       15.234         10.73
NCHW_NCHW_ref_div::Layer_NaryEltwise::OCV/CPU    10.880        10.868         1.00
NCHW_NCHW_ref_max::Layer_NaryEltwise::OCV/CPU    10.947        11.058         0.99
NCHW_NCHW_ref_min::Layer_NaryEltwise::OCV/CPU    10.948        10.910         1.00
NCHW_NCHW_ref_mul::Layer_NaryEltwise::OCV/CPU    10.874        10.871         1.00
NCHW_NCHW_ref_sum::Layer_NaryEltwise::OCV/CPU    10.971        10.920         1.00
NCHW_NCHW_sub::Layer_NaryEltwise::OCV/CPU        17.546        11.462         1.53
NCHW_NCHW_sum::Layer_NaryEltwise::OCV/CPU        16.175        11.475         1.41
NHWC_C::Layer_NaryEltwise::OCV/CPU               11.339        11.333         1.00
NHWC_H::Layer_NaryEltwise::OCV/CPU               16.154        11.102         1.46
```

### Apple M1, RAM 16GB, macOS 14.4.1

```
Geometric mean (ms)

                Name of Test                     opencv          opencv             opencv      
                                                  perf            perf               perf       
                                              core.m1.0606 core.m1.0606.patch core.m1.0606.patch
                                                                                      vs        
                                                                                    opencv      
                                                                                     perf       
                                                                                 core.m1.0606   
                                                                                  (x-factor)    
NCHW_C_sum::Layer_NaryEltwise::OCV/CPU           28.418          3.768               7.54       
NCHW_NCHW_add::Layer_NaryEltwise::OCV/CPU        6.942           5.679               1.22       
NCHW_NCHW_div::Layer_NaryEltwise::OCV/CPU        5.822           5.653               1.03       
NCHW_NCHW_equal::Layer_NaryEltwise::OCV/CPU      5.751           5.628               1.02       
NCHW_NCHW_greater::Layer_NaryEltwise::OCV/CPU    5.797           5.599               1.04       
NCHW_NCHW_less::Layer_NaryEltwise::OCV/CPU       7.272           5.578               1.30       
NCHW_NCHW_max::Layer_NaryEltwise::OCV/CPU        5.777           5.562               1.04       
NCHW_NCHW_mean::Layer_NaryEltwise::OCV/CPU       5.819           5.559               1.05       
NCHW_NCHW_min::Layer_NaryEltwise::OCV/CPU        5.830           5.574               1.05       
NCHW_NCHW_mul::Layer_NaryEltwise::OCV/CPU        5.759           5.567               1.03       
NCHW_NCHW_pow::Layer_NaryEltwise::OCV/CPU       342.260          74.655              4.58       
NCHW_NCHW_ref_div::Layer_NaryEltwise::OCV/CPU    8.338           8.280               1.01       
NCHW_NCHW_ref_max::Layer_NaryEltwise::OCV/CPU    8.359           8.309               1.01       
NCHW_NCHW_ref_min::Layer_NaryEltwise::OCV/CPU    8.412           8.295               1.01       
NCHW_NCHW_ref_mul::Layer_NaryEltwise::OCV/CPU    8.380           8.297               1.01       
NCHW_NCHW_ref_sum::Layer_NaryEltwise::OCV/CPU    8.356           8.323               1.00       
NCHW_NCHW_sub::Layer_NaryEltwise::OCV/CPU        6.818           5.561               1.23       
NCHW_NCHW_sum::Layer_NaryEltwise::OCV/CPU        5.805           5.570               1.04       
NHWC_C::Layer_NaryEltwise::OCV/CPU               3.834           4.817               0.80       
NHWC_H::Layer_NaryEltwise::OCV/CPU               28.402          3.771               7.53
```

### 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
2024-07-03 10:09:05 +03:00
Abduragim Shtanchaev
a8d1373919
Merge pull request #25794 from Abdurrahheem:ash/yolov10-support
Add sample support of YOLOv9 and YOLOv10 in OpenCV #25794

This PR adds sample support of  [`YOLOv9`](https://github.com/WongKinYiu/yolov9) and [`YOLOv10`](https://github.com/THU-MIG/yolov10/tree/main)) in OpenCV. Models for this test are located in this [PR](https://github.com/opencv/opencv_extra/pull/1186). 

**Running YOLOv10 using OpenCV.** 
1. In oder to run `YOLOv10` one needs to cut off postporcessing with dynamic shapes from torch and then convert it to ONNX. If someone is looking for ready solution, there is [this forked branch](https://github.com/Abdurrahheem/yolov10/tree/ash/opencv-export) from official YOLOv10.  Particularty follow this proceduce. 

```bash
git clone git@github.com:Abdurrahheem/yolov10.git
conda create -n yolov10 python=3.9
conda activate yolov10
pip install -r requirements.txt
python export_opencv.py --model=<model-name> --imgsz=<input-img-size>
```
By default `model="yolov10s"` and `imgsz=(480,640)`. This will generate file `yolov10s.onnx`, which can be use for inference in OpenCV

2. For inference part on OpenCV.  one can use `yolo_detector.cpp` [sample](https://github.com/opencv/opencv/blob/4.x/samples/dnn/yolo_detector.cpp). If you have followed above exporting procedure, then you can use following command to run the model. 

``` bash
build opencv from source 
cd build 
./bin/example_dnn_yolo_detector --model=<path-to-yolov10s.onnx-file> --yolo=yolov10 --width=640 --height=480 --input=<path-to-image> --scale=0.003921568627 --padvalue=114
```
If you do not specify `--input` argument, OpenCV will grab first camera that is avaliable on your platform. 
For more deatils on how to run the `yolo_detector.cpp` file see this [guide](https://docs.opencv.org/4.x/da/d9d/tutorial_dnn_yolo.html#autotoc_md443) 


**Running YOLOv9 using OpenCV**

1. Export model following [official guide](https://github.com/WongKinYiu/yolov9)of the YOLOv9 repository. Particularly you can do following for converting.

```bash
git clone https://github.com/WongKinYiu/yolov9.git
cd yolov9
conda create -n yolov9 python=3.9
conda activate yolov9
pip install -r requirements.txt
wget https://github.com/WongKinYiu/yolov9/releases/download/v0.1/yolov9-t-converted.pt
python export.py --weights=./yolov9-t-converted.pt --include=onnx --img-size=(480,640) 
```

This will generate <yolov9-t-converted.onnx> file.

2.  Inference on OpenCV.

```bash
build opencv from source 
cd build 
./bin/example_dnn_yolo_detector --model=<path-to-yolov9-t-converted.onnx> --yolo=yolov9 --width=640 --height=480 --scale=0.003921568627 --padvalue=114 --path=<path-to-image>
```

### 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-07-02 18:26:34 +03:00
Alexander Smorkalov
939cb58cd6
Merge pull request #25845 from kaingwade:orbbecsdk_mac_off
Set using Orbbec SDK on MacOS OFF by default.
2024-07-02 14:02:42 +03:00
Wanli
6e1864e3fc
Merge pull request #24941 from WanliZhong:v_exp
Add support for v_exp (exponential) #24941

This PR aims to implement `v_exp(v_float16 x)`, `v_exp(v_float32 x)` and `v_exp(v_float64 x)`.

### 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
2024-07-02 12:32:49 +03:00
kaingwade
883faf8871 Set using Orbbec SDK on MacOS OFF by default. 2024-07-02 17:23:20 +08:00
Alexander Smorkalov
75339a5528
Merge pull request #25800 from xndcn:patch-2
photo: doc: Fix window range for fastNlMeansDenoisingMulti
2024-07-02 10:26:56 +03:00
Dietmar Schabus
fd5efabdd9 Don't rely on nb_frames to be correct 2024-07-02 06:45:05 +02:00
Alexander Smorkalov
3d74d646d8 Fixed CuDNN runtime version check for CuDNN 9+. 2024-07-01 17:33:24 +03:00
Alexander Smorkalov
34ed88d7fb
Merge pull request #25836 from dan-masek:fix_win32_topmost_toggle
Fix #25833: The correct way to disable top-most state is with HWND_NOTOPMOST, not HWND_TOP.
2024-07-01 10:30:23 +03:00
Mikhail Khachayants
bbf65a166e Fix file descriptor leak in HDR decoder 2024-06-30 18:43:04 +03:00
Dan Mašek
1e5407a9ba Fix #25833: The correct way to disable top-most state is with HWND_NOTOPMOST, not HWND_TOP. 2024-06-29 21:39:49 +02:00
Alexander Smorkalov
be00247ca0
Merge pull request #25820 from asmorkalov:as/HAL_non_strict_equalizeHist
Relax equalizeHist test for some HAL implementations
2024-06-28 16:51:15 +03:00
Alexander Smorkalov
310169490a Exclude cap_ios.h from installation where it's not needed. 2024-06-28 14:11:25 +03:00
Alexander Smorkalov
284a79446a
Merge pull request #25816 from FantasqueX:remove-unused-brow-1
Remove unused brow variable
2024-06-28 08:56:37 +03:00
Alexander Smorkalov
ee2b0f9d63 Relax equalizeHist test for some HAL implementations. 2024-06-27 19:14:30 +03:00
Alexander Smorkalov
445022682e
Merge pull request #25789 from asmorkalov:as/HAL_meanStdDev_tails
Fill mean and stdDev tails with zeros for HAL branch in meanStdDev #25789

as it's done for other branches.

### 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
2024-06-27 19:11:05 +03:00
Alexander Smorkalov
204d62ae12
Merge pull request #25815 from FantasqueX:remove-unused-variable-1
Remove unused variables in rgb2hsv_b simd
2024-06-27 12:58:51 +03:00
kozinove
efa4d9176a
Merge pull request #25661 from itlab-vision:framebuffer
Highgui backend on top of Framebuffer #25661

### 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.
- [ x] The feature is well documented and sample code can be built with the project CMake

Environment variables used:
OPENCV_UI_BACKEND - you need to add the value “FB”
OPENCV_UI_PRIORITY_FB - requires priority indication
OPENCV_HIGHGUI_FB_MODE={FB|XVFB|EMU} - mode of using Framebuffer (default "FB")
- FB - Linux Framebuffer
- XVFB - virtual Framebuffer
- EMU - emulation (images are not displayed)
OPENCV_HIGHGUI_FB_DEVICE (FRAMEBUFFER) - path to the Framebuffer file (default "/dev/fb0").

Examples of using:

sudo OPENCV_UI_BACKEND=FB ./opencv_test_highgui
sudo OPENCV_UI_PRIORITY_FB=1111 ./opencv_test_highgui
OPENCV_UI_BACKEND=FB OPENCV_HIGHGUI_FB_MODE=EMU ./opencv_test_highgui
sudo OPENCV_UI_BACKEND=FB OPENCV_HIGHGUI_FB_MODE=FB ./opencv_test_highgui

export DISPLAY=:99
Xvfb $DISPLAY -screen 0 1024x768x24 -fbdir /tmp/ -f /tmp/user.xvfb.auth&
sudo -u sipeed XAUTHORITY=/tmp/user.xvfb.auth x11vnc -display $DISPLAY -listen localhost&
DISPLAY=:0 gvncviewer localhost&

FRAMEBUFFER=/tmp/Xvfb_screen0 OPENCV_UI_BACKEND=FB OPENCV_HIGHGUI_FB_MODE=XVFB ./opencv_test_highgui
2024-06-26 15:31:19 +03:00
Letu Ren
2179186a51 Remove unused variables in rgb2hsv_b simd 2024-06-26 19:07:53 +08:00
Yuantao Feng
3f13ce797b
Merge pull request #25779 from fengyuentau:dnn/fix_onnx_depthtospace
dnn: add DepthToSpace and SpaceToDepth #25779

We are working on updating WeChat QRCode module. One of the new models is a fully convolutional model and hence it should be able to run with different input shapes. However,  it has an operator `DepthToSpace`, which is parsed as a subgraph of `Reshape -> Permute -> Reshape` with a fixed shape getting during parsing. The subgraph itself is not a problem, but the true problem is the subgraph with a fixed input and output shape regardless input changes. This does not allow the model to run with different input shapes.

Solution is to add a dedicated layer for DepthtoSpace and SpaceToDepth.

Backend support:

- [x] CPU
- [x] CUDA
- [x] OpenCL
- [x] OpenVINO
- [x] CANN
- [x] TIMVX
-  ~Vulkan~ (missing fundamental tools, like permutation and reshape)

### 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-06-21 19:28:22 +03:00
xndcn
5cfa44d2a2
photo: doc: Fix window range for fastNlMeansDenoisingMulti 2024-06-21 21:04:22 +08:00
Ujjayant Kadian
5dc1b39e4c
Merge pull request #25791 from ujjayant-kadian:uk/extend-gapi-onnx-params-arbitrary-session-options
Extending G-API onnx::Params to pass arbitrary session options #25791

### 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
2024-06-21 14:34:26 +03:00
Simon Kämpe
7ef42d7706
Merge pull request #25751 from simonkampe:fix-eigen-rowmajor
Add missing cv2eigen overload #25751

Fixes #16606

Add overloads to cv2eigen to handle eigen matrices of type
Eigen::Matrix<Tp_, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor>

### 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
- [ ] 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-06-20 20:05:06 +03:00
Alexander Smorkalov
57984e689b
Merge pull request #25788 from asmorkalov:as/bilateralFilter_test
Extended bilateralFilter test to cover more branches
2024-06-20 10:27:15 +03:00
Alexander Smorkalov
a102b24285 Added LUT for FP16 and accuracy test. 2024-06-19 16:16:11 +03:00
Alexander Smorkalov
e7108f48ab Extended bilateralFilter test to cover more branches. 2024-06-19 15:35:03 +03:00
Alexander Smorkalov
553c111c5a Fixed input buffer read overflow in vectorized G-API convertTo implementation. 2024-06-18 15:46:42 +03:00
Yuantao Feng
e3884a9ea8
Merge pull request #25771 from fengyuentau:vittrack_black_input
video: fix vittrack in the case where crop size grows until out-of-memory when the input is black #25771

Fixes https://github.com/opencv/opencv/issues/25760

### 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-06-18 12:48:28 +03:00
Letu Ren
b9d2ecb72f Remove unused brow variable 2024-06-17 18:50:53 +08:00
Dmitry Kurtaev
24907f35a3
Merge pull request #25757 from dkurt:d.kurtaev/opencv_js_tests_old_emsdk
Use onRuntimeInitialized with OpenCV.js Node tests #25757

### Pull Request Readiness Checklist

tests: https://github.com/opencv/ci-gha-workflow/pull/174

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-06-17 12:46:10 +03:00
Alexander Smorkalov
4bf95ac2df
Merge pull request #25602 from asmorkalov:as/gstreamer_alpha_channel
Handle BGRA streams in GStreamer backend
2024-06-16 18:18:03 +03:00
Alexander Smorkalov
0a12c7d9de
Merge pull request #25725 from asmorkalov:as/intersectConvexConvex_fix
Fixed result buffer overflow in intersectConvexConvex_ for non-convex input
2024-06-16 17:07:01 +03:00
Rostislav Vasilikhin
7ff531b8ab
Merge pull request #25759 from savuor:rv/equalizeHist_tests
Accuracy tests for equalizeHist() added #25759

### 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-06-15 12:44:36 +03:00
Alexander Smorkalov
88c6c7d9f7 Handle BGRA sterams in GStreamer backend 2024-06-11 12:21:05 +03:00
Dmitry Kurtaev
a03b813167
Merge pull request #25732 from dkurt:opencv_js_tests_update
Fix OpenCV.js tests #25732

### Pull Request Readiness Checklist

* Firefox tests passed

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-06-11 12:01:51 +03:00
Alexander Smorkalov
8e9307074c
Merge pull request #25738 from rlexmann:imgproc_fix_divSpectrums
Fix arithmetics in CV_32F branch of divSpectrums()
2024-06-11 11:16:23 +03:00
Alexander Smorkalov
2629688d11
Merge pull request #25706 from cudawarped:fix_cuda_first_python_dep
`cuda`: Add missing python CUDA dependency when CUDA is a first class language
2024-06-11 10:49:14 +03:00
Alexander Smorkalov
6623c62f56 Fixed result buffer overflow in intersectConvexConvex_ for non-convex input. 2024-06-10 19:38:35 +03:00
Robert Lexmann
e1dba2c6d2 Perform arithmetics in CV_32F branch of divSpectrums() with doubles to prevent infs/NaNs (+ corresponding test). 2024-06-10 15:47:29 +02:00
Pierre Chatelier
bdf986ee51
Merge pull request #25726 from chacha21:remap_relative_doc
Relates to #24603

### 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
- [ ] 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-06-10 11:09:25 +03:00
Maxim Smolskiy
cc6f85e1ba
Merge pull request #25427 from MaximSmolskiy:make-finding-corner-neighbor-symmetrical-in-ChessBoardDetector-findQuadNeighbors
Make finding corner neighbor symmetrical in ChessBoardDetector::findQuadNeighbors #25427

### Pull Request Readiness Checklist

The basic idea of finding pair of corners neighbors is to find best candidate for first corner and check if first corner quite good candidate for its best candidate. And we test first corner for its best candidate less than best candidate for first corner.

Idea of changes is to make finding corner neighbor symmetrical - find best candidate for first corner, find best candidate for second corner and match them as pair iff they are both best candidates for each other.

Additional advantage - it simplifies code and removes some code duplication.

I tested this PR with benchmark
```
python3 objdetect_benchmark.py --configuration=generate_run --board_x=7 --path=res_chessboard --synthetic_object=chessboard
```

There are minor changes in results
```
cell_img_size = 100 (default)

before

                                 category  detected chessboard  total detected chessboard  total chessboard  average detected error chessboard
                          _none_none_blur             1.000000                        360               360                           0.630345
                    _none_none_gaussNoise             0.833333                        300               360                           0.623405
                          _none_none_none             1.000000                        360               360                           0.631517
                    _none_none_strongBlur             1.000000                        360               360                           0.630316
                   _none_undistorted_blur             1.000000                        360               360                           0.671232
             _none_undistorted_gaussNoise             1.000000                        360               360                           0.672619
                   _none_undistorted_none             1.000000                        360               360                           0.673669
             _none_undistorted_strongBlur             1.000000                        360               360                           0.671257
                   _perspective_none_blur             1.000000                       1080              1080                           0.588694
             _perspective_none_gaussNoise             0.805556                        870              1080                           0.599312
                   _perspective_none_none             1.000000                       1080              1080                           0.591063
             _perspective_none_strongBlur             1.000000                       1080              1080                           0.588604
            _perspective_undistorted_blur             1.000000                       1080              1080                           0.622081
      _perspective_undistorted_gaussNoise             1.000000                       1080              1080                           0.625704
            _perspective_undistorted_none             1.000000                       1080              1080                           0.624191
      _perspective_undistorted_strongBlur             1.000000                       1080              1080                           0.621618
             _strongPerspective_none_blur             1.000000                        360               360                           0.482934
       _strongPerspective_none_gaussNoise             0.166667                         60               360                           0.391551
             _strongPerspective_none_none             1.000000                        360               360                           0.480290
       _strongPerspective_none_strongBlur             0.333333                        120               360                           0.469080
      _strongPerspective_undistorted_blur             1.000000                        360               360                           0.503458
_strongPerspective_undistorted_gaussNoise             0.250000                         90               360                           0.448713
      _strongPerspective_undistorted_none             1.000000                        360               360                           0.504412
_strongPerspective_undistorted_strongBlur             0.166667                         60               360                           0.473791
                                      all             0.904167                      13020             14400                           0.600512
Total detected time:  139.65614900000008 sec

after

                                 category  detected chessboard  total detected chessboard  total chessboard  average detected error chessboard
                          _none_none_blur             1.000000                        360               360                           0.630345
                    _none_none_gaussNoise             0.750000                        270               360                           0.636279
                          _none_none_none             1.000000                        360               360                           0.631517
                    _none_none_strongBlur             1.000000                        360               360                           0.630316
                   _none_undistorted_blur             1.000000                        360               360                           0.671232
             _none_undistorted_gaussNoise             1.000000                        360               360                           0.672619
                   _none_undistorted_none             1.000000                        360               360                           0.673669
             _none_undistorted_strongBlur             1.000000                        360               360                           0.671257
                   _perspective_none_blur             1.000000                       1080              1080                           0.588694
             _perspective_none_gaussNoise             0.888889                        960              1080                           0.594106
                   _perspective_none_none             1.000000                       1080              1080                           0.591064
             _perspective_none_strongBlur             1.000000                       1080              1080                           0.588604
            _perspective_undistorted_blur             1.000000                       1080              1080                           0.622081
      _perspective_undistorted_gaussNoise             1.000000                       1080              1080                           0.625703
            _perspective_undistorted_none             1.000000                       1080              1080                           0.624191
      _perspective_undistorted_strongBlur             1.000000                       1080              1080                           0.621618
             _strongPerspective_none_blur             1.000000                        360               360                           0.482934
       _strongPerspective_none_gaussNoise             0.166667                         60               360                           0.391551
             _strongPerspective_none_none             1.000000                        360               360                           0.480290
       _strongPerspective_none_strongBlur             0.333333                        120               360                           0.469080
      _strongPerspective_undistorted_blur             1.000000                        360               360                           0.503458
_strongPerspective_undistorted_gaussNoise             0.333333                        120               360                           0.422259
      _strongPerspective_undistorted_none             1.000000                        360               360                           0.504412
_strongPerspective_undistorted_strongBlur             0.166667                         60               360                           0.473791
                                      all             0.910417                      13110             14400                           0.599746
Total detected time:  142.40333700000005 sec

----------------------------------------------------------------------------------------------------------------------------------------------

cell_img_size = 10

before

                                 category  detected chessboard  total detected chessboard  total chessboard  average detected error chessboard
                          _none_none_blur             0.991667                        357               360                           4.905091
                    _none_none_gaussNoise             0.750000                        270               360                           5.215633
                          _none_none_none             1.000000                        360               360                           4.943304
                    _none_none_strongBlur             0.916667                        330               360                           3.806217
                   _none_undistorted_blur             0.994444                        358               360                           5.220915
             _none_undistorted_gaussNoise             0.997222                        359               360                           4.542443
                   _none_undistorted_none             0.997222                        359               360                           4.340208
             _none_undistorted_strongBlur             0.161111                         58               360                           5.024331
                   _perspective_none_blur             0.629630                        680              1080                           4.825401
             _perspective_none_gaussNoise             0.966667                       1044              1080                           3.895425
                   _perspective_none_none             0.971296                       1049              1080                           3.920378
             _perspective_none_strongBlur             0.000000                          0              1080                                NaN
            _perspective_undistorted_blur             0.583333                        630              1080                           4.594335
      _perspective_undistorted_gaussNoise             0.999074                       1079              1080                           3.553195
            _perspective_undistorted_none             0.750000                        810              1080                           3.604110
      _perspective_undistorted_strongBlur             0.000000                          0              1080                                NaN
             _strongPerspective_none_blur             0.000000                          0               360                                NaN
       _strongPerspective_none_gaussNoise             0.000000                          0               360                                NaN
             _strongPerspective_none_none             0.083333                         30               360                           2.382460
       _strongPerspective_none_strongBlur             0.000000                          0               360                                NaN
      _strongPerspective_undistorted_blur             0.000000                          0               360                                NaN
_strongPerspective_undistorted_gaussNoise             0.000000                          0               360                                NaN
      _strongPerspective_undistorted_none             0.000000                          0               360                                NaN
_strongPerspective_undistorted_strongBlur             0.000000                          0               360                                NaN
                                      all             0.539792                       7773             14400                           4.209964
Total detected time:  2.6968930000000015 sec

after

                                 category  detected chessboard  total detected chessboard  total chessboard  average detected error chessboard
                          _none_none_blur             0.991667                        357               360                           4.905091
                    _none_none_gaussNoise             0.750000                        270               360                           5.215633
                          _none_none_none             1.000000                        360               360                           4.943304
                    _none_none_strongBlur             0.916667                        330               360                           3.806217
                   _none_undistorted_blur             0.994444                        358               360                           5.220915
             _none_undistorted_gaussNoise             0.997222                        359               360                           4.542443
                   _none_undistorted_none             0.997222                        359               360                           4.340208
             _none_undistorted_strongBlur             0.161111                         58               360                           5.024331
                   _perspective_none_blur             0.629630                        680              1080                           4.825401
             _perspective_none_gaussNoise             0.966667                       1044              1080                           3.895425
                   _perspective_none_none             0.999074                       1079              1080                           3.865684
             _perspective_none_strongBlur             0.000000                          0              1080                                NaN
            _perspective_undistorted_blur             0.583333                        630              1080                           4.594335
      _perspective_undistorted_gaussNoise             0.999074                       1079              1080                           3.553195
            _perspective_undistorted_none             0.750000                        810              1080                           3.604110
      _perspective_undistorted_strongBlur             0.000000                          0              1080                                NaN
             _strongPerspective_none_blur             0.000000                          0               360                                NaN
       _strongPerspective_none_gaussNoise             0.000000                          0               360                                NaN
             _strongPerspective_none_none             0.000000                          0               360                                NaN
       _strongPerspective_none_strongBlur             0.000000                          0               360                                NaN
      _strongPerspective_undistorted_blur             0.000000                          0               360                                NaN
_strongPerspective_undistorted_gaussNoise             0.000000                          0               360                                NaN
      _strongPerspective_undistorted_none             0.000000                          0               360                                NaN
_strongPerspective_undistorted_strongBlur             0.000000                          0               360                                NaN
                                      all             0.539792                       7773             14400                           4.208308
Total detected time:  2.7706419999999983 sec
```

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
2024-06-10 09:42:56 +03:00
Alexander Smorkalov
3282954c2e
Merge pull request #25723 from mshabunin:fix-ts-rng
test: use cv::theRNG instead of own generator
2024-06-07 20:41:11 +03:00
Dmitry Kurtaev
3700f9e1e9
Merge pull request #25709 from dkurt:wrap_addLayer
* Wrap dnn addLayer
* Add typing stubs
2024-06-07 20:39:44 +03:00
Maksim Shabunin
ef3303716e test: use cv::theRNG instead of own generator 2024-06-07 13:36:11 +03:00
Alexander Smorkalov
bef5a87680
Merge pull request #25722 from AleksandrPanov:update_testSeveralBoardsWithCustomIds
updated testSeveralBoardsWithCustomIds to enable in 5.x
2024-06-06 20:01:33 +03:00
Alexander Panov
cbc08514fd updated testSeveralBoardsWithCustomIds to enable in 5.x 2024-06-06 14:22:58 +03:00
Alexander Smorkalov
cbf3b1187d
Merge pull request #25720 from VadimLevin:dev/vlevin/floodFill-optional-mask
fix: mark floodFill mask as optional in Python typing stubs
2024-06-06 13:36:00 +03:00
Alexander Smorkalov
0d1ed49d2a
Merge pull request #25703 from mshabunin:fix-imread-arg
imgproc: fixed imread with output image argument
2024-06-06 12:50:30 +03:00
Vadim Levin
5dd7b5f0e5 fix: mark floodFill mask as optional in Python typing stubs 2024-06-06 11:51:10 +03:00
Alexander Lyulkov
99f32f17b4 Added potential fix for Android H264 Encoding Bug 2024-06-05 19:17:49 +03:00
Maksim Shabunin
b77c74b6fc imgproc: fixed imread with output image argument, minor refactoring, fixes in HDR 2024-06-04 19:52:22 +03:00
cudawarped
9c05b27ba0 cuda: Add missing python CUDA dependency when CUDA is a first class language 2024-06-04 18:58:09 +03:00
Alexander Smorkalov
92b588f30b
Merge pull request #25702 from asmorkalov:as/gapi_disable_steaming_again
Disable more G-API streaming test due to unstability.
2024-06-04 13:01:21 +03:00
Alexander Smorkalov
2bb8b2b173 Disable more G-API streaming test due to unstability. 2024-06-04 11:07:22 +03:00
Patrick Keane
3f26664e8d ISSUE-25700 update cv::FaceRecognizerSF class documentation 2024-06-03 17:29:41 -04:00
Alexander Alekhin
337c183b9d Merge tag '4.10.0' 2024-06-02 18:24:06 +00:00
Alexander Smorkalov
71d3237a09 Release 4.10.0 2024-06-02 14:41:07 +03:00
Rostislav Vasilikhin
a7e53aa184
Merge pull request #25671 from savuor:rv/arithm_extend_tests
Tests added for mixed type arithmetic operations #25671

### Changes
* added accuracy tests for mixed type arithmetic operations
    _Note: div-by-zero values are removed from checking since the result is implementation-defined in common case_
* added perf tests for the same cases
* fixed a typo in `getMulExtTab()` function that lead to dead code

### 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-06-02 14:28:06 +03:00
Kumataro
1bd5ca1ebe
Merge pull request #25686 from Kumataro:fix25674
Suppress build warnings for GCC14 #25686

Close #25674

### 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
- [ ] 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-06-02 14:14:04 +03:00
Vincent Rabaud
1db6a8a1f3
Merge pull request #25665 from vrabaud:jacobian
Fix Homography computation. #25665

The bug was introduced in https://github.com/opencv/opencv/pull/25308

I am sorry I do not have a proper test.

### 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
- [ ] 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-05-31 20:51:58 +03:00
CNOCycle
98b8825031
Merge pull request #25613 from CNOCycle:tflite/ops
Support Global_Pool_2D ops in .tflite model #25613

### Pull Request Readiness Checklist

**Merge with extra**: https://github.com/opencv/opencv_extra/pull/1180

This PR adds support for `GlobalAveragePooling2D` and `GlobalMaxPool2D` on the TFlite backend. When the k`eep_dims` option is enabled, the output is a 2D tensor, necessitating the inclusion of an additional flatten layer. Additionally, the names of these layers have been updated to match the output tensor names generated by `generate.py` from the opencv_extra repository.

- [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
2024-05-31 19:31:21 +03:00
Maksim Shabunin
29f91a08d5
Merge pull request #25680 from mshabunin:fix-approx-2
Reverted contour approximation behavior #25680

Related issue #25663 - revert new function behavior despite it returning different result than the old one (reverts PR  #25672).
Also added Coverity issue fix.
2024-05-31 19:28:03 +03:00
Alexander Smorkalov
08107957d8
Merge pull request #25682 from fengyuentau:calib3d/lapack_fix_calib3d
calib3d: fix data type for ilp64 lapack
2024-05-31 19:24:26 +03:00
fengyuentau
ca035e6dae fix type for ilp64 api 2024-05-31 22:47:57 +08:00
Alexander Panov
472eba324a
Merge pull request #25673 from AleksandrPanov:fix_charuco_board_markers
fixed marker generation in charuco board #25673

When generating  Charuco board markers in `generateImage()`, a problem occurs as in https://github.com/opencv/opencv/issues/24806, https://github.com/opencv/opencv/pull/24873:

In low resolution:
![charucoImg_before_fix2](https://github.com/opencv/opencv/assets/22337800/aab7b443-2d2a-4287-b869-708ac5976ea5)
In medium resolution:
![charucoImg_before_fix](https://github.com/opencv/opencv/assets/22337800/8c21ae42-d9c8-4cb5-9fcc-7814dfc07b80)

This PR fixed this problems:
![charucoImg_after_fix2](https://github.com/opencv/opencv/assets/22337800/93256dbb-8544-46eb-be78-844234e42ca9)
![charucoImg_after_fix](https://github.com/opencv/opencv/assets/22337800/f4d6794e-bee9-4ce4-8f9b-67a40800cbe5)

The test checks the inner and outer borders of the Aruco markers. In the outer border of Aruco marker, all pixels should be white. In the inner border of Aruco marker, all pixels should be black.
![image](https://github.com/opencv/opencv/assets/22337800/010a9c64-e03c-4239-9ac9-2cda9170793b)


### 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-05-31 17:03:24 +03:00
Ujjayant Kadian
dcce2b8b24
Merge pull request #25662 from ujjayant-kadian:uk/port-gapi-onnxrt-backend-into-v2-api
Port G-API ONNXRT backend into V2 API #25662

### 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
2024-05-31 17:01:46 +03:00
Abduragim Shtanchaev
d7f04a9d33
Merge pull request #25660 from Abdurrahheem:ash/fix-slice-empty-input
Slice layer parser fix to support empty input case #25660

This PR fixes Slice Layer's parser to handle empty input cases (cases with initializer)
It fixed the issue rased in #24838

### 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-31 13:13:36 +03:00