Commit Graph

24541 Commits

Author SHA1 Message Date
Alexander Smorkalov
ecbfc1bfd8
Merge pull request #25395 from susumu-iino:fix-dnn-plugin-build-win32
Fix dnn plugin build win32
2024-04-12 11:05:34 +03:00
Alexander Alekhin
06c1c7b5cb Merge pull request #25396 from mshabunin:test-tag-contours 2024-04-11 15:34:49 +00:00
Maksim Shabunin
c081efe3c6 imgproc: add 512mb tag for FindContours.accuracy test 2024-04-11 14:37:32 +03:00
Yuantao Feng
197626a5bf
Merge pull request #25387 from fengyuentau:complete-float16_t-renaming
Rename remaining float16_t for future proof #25387

Resolves comment: https://github.com/opencv/opencv/pull/25217#discussion_r1547733187.

`std::float16_t` and `std::bfloat16_t` are introduced since c++23: https://en.cppreference.com/w/cpp/types/floating-point.

### 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-04-11 14:02:44 +03:00
Alexander Smorkalov
2c5b296ab2
Merge pull request #25343 from asmorkalov:as/HAL_bilaterialFilter
HAL interface for bilaterialFilter
2024-04-11 09:15:15 +03:00
Alexander Smorkalov
17c7f76da3 HALL interface for bilaterialFilter. 2024-04-11 09:02:45 +03:00
Kumataro
d22d0bd49c core: persistence: use hfloat instead of float16_t 2024-04-11 05:18:25 +09:00
Alexander Smorkalov
9813ea2b7a
Merge pull request #25306 from utibenkei:fix_build_of_dynamic_framework_for_visionos
fix build of dynamic framework for visionos
2024-04-10 16:50:38 +03:00
Kumataro
b14ea19466
Merge pull request #25351 from Kumataro:fix25073_format_g
core: persistence: output reals as human-friendly expression. #25351

Close #25073
Related https://github.com/opencv/opencv/pull/25087

This patch is need to merge same time with https://github.com/opencv/opencv_contrib/pull/3714

### 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-04-10 15:17:15 +03:00
Alexander Smorkalov
5bad694b7f Removed old C API usage in new findContours implementation. 2024-04-10 11:19:55 +03:00
Alexander Smorkalov
369760116e
Merge pull request #25375 from asmorkalov:as/win32_arm_warning
Supress build warnings on Win32 for ARM
2024-04-10 09:50:30 +03:00
Maksim Shabunin
148b2ec3e0 calib3d: increased AP3P test threshold for RISC-V platform 2024-04-09 23:53:50 +03:00
Maksim Shabunin
f37924796f
Merge pull request #25364 from mshabunin:fix-unaligned-filter
imgproc: fix unaligned memory access in filters and Gaussian blur #25364

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

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

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

Slightly related PR: https://github.com/opencv/ci-gha-workflow/pull/165
2024-04-09 17:44:36 +03:00
Alexander Smorkalov
e4677fbf64
Merge pull request #25361 from hanliutong:rvv-f32
Further optimize fastDepthwiseConv for RISC-V Vector.
2024-04-09 16:04:02 +03:00
Alexander Smorkalov
4221ae1d64 Supress build warnings on Win32 for ARM. 2024-04-09 12:57:23 +03:00
Alexander Smorkalov
b0d905864d
Merge pull request #25371 from alexlyulkov:al/adaptive-threshold-tests
Added tests for adaptiveThreshold and sepFilter2D
2024-04-09 11:51:00 +03:00
Maksim Shabunin
a25132986a
Merge pull request #25146 from mshabunin:cpp-contours
Reworked findContours to reduce C-API usage #25146

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

What is left to be done (can be done now or later):
* improve tests: 
  * some tests have limited verification (e.g. only verify contour sizes)
  * perhaps reference data can be collected and stored
  * maybe more test variants can be added (?)
* add enum value for chain code output and a method of returning starting points (e.g. first 8 elements of returned `vector<uchar>` can represent 2 int point coordinates)
* add documentation for new functions - **✔️ DONE**
* check and improve performance (my experiment showed 0.7x-1.1x some time ago)
* remove old functions completely (?)
* change contour return order (BFS) or allow to select it (?)
* return result tree as-is (?) (new data structures should be exposed, bindings should adapt)
2024-04-09 09:37:49 +03:00
Alexander Smorkalov
e5d530abae
Merge pull request #25342 from asmorkalov:as/HAL_transpose
HAL interface for transpose2d.
2024-04-09 09:03:13 +03:00
Alexander Smorkalov
e55cf444cc
Merge pull request #25372 from CNOCycle:tflite/ShapeChecker
Add a shape checker for tflite models
2024-04-08 18:58:41 +03:00
Kumataro
8ed52cb564
Merge pull request #25356 from Kumataro:fix25345
core: doc: add note for countNonZero, hasNonZero and findNonZero #25356

Close #25345 

### 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-04-08 18:47:58 +03:00
ecchen
e63690a2d9 Add a shape checker for tflite models 2024-04-08 13:28:05 +00:00
Alexander Lyulkov
30889f4a90 Added tests for adaptiveThreshold and sepFilter2D 2024-04-08 13:04:50 +03:00
Tsukasa Sugiura
5528e70f3c remove floating point literal 2024-04-08 14:52:53 +09:00
MaximSmolskiy
6b45cccc37 Take first suitable neighbor in ChessBoardDetector::findQuadNeighbors 2024-04-07 20:20:35 +03:00
Susumu IINO
a0b28f8b06 Add Definition "_USE_MATH_DEFINES" for dnn plugin on Win32 build 2024-04-07 21:08:09 +09:00
Liutong HAN
5be158a2b6 Further optimize fastDepthwiseConv for RVV. 2024-04-07 11:34:41 +08:00
Alexander Smorkalov
e1ed422bdb HALL interface for transpose2d. 2024-04-05 14:12:36 +03:00
Alexander Smorkalov
89b91fcb50 Added option to dump v4l2 test frame from virtual camera. 2024-04-04 15:50:27 +03:00
Alexander Smorkalov
2b1c8aa4db
Merge pull request #25287 from catree:feat_V4L2_PIX_FMT_SGRBG8_use_cvtColor
Use cvtColor() for Bayer image color demosaicing with V4L2_PIX_FMT_SGRBG8
2024-04-04 11:57:19 +03:00
Alexander Smorkalov
e665d2d636
Merge pull request #25325 from asmorkalov:as/tiff_flags
Export TIFF compression options as API and git rid of tiff.h.
2024-04-04 11:05:16 +03:00
Alexander Smorkalov
bf7208e1ed
Merge pull request #25322 from sepperliu:patch-1
Update highgui+HighGui.java
2024-04-04 10:23:24 +03:00
Alexander Smorkalov
bd819f97f1
Merge pull request #25327 from dkurt:uninit_jump_qrcode
Resolve valgrind issue at QRCode detector
2024-04-04 10:22:24 +03:00
Dmitry Kurtaev
df627e1281 Resolve valgrind issue at QRCode detector 2024-04-03 16:58:46 +03:00
Yuantao Feng
55d7e3f8cc
Merge pull request #1165 from fengyuentau:gold_yolo
[BugFix] dnn (ONNX): Foce dropping constant inputs in parseClip if they are shared #25319

Resolves https://github.com/opencv/opencv/issues/25278
Merge with https://github.com/opencv/opencv_extra/pull/1165

In Gold-YOLO ,`Div` has a constant input `B=6` which is then parsed into a `Const` layer in the ONNX importer, but `Clip` also has the shared constant input `max=6` which is already a `Const` layer and then connected to `Elementwise` layer. This should not happen because in the `forward()` of `Elementwise` layer, the legacy code goes through and apply activation to each input. More details on https://github.com/opencv/opencv/issues/25278#issuecomment-2032199630.

### 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-04-03 15:56:59 +03:00
catree
d81cd13bb3 Use cvtColor() for Bayer image color demosaicing and for V4L2_PIX_FMT_SRGGB8, V4L2_PIX_FMT_SBGGR8, V4L2_PIX_FMT_SGBRG8, V4L2_PIX_FMT_SGRBG8 options. Update modules/videoio/test/test_v4l2.cpp test file. 2024-04-03 13:48:24 +02:00
Alexander Smorkalov
2d864c3af9 Export TIFF compression options as API and git rid of tiff.h. 2024-04-03 14:30:11 +03:00
sepperliu
45587f23db Update highgui+HighGui.java
toBufferedImage
Modifying the original array copying method here can double the speed.
2024-04-03 13:29:10 +03:00
Dmitry Kurtaev
13c95efa74
Merge pull request #25312 from dkurt:dnn_hotfix_tflite
Ownership check in TFLite importer #25312

### Pull Request Readiness Checklist

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

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-04-03 09:41:40 +03:00
Dmitry Kurtaev
5e09fca0f8 Skip InferList.TestStreamingInfer 2024-04-03 09:23:23 +03:00
Alexander Smorkalov
99cacaaad6
Merge pull request #25195 from MaximSmolskiy:use-initial-quads-corners-in-ChessBoardDetector-findQuadNeighbors
Use initial quads corners in ChessBoardDetector::findQuadNeighbors
2024-04-02 13:13:01 +03:00
utibenkei
fdc7cb6dc1 fix build of dynamic framework for visionos 2024-04-01 22:19:47 +09:00
HAN Liutong
eba158fb0c
Merge pull request #25230 from hanliutong/rvv-conv
Optimize int8 layers in DNN modules by using RISC-V Vector intrinsic. #25230

This patch optimize 3 functions in the int8 layer by using RVV Native Intrinsic.

This patch was tested on QEMU using VLEN=128 and VLEN=256 on `./bin/opencv_test_dnn --gtest_filter="*Int8*"`;
On the real device (k230, VLEN=128), `EfficientDet_int8` in `opencv_perf_dnn` showed a performance improvement of 1.46x.

| Name of Test                               |  Original | optimized | Speed-up |
| ------------------------------------------ | -------- | ---------- | -------- |
| EfficientDet_int8::DNNTestNetwork::OCV/CPU | 2843.467 | 1947.013   | 1.46     |


### 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-03-31 16:47:06 +03:00
Alexander Smorkalov
8c540a56af
Merge pull request #25299 from Kumataro:add_fix25274
imgcodecs: jpeg: (test) fix condition to compare rgb and cmyk jpeg
2024-03-30 11:42:34 +03:00
Alexander Smorkalov
9f123f8d74
Merge pull request #25285 from johnteslade:cgroupsv2-support
core: Add cgroupsv2 support to parallel.cpp
2024-03-30 11:26:23 +03:00
Alexander Smorkalov
95ffabffdd
Merge pull request #25293 from asmorkalov:as/dct_hal_fix
Fixed HAL invocation for DCT.
2024-03-30 11:03:58 +03:00
Kumataro
9c8606e0c0 imgcodecs: jpeg: fix condition to compare rgb and cmyk jpeg 2024-03-30 13:49:08 +09:00
Kumataro
912cf2a028
Merge pull request #25280 from Kumataro:fix25274
imgcodecs: jpeg: re-support to read CMYK Jpeg #25280

Close #25274 
OpenCV Extra: https://github.com/opencv/opencv_extra/pull/1163

### 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-03-29 17:38:06 +03:00
Yuantao Feng
b758897c29
Merge pull request #25271 from fengyuentau:matmul_bias
Merge with https://github.com/opencv/opencv_extra/pull/1158

Todo:

- [x] Fix Attention pattern recognition.
- [x] Handle other backends.

Benchmark:

"VIT_B_32 OCV/CPU", M1, results in milliseconds.

| Model | 4.x | This PR |
| - | - | - |
| VIT_B_32 OCV/CPU | 87.66 | **83.83** |


### 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-03-29 17:35:23 +03:00
Alexander Smorkalov
9716bf95ae
Merge pull request #25294 from asmorkalov:as/InferROI_TestStreamingInfer_supress
Skip InferROI.TestStreamingInfer as unstable as it hangs on CI time-to-time
2024-03-29 15:54:52 +03:00
Alexander Smorkalov
9fc4b61074
Merge pull request #25291 from dkurt:einsum_openvino
Einsum OpenVINO backend
2024-03-29 15:54:26 +03:00
Dmitry Kurtaev
cfa42e4338 Einsum OpenVINO backend 2024-03-29 14:29:45 +03:00
Alexander Smorkalov
a7d6f105e7 Skip InferROI.TestStreamingInfer as unstable as it hangs on CI time-to-time. 2024-03-29 11:33:12 +03:00
zzuliys
2b9d1a2ff8
Merge pull request #24877 from zzuliys:feature/mac
Orbbec Camera supports MacOS,Gemini2 and Gemini2L support Y16 format #24877

note:
1.Gemini2 and Gemini2L must use the latest firmware -- https://github.com/orbbec/OrbbecFirmware;
2.Administrator privileges are necessary to run on MacOS.
2024-03-29 11:23:41 +03:00
Dmitry Kurtaev
01dc010436
Merge pull request #25273 from dkurt:tflite_new_layers
TFLite new layers #25273

### Pull Request Readiness Checklist

resolves https://github.com/opencv/opencv/issues/25272, https://github.com/opencv/opencv/issues/24965

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

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-03-29 11:21:13 +03:00
Alexander Smorkalov
7945f2cf40 Fixed HAL invocation for DCT. 2024-03-29 11:01:42 +03:00
thewoz
afb91b552e
Merge pull request #24415 from thewoz:imread
Add imread #24415

### 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

Hello everyone,
I created this new version of the imread function and I think it can be very useful in several cases.
It is actually passed to it object on which you want to upload the image.
The advantages can be different like in case one needs to open several large images all the same in sequence.
one can use the same pointer and the system would not allocate memory each time.
2024-03-29 10:51:19 +03:00
Alexander Smorkalov
7b9de94003
Merge pull request #25255 from Kumataro:refactor_imgcodec_tiff_add_imwrite_tiff
imgcodecs: tiff: to avoid using TIFFTAG_* directly for imwrite() params.
2024-03-29 10:44:34 +03:00
Michael Klatis
f87e1efd2a
Merge pull request #25092 from klatism:libjpeg-upgrade
libjpeg upgrade to version 9f #25092

Upgrade libjpeg dependency from version 9d to 9f.

- [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-03-28 17:03:05 +03:00
John Slade
7f1140b48b core: Add cgroupsv2 support to parallel.cpp
The parallel code works out how many CPUs are on the system by checking
the quota it has been assigned in the Linux cgroup. The existing code
works under cgroups v1 but the file structure changed in cgroups v2.
From [1]:

    "cpu.cfs_quota_us" and "cpu.cfs_period_us" are replaced by "cpu.max"
  which contains both quota and period.

This commit add support to parallel so it will read from the cgroups v2
location. v1 support is still retained.

Resolves #25284

[1] 0d5936344f
2024-03-28 11:52:47 +00:00
Alexander Smorkalov
1894426116
Merge pull request #25282 from asmorkalov:as/deterministic_undistort_test
Added PNG instance of image for fisheye::undistort test
2024-03-28 13:29:27 +03:00
Alexander Smorkalov
fd576d9e8e Added PNG instance of image for fisheye::undistort test as JPG is decoded differently with different libjpeg versions. 2024-03-28 12:02:58 +03:00
Alexander Smorkalov
a132fd401e
Merge pull request #25264 from lpylpy0514:4.x
fix a bug about vittrack post-process
2024-03-28 09:53:29 +03:00
Maxim Smolskiy
ff9aeaceb0
Merge pull request #25177 from MaximSmolskiy:speed-up-adaptive-image-binary-threshold-in-findChessboardCorners
Speed up adaptive threshold in findChessboardCorners #25177

### Pull Request Readiness Checklist

If `block_size` hasn't been changed between iterations for same `k`, then all `adaptiveThreshold` arguments will be same and we can reuse result from previous iteration.

I tested this PR with benchmark
```
python3 objdetect_benchmark.py --configuration=generate_run --board_x=7 --path=res_chessboard --synthetic_object=chessboard
```
PR speed up chessboards detection by `7.5/17%` without any changes in detected chessboards number:
```
cell_img_size = 100 (default)

before
                                 category  detected chessboard  total detected chessboard  total chessboard  average detected error chessboard
                                      all             0.904167                      13020             14400                           0.600512
Total detected time:  107.27875600000003 sec

after
                                 category  detected chessboard  total detected chessboard  total chessboard  average detected error chessboard
                                      all             0.904167                      13020             14400                           0.600512
Total detected time:  99.0223499999999 sec

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

cell_img_size = 10

before
                                 category  detected chessboard  total detected chessboard  total chessboard  average detected error chessboard
                                      all             0.539792                       7773             14400                           4.209964
Total detected time:  2.989205999999999 sec

after
                                 category  detected chessboard  total detected chessboard  total chessboard  average detected error chessboard
                                      all             0.539792                       7773             14400                           4.209964
Total detected time:  2.4802350000000013 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-03-27 15:34:54 +03:00
Maxim Smolskiy
e3ff6ce0cc
Merge pull request #25182 from MaximSmolskiy:increase-decomposeProjectionMatrix-precision-for-small-scales
Increase decomposeProjectionMatrix precision for small scales #25182 

### Pull Request Readiness Checklist

Fix #23733

It is checked before that `|s| > DBL_EPSILON` (if not, then `s` will be equal to `0`, but `c` will be equal to `1`, then `z` will be equal to `1` and there will be no any problems with small values), so `sqrt(c^2 + s^2) >= |s| > DBL_EPSILON` and thus small values are already taken into account before and there is no need to add `DBL_EPSILON` to `c^2 + s^2` (and I think adding `DBL_EPSILON^2` instead of `DBL_EPSILON` would be more correct).

I ran `Python` script from issue.

`NumPy` and `SciPy` results
```
*Numpy*
P (case 1): 
[[1. 0. 0. 0.]
 [0. 1. 0. 0.]
 [0. 0. 1. 0.]]
Numpy, R.T @ R - I: 
[[0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]]
Numpy scaled 1e-6, R.T @ R - I: 
[[0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]]
P (case 2): 
[[52. -7.  4. 12.]
 [-6. 49. 12.  8.]
 [ 4. 17.  1.  0.]]
Numpy, R.T @ R - I: 
[[-8.88178420e-16 -3.86302608e-16 -2.52050796e-17]
 [-3.86302608e-16 -5.55111512e-16  7.11675423e-18]
 [-2.52050796e-17  7.11675423e-18 -5.55111512e-16]]
Numpy scaled 1e-6, R.T @ R - I: 
[[ 2.22044605e-16 -2.00683644e-16 -1.90063998e-17]
 [-2.00683644e-16  0.00000000e+00  1.16926308e-17]
 [-1.90063998e-17  1.16926308e-17  2.22044605e-16]]

*Scipy*
P (case 1): 
[[1. 0. 0. 0.]
 [0. 1. 0. 0.]
 [0. 0. 1. 0.]]
Scipy, R.T @ R - I: 
[[0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]]
Scipy scaled 1e-6, R.T @ R - I: 
[[0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]]
P (case 2): 
[[52. -7.  4. 12.]
 [-6. 49. 12.  8.]
 [ 4. 17.  1.  0.]]
Scipy, R.T @ R - I: 
[[-1.11022302e-16 -8.74062812e-18 -1.26178867e-17]
 [-8.74062812e-18 -1.11022302e-16  2.07820373e-17]
 [-1.26178867e-17  2.07820373e-17 -1.11022302e-16]]
Scipy scaled 1e-6, R.T @ R - I: 
[[0.00000000e+00 4.04691435e-17 1.12452918e-16]
 [4.04691435e-17 4.44089210e-16 3.74164141e-16]
 [1.12452918e-16 3.74164141e-16 4.44089210e-16]]

*Numpy*
Numpy, P' - P:
 [[ 1.35525272e-20 -9.31736242e-21  8.47032947e-22  3.38813179e-21]
 [-3.38813179e-21  6.77626358e-21  1.69406589e-21  0.00000000e+00]
 [-1.69406589e-21  0.00000000e+00  0.00000000e+00  4.85524279e-22]]

*Scipy*
Scipy, P' - P:
 [[0.00000000e+00 8.47032947e-22 3.38813179e-21 3.38813179e-21]
 [3.38813179e-21 1.35525272e-20 1.52465931e-20 1.52465931e-20]
 [8.47032947e-22 3.38813179e-21 2.54109884e-21 3.39866995e-21]]
```

`OpenCV` results before
```
*OpenCV*
P (case 1): 
[[1. 0. 0. 0.]
 [0. 1. 0. 0.]
 [0. 0. 1. 0.]]
OpenCV, R.T @ R - I: 
[[0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]]
OpenCV scaled 1e-6, R.T @ R - I: 
[[0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]]
P (case 2): 
[[52. -7.  4. 12.]
 [-6. 49. 12.  8.]
 [ 4. 17.  1.  0.]]
OpenCV, R.T @ R - I: 
[[ 2.22044605e-16 -9.12253504e-17 -2.20527203e-19]
 [-9.12253504e-17  0.00000000e+00 -9.12405093e-18]
 [-2.20527203e-19 -9.12405093e-18  2.22044605e-16]]
OpenCV scaled 1e-6, R.T @ R - I: 
[[-1.28197013e-06  1.30450769e-07  7.67357467e-09]
 [ 1.30450769e-07 -1.52141637e-06 -9.92455574e-09]
 [ 7.67357467e-09 -9.92455574e-09 -1.35328272e-06]]

*OpenCV*
OpenCV, P' - P:
 [[-6.75449076e-11  1.73936564e-11 -4.94463312e-12 -1.61106020e-11]
 [ 1.41759913e-11 -7.54512016e-11 -1.67717374e-11 -9.74644390e-12]
 [-2.90254385e-12 -2.53521998e-11 -1.49130587e-12  4.00724440e-13]]
```

`OpenCV` results after
```
*OpenCV*
P (case 1): 
[[1. 0. 0. 0.]
 [0. 1. 0. 0.]
 [0. 0. 1. 0.]]
OpenCV, R.T @ R - I: 
[[0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]]
OpenCV scaled 1e-6, R.T @ R - I: 
[[0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]]
P (case 2): 
[[52. -7.  4. 12.]
 [-6. 49. 12.  8.]
 [ 4. 17.  1.  0.]]
OpenCV, R.T @ R - I: 
[[ 2.22044605e-16 -9.12253504e-17 -2.20527203e-19]
 [-9.12253504e-17  0.00000000e+00 -9.12405093e-18]
 [-2.20527203e-19 -9.12405093e-18  2.22044605e-16]]
OpenCV scaled 1e-6, R.T @ R - I: 
[[ 0.00000000e+00  4.36198333e-17 -2.66855078e-17]
 [ 4.36198333e-17  2.22044605e-16  3.17216400e-17]
 [-2.66855078e-17  3.17216400e-17 -2.22044605e-16]]

*OpenCV*
OpenCV, P' - P:
 [[ 6.77626358e-21  0.00000000e+00 -8.47032947e-22  1.69406589e-21]
 [-1.69406589e-21  6.77626358e-21  0.00000000e+00  3.38813179e-21]
 [ 8.47032947e-22  3.38813179e-21  2.11758237e-22  1.45657284e-21]]
```

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-03-27 12:43:56 +03:00
Alexander Smorkalov
5874bce144
Merge pull request #25189 from klatism:ios-build-fixes
ios build fixes
2024-03-27 10:05:32 +03:00
Alexander Smorkalov
d664d8d450
Merge pull request #25183 from MaximSmolskiy:fix-bug-in-maskBoundingRect
Fix bug in maskBoundingRect
2024-03-27 09:59:53 +03:00
Alexander Smorkalov
f36dbef74e
Merge pull request #25269 from RoboSchmied:RoboSchmied-AGfixT56
Fix 6 typos
2024-03-26 21:00:06 +03:00
Alexander Smorkalov
4dc461717f
Merge pull request #25258 from AleksandrPanov:fix_rotated_symmetric_grid
Fix detect rotated SYMMETRIC_GRID
2024-03-26 17:23:05 +03:00
Pierre Chatelier
1a537ab98f
Merge pull request #24893 from chacha21:cart_polar_inplace
Added in-place support for cartToPolar and polarToCart #24893

- a fused hal::cartToPolar[32|64]f() is used instead of sequential hal::magnitude[32|64]f/hal::fastAtan[32|64]f
- ipp_polarToCart is skipped for in-place processing (it seems not to support it correctly)

relates to #24891
### 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-03-26 15:38:17 +03:00
Yuantao Feng
accf200408
Merge pull request #25238 from fengyuentau:optimized_const
dnn: avoid const layer forwarding in layer norm layer and attention layer #25238

While profiling ViTs with dnn, I found `ConstLayer` can take a proportion of the inference time, which is weird. This comes from the data copy during the inference of `ConstLayer`. There is a chance that we can improve the efficiency of data copying but the easiest and most convenient way is to avoid `ConstLayer`. This PR change the way how we handle constants in layer normalization layer and attention layer, which is storing in the layer blobs instead of making constant layers for them.

Checklists:

- [x] Backend compatibility in layer normalization layer.

### 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-03-26 15:09:51 +03:00
Yusuke Kameda
6e9dcb87c1
Merge pull request #25237 from YusukeKameda:4.x
doc: add note on handling of spaces in CommandLineParser #25237

### 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
Added note that this class will not work properly if tabs and other whitespace characters are included in the key.
The support of whitespace characters by istringstream, etc. is on hold because the future of this class is not clear compared to implementations in Python and other languages.
2024-03-26 14:20:17 +03:00
RoboSchmied
8f4dbdad0e Fix: 6 typos
Signed-off-by: Michael Seibt <github@roboschmie.de>
2024-03-26 02:32:54 +01:00
Alex
eaa88e7bc7 fix detect rotated grid, added test 2024-03-25 14:07:03 +03:00
Alexander Smorkalov
fc34554475
Merge pull request #25184 from dkurt:avoid_extra_memset
Avoid extra memset
2024-03-25 13:07:49 +03:00
Alexander Smorkalov
aa5f7727d8
Merge pull request #25249 from carabsc:cara_changes
Added support for V4L2_PIX_FMT_SGRBG8 pixel format to V4L2 backend
2024-03-25 10:55:36 +03:00
lpylpy0514
84a1248b0a fix a bug about vittrack post-process 2024-03-25 15:40:34 +08:00
Yuantao Feng
025e7602b9
Merge pull request #25166 from fengyuentau:fix_cann_gemm
dnn (CANN): Fix incorrect shape of 1d bias in Gemm #25166

Gemm layer was refactored some time ago. Users found that the mobilenet example in https://github.com/opencv/opencv/wiki/Huawei-CANN-Backend does not work because of incorrect shape set for 1d bias in Gemm. This PR resolves this issue.

### 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-03-25 09:47:28 +03:00
Dmitry Kurtaev
0b6c9a2123
Merge pull request #25181 from dkurt:release_conv_weights
Release convolution weightsMat after usage #25181

### Pull Request Readiness Checklist

related (but not resolved): https://github.com/opencv/opencv/issues/24134

Minor memory footprint improvement. Also, adds a test for VmHWM.

RAM top memory usage (-230MB)

| YOLOv3 (237MB file) |   4.x   |    PR   |
|---------------------|---------|---------|
| no winograd         | 808 MB  | 581 MB  |
| winograd            | 1985 MB | 1750 MB |

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-03-25 09:03:28 +03:00
Kumataro
bbfded21ac imgcodecs: tiff: to avoid using TIFFTAG_* directly for imwrite() params.
Normaly, we sets IMWRITE_* flags for imwrite() params.
But imgcodecs expects to use some TIFFTAG_* directory.
This patch introduce IMWRITE_TIFF_ROWSPERSTRIP and
IMWRITE_TIFF_PREDICTOR instead of TIFFTAG_*.
2024-03-23 10:16:30 +09:00
Michael Klatis
52f3f5a3f6
libtiff upgrade to version 4.6.0 (#25096)
* libtiff upgrade to version 4.6.0

* fix tiffvers.h cmake generation

* temp: force build 3rd party deps from source

* remove libport.h and spintf.c

* cmake fixes

* don't use tiff_dummy_namespace on windows

* introduce numeric_types namespace alias

* include cstdint

* uint16_t is not a numeric_types type

* fix uint16 and uint32 type defs

* use standard c++ types

* remove unused files

* remove more unused files

* revert build 3rd party code from source

---------

Co-authored-by: Misha Klatis <misha.klatis@autodesk.com>
2024-03-22 04:08:16 +03:00
Yuantao Feng
3afe8ddaf8
core: Rename cv::float16_t to cv::hfloat (#25217)
* rename cv::float16_t to cv::fp16_t

* add typedef fp16_t float16_t

* remove zero(), bits() from fp16_t class

* fp16_t -> hfloat

* remove cv::float16_t::fromBits; add hfloatFromBits

* undo changes in conv_winograd_f63.simd.hpp and conv_block.simd.hpp

* undo some changes in dnn
2024-03-21 23:44:19 +03:00
Carlos Azevedo
8d5dd2e5c2 Added support for V4L2_PIX_FMT_SGRBG8 pixel format to V4L2 backend 2024-03-21 18:54:27 +00:00
Oleg Pipikin
6da2ddcf0e Fix for OpenVINO 2024.0
Remove support OpenVINO lower than 2022.1 release
Remove legacy InferenceEngine wrappers
2024-03-18 15:05:50 +04:00
Alexander Alekhin
625eebad54 Merge pull request #25203 from mshabunin:fix-scalable-intrin-test 2024-03-14 09:37:13 +00:00
Alexander Alekhin
60ca3d259e Merge pull request #25204 from mshabunin:fix-rvv-vne 2024-03-14 08:38:29 +00:00
Maksim Shabunin
6fc926ea4d Updated RVV intrinsics and test to remove initializer_list 2024-03-13 21:16:58 +03:00
Maksim Shabunin
01a4abb2c2 RISC-V: fixed comparison of float32 vectors 2024-03-12 22:05:38 +03:00
Maksim Shabunin
8550c415ef doc: fix formulas in JavaDoc broken after Doxygen upgrade 2024-03-11 23:47:23 +03:00
MaximSmolskiy
7fe1664bbf Use initial quads corners in ChessBoardDetector::findQuadNeighbors 2024-03-10 17:49:27 +03:00
Misha Klatis
50b36ef823 ios build fixes 2024-03-08 10:22:54 -08:00
Dmitry Kurtaev
6a370ba9e7 Avoid extra memset in convolution initialization 2024-03-08 10:46:07 +03:00
MaximSmolskiy
ed93384817 Fix bug in maskBoundingRect 2024-03-08 03:25:40 +03:00
Dmitry Matveev
f174363f60
Merge pull request #25055 from dmatveev:dm/value_initialized_gmat
G-API: A quick value-initialization support GMat #25055

This PR enables `GMat` objects to be value-initialized in the same way as it was done for `GScalar`s (and, possibly, other types).

- Added some helper methods in backends to distinguish if a certain G-type value initialization is supported or not;
- Added tests, including negative.

Where it is needed:

- Further extension of the OVCV backend (#24379 - will be refreshed soon);
- Further experiments with DNN module;
- Further experiments with "G-API behind UMat" sort of aggregation.

In the current form, PR can be reviewed & merged (@TolyaTalamanov please have a look)

### 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-03-06 17:15:49 +03:00
Alexander Smorkalov
0e524ee95a
Merge pull request #25145 from MaximSmolskiy:improve-contours-approximations-in-ChessBoardDetector-generateQuads-2
Improve contours approximations in ChessBoardDetector::generateQuads
2024-03-06 14:03:50 +03:00
Alexander Smorkalov
66ff71085e
Merge pull request #25163 from dkurt:onnx_graph_ref
Avoid copy of ONNX graph during import
2024-03-06 10:17:15 +03:00
Alexander Smorkalov
0f468a7f35
Merge pull request #25162 from mshabunin:doc-upgrade-fix
doc: removed duplicated markdown file
2024-03-05 20:25:35 +03:00
Maksim Shabunin
7b77ebc8c3 doc: removed duplicated markdown file, fixed gapi tutorial 2024-03-05 18:47:08 +03:00
Dmitry Kurtaev
98aed21dd4 Avoid copy of ONNX graph during import 2024-03-05 18:22:46 +03:00
Alexander Smorkalov
f2c38eb62f Backport some highgui changes from #22754 2024-03-05 17:49:01 +03:00
Kumataro
b34ec57682
Merge pull request #25141 from Kumataro:fix25140_4.x
calib3d: doc: remove C API link (For 4.x) #25141

Related to #25140 (for 4.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
- [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-03-05 16:24:42 +03:00
Maksim Shabunin
bf06e3d09f
Merge pull request #25042 from mshabunin:doc-upgrade
Documentation transition to fresh Doxygen #25042

* current Doxygen version is 1.10, but we will use 1.9.8 for now due to issue with snippets (https://github.com/doxygen/doxygen/pull/10584)
* Doxyfile adapted to new version
* MathJax updated to 3.x
* `@relates` instructions removed temporarily due to issue in Doxygen (to avoid warnings)
* refactored matx.hpp - extracted matx.inl.hpp
* opencv_contrib - https://github.com/opencv/opencv_contrib/pull/3638
2024-03-05 16:19:45 +03:00
Alexander Smorkalov
daa8f7dfc6 Partially back-port #25075 to 4.x 2024-03-05 12:15:39 +03:00
Alexander Smorkalov
2d0f928934
Merge pull request #24724 from tomoaki0705:carotene_warnings
build: suppress warning ARM64 + Visual Studio build
2024-03-04 09:55:13 +03:00
Laurent Berger
5fe3933346
Merge pull request #25120 from LaurentBerger:I25103
Fixed ReduceMean layer behaviour #25120

### 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

a93c31e3c9/onnxruntime/core/providers/cpu/reduction/reduction_ops.cc (L433-L443)
2024-03-04 09:36:53 +03:00
MaximSmolskiy
c346ee1c29 Improve contours approximations in ChessBoardDetector::generateQuads 2024-03-03 23:05:29 +03:00
Yuya Unno
500c55a808
Merge pull request #25122 from unnonouno:pqueue
Use std::priority_queue in inpaint function for performance improvement #25122

In `cv::inpaint` implementation, it uses a priority queue with O(n) time linear search. For large images it is very slow.
I replaced it with C++'s standard library `std::priority_queue`, that uses O(log(n)) algorithm.
In my use case, it is x10 faster than the original.

### 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-03-02 13:43:58 +03:00
Tomoaki Teshima
52e280e94b suppress warning ARM64 + Visual Studio build
* follow the message
2024-03-02 19:08:20 +09:00
CSBVision
e8582f2cf8 Update net_impl.cpp
See issue #25112
2024-03-01 14:56:00 +01:00
Alexander Smorkalov
fc98b31c3e Partially backport C API removal in imgproc module to reduce conflicts with 5.x 2024-02-29 12:42:19 +03:00
Pierre Chatelier
5e5a035c5b
Merge pull request #24621 from chacha21:remap_relative
First proposal of cv::remap with relative displacement field (#24603) #24621

Implements #24603

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

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

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

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

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

### Pull Request Readiness Checklist

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

- [X] I agree to contribute to the project under Apache 2 License.
- [X] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
- [X] The PR is proposed to the proper branch
- [X] There is a reference to the original bug report and related work
- [X] There is accuracy test, performance test and test data in opencv_extra repository, if applicable
      Patch to opencv_extra has the same branch name.
- [ ] The feature is well documented and sample code can be built with the project CMake
2024-02-28 17:20:33 +03:00
Yuantao Feng
5aa5c39210
Merge pull request #25076 from fengyuentau:improve_attention
dnn: try improving performance of Attention layer #25076

Checklist:

- [x] Use `Mat` over `Mat::zeros` for temporary buffer in forward
- [x] Use layer internal buffer over temporary Mat buffer
- [x] Try a single fastGemmBatch on the Q/K/V calculation

Performance:

Performance test case is `Layer_Attention.VisionTransformer/0`, which has input of shape {1, 197, 768}, weight of shape {768, 2304} and bias {2304}.

Data is in millisecond.

| | macOS 14.2.1, Apple M1 | Ubuntu 22.04.2, Intel i7 12700K |
| - | - | - |
| Current | 10.96 | 1.58 |
| w/ Mat | 6.27 | 1.41 |
| w/ Internals | 5.87 | 1.38 |
| w/ fastGemmBatch | 6.12 | 2.14 |


### 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-02-28 16:47:08 +03:00
Laurent Berger
3c712cf77d
Merge pull request #25100 from LaurentBerger:I25077
Fix issue #25077 #25100

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

### 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-02-27 14:15:11 +03:00
Dhanwanth1803
c04750ab57
Merge pull request #25091 from Dhanwanth1803:scoreThresh
Fixes #25056 : Optimising postProcess(const std::vector<Mat>& output_blobs) #25091

Like mentioned in the issue #25056 , I think checking the condition with `scoreThreshold` and then assigning the bounding boxes can optimize the function pretty well. By doing this, we prevent allocating boxes to faces with scores below the threshold. It also reduces the amount of data that needs to be processed during the subsequent NMS step. Builds and passed locally.

- [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

Co-authored-by: Dhanwanth1803 <dhanwanthvarala@gmail,com>
2024-02-27 12:10:52 +03:00
Adrian Kretz
e0b489e917
Merge pull request #25050 from akretz:fix_issue_24330
Handle degenerate cases in RQDecomp3x3 #25050

The point of the Givens rotations here is to iteratively set the lower left matrix entries to zero. If an element is zero already, we don't need to do anything. This resolves #24330.

### Pull Request Readiness Checklist

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

- [x] I agree to contribute to the project under Apache 2 License.
- [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
- [x] The PR is proposed to the proper branch
- [x] There is a reference to the original bug report and related work
- [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable
      Patch to opencv_extra has the same branch name.
- [ ] The feature is well documented and sample code can be built with the project CMake
2024-02-27 08:10:21 +03:00
Sergei Shutov
6ca45a9d33
Merge pull request #23018 from stopmosk:move-aruco-tutorial
Move Aruco tutorials and samples to main repo #23018

merge with https://github.com/opencv/opencv_contrib/pull/3401
merge with https://github.com/opencv/opencv_extra/pull/1143

### 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

---------
Co-authored-by: AleksandrPanov <alexander.panov@xperience.ai>
Co-authored-by: Alexander Smorkalov <alexander.smorkalov@xperience.ai>
2024-02-26 14:57:46 +03:00
Alexander Smorkalov
faba2d8148
Merge pull request #25067 from danoli3:master
Update ios_conversions.mm - Fix Mac Catalyst compile target
2024-02-26 14:28:10 +03:00
Alexander Smorkalov
37e056c06c
Merge pull request #25079 from lxk696:4.x
fix [use hasattr("cv2", "name") ,but first param is 'character string',
2024-02-26 12:46:17 +03:00
Maxim Smolskiy
853f7ff904
Merge pull request #25090 from MaximSmolskiy:compensate-edge-length-in-ChessBoardDetector-generateQuads-attempt-2
Compensate edge length in ChessBoardDetector::generateQuads (attempt 2) #25090

### Pull Request Readiness Checklist

New attempt for #24833, which was reverted as #25036.

Locally I fixed `Calib3d_StereoCalibrate_CPP.regression` test by corners refinement using `cornerSubPix` function

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-02-26 12:12:53 +03:00
Dan Rosser
e596680939 Update ios_conversions.mm
Define fix for Mac Catalyst iOS
2024-02-26 19:21:52 +11:00
Székely Gábor
6f48cb78b6
Merge pull request #25084 from EDVTAZ:emscripten-3.1.54-compat
Add compatibility with latest (3.1.54) emsdk version #25084

### 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

### Details

I was following [this tutorial](https://docs.opencv.org/4.9.0/d4/da1/tutorial_js_setup.html) for building opencv with wasm target. The tutorial mentions that the last verified version of emscripten that is tested with opencv is 2.0.10, but I was curious if I could get it to work with more recent versions. I've run into a few issues with the latest version, for which fixes are included in this PR. I've found a few issues that have the same problems I encountered:

- https://github.com/opencv/opencv/issues/24620
- https://github.com/opencv/opencv/issues/20313
- https://stackoverflow.com/questions/77469603/custom-opencv-js-wasm-using-cv-matfromarray-results-in-cv-mat-is-not-a-co
- https://github.com/emscripten-core/emscripten/issues/14803
- https://github.com/opencv/opencv/issues/24572
- https://github.com/opencv/opencv/issues/19493#issuecomment-857167996

I used the docker image for building and comparing results with different emsdk versions. I tested by building with `--build_wasm` and `--build-test` flags and ran the tests in the browser. I addressed the following issues with newer versions of emscripten:

- In newer versions `EMSCRIPTEN` environemnt variable was stopped being set. I added support for deriving location based on the `EMSDK` environment variable, as suggested [here](https://github.com/emscripten-core/emscripten/issues/14803)
- In newer versions emcmake started passing `-DCMAKE...` arguments, however the opencv python script didn't know how to handle them. I added processing to the args that will forward all arguments to `cmake` that start with `-D`. I opted for this in hopes of being more futureproof, but another approach could be just ignoreing them, or explicitly forwarding them instead of matching anything starting with `-D`. These approches were suggested [here](https://github.com/opencv/opencv/issues/19493#issuecomment-855529448)
- With [version 3.1.31](https://github.com/emscripten-core/emscripten/blob/main/ChangeLog.md#3131---012623) some previously exported functions stopped being automatically exported. Because of this, `_free` and `_malloc` were no longer available and had to be explicitly exported because of breaking tests.
- With [version 3.1.42](https://github.com/emscripten-core/emscripten/compare/3.1.41...3.1.42#diff-e505aa80b2764c0197acfc9afd8179b3600f0ab5dd00ff77db01879a84515cdbL3875) the `post-js` code doesn't receive the module named as `EXPORT_NAME` anymore, but only as `moduleArg`/`Module`. This broke existing code in `helpers.js`, which was referencing exported functions through `cv.Mat`, etc. I changed all of these references to use `Module.Mat`, etc. If it is preferred, alternatively the `cv` variable could be reintroduced in `helper.js` as suggested [here](https://github.com/opencv/opencv/issues/24620)

With the above changes in place, I can successfully build and run tests with the latest emscripten/emsdk docker image (also with 2.0.10 and most of the other older tags, except for a few that contain transient issues like [this](https://github.com/emscripten-core/emscripten/issues/17700)).

This is my first time contributing to opencv, so I hope I got everything correct in this PR, but please let me know if I should change anything!
2024-02-26 10:30:56 +03:00
Alexander Smorkalov
ae347ab493
Merge pull request #25083 from mamut-m:fix_docs_for_reprojectImageTo3D
Fixing the formula in the documentation of reprojectImageTo3D
2024-02-24 18:09:23 +03:00
Alexander Smorkalov
cbec3f012d
Merge pull request #25086 from ryo8000:fix-typo
Fixed typo.
2024-02-24 18:08:55 +03:00
Alexander Smorkalov
a2e23fa988
Merge pull request #25059 from opencv-pushbot:gitee/alalek/core_fix_float16
core: fix float16_t optimization condition
2024-02-24 13:28:05 +03:00
Ryo H
e4ef88c623 Fixed typo. 2024-02-24 18:03:18 +09:00
Markus Murschitz
f9a7d3b90c changed formular in documentation of reprojectImageTo3D to fit the actual algorithm 2024-02-23 23:09:12 +01:00
刘雄康
ba483dfbb8 fix [use hasattr("cv2", "name") ,but first param is 'character string',
resulting in an error in the judgment condition]
2024-02-23 22:02:43 +08:00
Dmitry Matveev
d792086ba6
Merge pull request #25060 from dmatveev:dm/gapi_test_time
G-API: Make test execution lighter (first attempt) #25060

### Background

G-API tests look running longer than tests for the rest of modules (e.g., 5m), and the analysis show that there's several outliers in G-API test suite which take a lot of time but don't improve the testing quality much:
![image](https://github.com/opencv/opencv/assets/144187/e6df013f-e548-47ac-a418-285b3f78c9f8)

In this PR I will cut the execution time to something reasonable.

### Contents

- Marked some outliers as `verylong`:
  - OneVPL barrier test - pure brute force
  - Stateful test in stream - in fact BG Sub accuracy test clone
- Restructured parameters instantiation in Streaming tests to generate less test configurations (54 -> 36)

### 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-02-22 16:40:33 +03:00
Vadim Pisarevsky
2d204243af
Merge pull request #25064 from vpisarev:em_5point_fix
Fix very slow compilation of five-point algorithm on some platforms (e.g. Qualcomm) #25064

Thanks to our big friend and long-term contributor for the patch!

### 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-02-22 12:04:13 +03:00
Alexander Smorkalov
296a90ae01
Merge pull request #25062 from TinyTinni:missing-const
Adds missing const in function declaration of VideoCapture
2024-02-22 10:23:24 +03:00
Alexander Smorkalov
6c21a80ef7
Merge pull request #24946 from alexlyulkov:al/kotlin-tests2
Added Kotlin test, changed Kotlin version for OpenCV
2024-02-22 09:30:45 +03:00
Matthias Möller
e537e1650d adds missing const 2024-02-21 12:31:07 +01:00
Anatoliy Talamanov
5fbf3d85bf
Merge pull request #25054 from TolyaTalamanov:at/gapi-lower-supported-ie-backend-version
G-API: Lower supported IE backend version #25054

Related to https://github.com/opencv/opencv/issues/25053

### 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-02-21 11:45:36 +03:00
Alexander Alekhin
02504e2bdb core: fix float16_t optimization condition
- resolves issue on Windows ARM64
2024-02-21 08:11:32 +00:00
Vincent Rabaud
f8aa2896a1
Merge pull request #25024 from vrabaud:neon
Replace legacy __ARM_NEON__ by __ARM_NEON #25024

Even ACLE 1.1 referes to __ARM_NEON
https://developer.arm.com/documentation/ihi0053/b/?lang=en

### 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-02-20 11:29:23 +03:00
Alexander Smorkalov
f8ef646312
Merge pull request #25046 from AleksandrPanov:fix_QRArucoParameters
fix setArucoParameters in QRCodeDetectorAruco, add const to getArucoParameters
2024-02-20 09:29:57 +03:00
Alexander Smorkalov
54be266938
Merge pull request #25044 from akretz:fix_issue_24348
Fix testMahalanobis
2024-02-19 12:58:23 +03:00
Alex
9e7ec59a41 fixed setArucoParameters/getArucoParameters 2024-02-19 00:12:36 +03:00
Alex
e03231e6aa fix unnecessary copying 2024-02-18 23:45:49 +03:00
Adrian Kretz
3473b8a653 Generate invertible covariance matrix 2024-02-18 20:09:53 +01:00
Dhanwanth1803
12aa0fe898
Merge pull request #24985 from Dhanwanth1803:hardswish
Fixes #24974 support HardSwishInt8 #24985

As given very clearly in the issue #24974 I made the required 2 changes to implement HardSwish Layer in INT8. Requesting comments.

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

- [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

Co-authored-by: Dhanwanth1803 <dhanwanthvarala@gmail,com>
2024-02-16 18:19:29 +03:00
Alexander Smorkalov
bd73b7bcf5
Merge pull request #25028 from asmorkalov:as/fisheye_solvepnp
solvePnP implementation for Fisheye camera model #25028

Credits to Linfei Pan
Extracted from https://github.com/opencv/opencv/pull/24052

**Warning:** The patch changes Obj-C generator behaviour and adds "fisheye_" prefix for all ObjC functions from namespace.

### 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

Co-authored-by: lpanaf <linpan@student.ethz.ch>
Co-authored-by: Vadim Levin <vadim.levin@xperience.ai>
2024-02-16 17:54:40 +03:00
Alexander Smorkalov
7bea25a60c
Merge pull request #25030 from asmorkalov:as/fisheye_initial_f
Changed initial estimation for F in fisheye calibration
2024-02-16 17:18:43 +03:00
Alexander Panov
b2db959619
Merge pull request #25035 from AleksandrPanov:fix_Barcode_detectAndDecode
Fix barcode detectAndDecode #25035

The method `detectAndDecode()` in the `BarcodeDetector` class doesn't return the barcode corners.
This PR fixes the and add test for `detectAndDecode`.

### Pull Request Readiness Checklist

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

- [x] I agree to contribute to the project under Apache 2 License.
- [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
- [x] The PR is proposed to the proper branch
- [x] There is a reference to the original bug report and related work
- [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable
      Patch to opencv_extra has the same branch name.
- [ ] The feature is well documented and sample code can be built with the project CMake
2024-02-16 16:37:49 +03:00
Adrian Kretz
68f6c81539
Merge pull request #25026 from akretz:fix_qrcode_bugs
Fix qrcode bugs #25026

This PR fixes #22892, #24011 and #24450 and adds regression tests using the images provided. I've also verified with the [benchmark](https://github.com/opencv/opencv_benchmarks/tree/develop/python_benchmarks/qr_codes) that this doesn't break anything there.

resolves #22892
resolves #24011
resolves #24450
Replaces #23802

Requires extra: https://github.com/opencv/opencv_extra/pull/1148

### Pull Request Readiness Checklist

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

- [x] I agree to contribute to the project under Apache 2 License.
- [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
- [x] The PR is proposed to the proper branch
- [x] There is a reference to the original bug report and related work
- [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable
      Patch to opencv_extra has the same branch name.
- [ ] The feature is well documented and sample code can be built with the project CMake
2024-02-16 16:09:04 +03:00
Alexander Smorkalov
78a765cb81 Reverted Compensate edge length in ChessBoardDetector::generateQuads #24833 2024-02-16 12:12:00 +03:00
lpanaf
b87058f7ac Changed initial estimation for F in fisheye calibration. 2024-02-15 16:22:30 +03:00
Alexander Smorkalov
a9f15d7372
Merge pull request #24833 from MaximSmolskiy:compensate-edge-length-in-ChessBoardDetector-generateQuads
Compensate edge length in ChessBoardDetector::generateQuads
2024-02-15 13:22:13 +03:00
Alexander Smorkalov
2315bf52a8
Merge pull request #25023 from asmorkalov:as/aruco_doc_fix
Typo fix in Aruco documentation
2024-02-15 12:21:43 +03:00
lpanaf
0fa538fcc8 Typo fix in Aruco documentation. 2024-02-14 16:12:10 +03:00
Yannis Guyon
fefd2e5ce6
Remove 3 hidden leading chars in flann/dist.h
/**** is EF BB BF 2F 2A 2A 2A 2A instead of 2F 2A 2A 2A 2A.
2024-02-14 11:43:52 +01:00
Alexander Smorkalov
49367b5bec
Merge pull request #25009 from asmorkalov:as/fix_issue_24679_alt
Alternative solution for QR code black/white balance computation
2024-02-13 17:01:16 +03:00
Alexander Smorkalov
0424ba57d7 Alternative solution for QR code black/white balance computation. 2024-02-12 20:41:40 +03:00
Lollyrana
b0201ec55f
Fix_typo_size_ predefined_types.py 2024-02-12 22:55:33 +05:30
Alexander Smorkalov
82914e442c
Merge pull request #24710 from MaximSmolskiy:do-not-dilate-binary-images-on-first-iteration-in-findChessboardCorners
Do not dilate binary images on first iteration in findChessboardCorners
2024-02-12 15:40:02 +03:00
Alexander Smorkalov
8d2470c035
Merge pull request #24704 from AsyaPronina:mean_scale_for_gapi_ov
Fixed support of mean/scale preprocessing in OV backend for non-real types
2024-02-12 10:43:34 +03:00
Alexander Smorkalov
51f9ff5b10
Merge pull request #24976 from Kumataro:refix23416
imgcodecs: refix test for 23416 to use perf::MatType
2024-02-12 10:22:55 +03:00
Maksym Ivashechkin
f300deb569
Merge pull request #24987 from ivashmak:bugfix_infinite_loop
bug fix infinite loop #24987

Fixes #24967

### 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

Bugfix to #24967
2024-02-12 10:16:19 +03:00
Kumataro
f5928a5be9 imgcodecs: refix 23416 to use perf::MatType 2024-02-08 12:35:29 +09:00
MaximSmolskiy
bcbc74d4cd Do not dilate binary images on first iteration in findChessboardCorners 2024-02-08 01:31:29 +03:00
Alexander Lyulkov
02b3518a3b Added Kotlin test, changed Kotlin version for OpenCV 2024-02-07 11:17:36 +03:00
Alexander Smorkalov
76548e29bd
Merge pull request #24969 from asmorkalov:as/android_offline
Allow multiple flags with OPENCV_GRADLE_VERBOSE_OPTIONS #24969

### Pull Request Readiness Checklist

Merge with https://github.com/opencv/ci-gha-workflow/pull/144

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-02-07 11:13:43 +03:00
Alexander Smorkalov
4b35b2f968
Merge pull request #24973 from asmorkalov:as/fix_weigths_proto_mess
Fix proto and weights mess in dnn performance tests
2024-02-07 11:10:32 +03:00
Alexander Smorkalov
77af137285 Fix proto and weights mess in dnn performance tests. 2024-02-07 09:16:09 +03:00
Alexander Alekhin
5abb065b3f Merge pull request #24968 from fengyuentau:fix_nary_ocl 2024-02-06 18:22:39 +00:00
Maxim Smolskiy
28d22d7b84
Merge pull request #24779 from MaximSmolskiy:fix-bug-in-ChessBoardDetector-findQuadNeighbor
Fix bug in ChessBoardDetector::findQuadNeighbors #24779

### Pull Request Readiness Checklist

`corners` and `neighbors` indices means not filling order, but relative position. So, for example if `quad->count = 2`, it doesn't mean that `quad->neighbors[0]` and `quad->neighbors[1]` are filled. And we should should iterate over all four `neighbors`.

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-02-06 15:16:12 +03:00
fengyuentau
fcaa8ce3c2 fix incorrect steps and elemsize when dtype changes 2024-02-06 16:27:25 +08:00
Alexander Smorkalov
250cfe81c5
Merge pull request #24949 from hoodmane:emscripten-enable-file-system
Enable file system on Emscripten
2024-02-02 15:50:15 +03:00
Dmitry Kurtaev
fc32903b28
Merge pull request #24548 from dkurt:qrcode_struct_append_decode
QR codes Structured Append decoding mode #24548

### Pull Request Readiness Checklist

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

Merge after https://github.com/opencv/opencv/pull/24299

Current proposal is to use `detectAndDecodeMulti` or `decodeMulti` for structured append mode decoding. 0-th QR code in a sequence gets a full message while the rest of codes will correspond to empty strings.

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-02-01 16:15:14 +03:00
ryanking13
422d519703 Enable file system on Emscripten 2024-01-31 11:28:59 -08:00
alexlyulkov
85450816b4
Merge pull request #24910 from alexlyulkov:al/android-tests
Modified Java tests to run on Android #24910

To run the tests you need to:

1. Build OpenCV using Android pipeline. For example:
`cmake -DBUILD_TEST=ON -DANDROID=ON -DANDROID_ABI=arm64-v8a -DCMAKE_TOOLCHAIN_FILE=/usr/lib/android-sdk/ndk/25.1.8937393/build/cmake/android.toolchain.cmake -DANDROID_NDK=/usr/lib/android-sdk/ndk/25.1.8937393 -DANDROID_SDK=/usr/lib/android-sdk ../opencv`
`make`
2. Connect Android Phone
3. Run tests:
`cd android_tests`
`./gradlew tests_module:connectedAndroidTest`

Related CI pipeline: https://github.com/opencv/ci-gha-workflow/pull/138

### 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-01-31 15:09:57 +03:00
Alexander Smorkalov
ba8915c88c Build warning fix for Charuco tests. 2024-01-30 18:18:52 +03:00
Anatoliy Talamanov
8e43c8f200
Merge pull request #24845 from TolyaTalamanov:at/concurrent-executor
G-API: Implement concurrent executor #24845

## Overview
This PR introduces the new G-API executor called `GThreadedExecutor` which can be selected when the `GComputation` is compiled in `serial` mode (a.k.a `GComputation::compile(...)`)

### ThreadPool
`cv::gapi::own::ThreadPool` has been introduced in order to abstract usage of threads in `GThreadedExecutor`.
`ThreadPool` is implemented by using  `own::concurrent_bounded_queue`

`ThreadPool` has only as single method `schedule` that will push task into the queue for the further execution.
The **important** notice is that if `Task` executed in `ThreadPool` throws exception - this is `UB`. 

### GThreadedExecutor
The `GThreadedExecutor` is mostly copy-paste of `GExecutor`, should we extend `GExecutor` instead? 

#### Implementation details
1. Build the dependency graph for `Island` nodes.
2. Store the tasks that don't have dependencies into separate `vector` in order to run them first.
3. at the `GThreadedExecutor::run()` schedule the tasks that don't have dependencies that will schedule their dependents and wait for the completion.


### 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-01-30 17:01:50 +03:00
Haosonn
87f749277d
Merge pull request #24768 from Haosonn:pre-pr-2
Vulkan backend for NaryEltwiseLayer in DNN module #24768

We improve Vulkan backend for ``NaryEltwiseLayer`` in DNN module by:

- add a basic framework for Vulkan backend in ``NaryEltwiseLayer``
- add a compute shader for binary forwarding (an imitation of what has been done in native OpenCV backend including broadcasting and eltwise-operation)
- typo fixed:
  - Wrong info output in ``context.cpp``

Currently, our implementation (or all layers supporting Vulkan backend) runs pretty slow on discrete GPUs basically due to IO cost in function ``copyToHost``, and we are going to fix that by

- find out the best ``VkMemoryProperty`` for various discrete GPUs

- prevent ``copyToHost`` in middle layers during forwarding, (i.e keep data in GPU memory)
### 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

Co-authored-by: IskXCr <IskXCr@outlook.com>
2024-01-29 18:41:49 +03:00
Alexander Smorkalov
73acf08844
Merge pull request #24919 from asmorkalov:as/python_Rect2f_Point3i
Add python bindings for Rect2f and Point3i
2024-01-29 17:36:30 +03:00
Alexander Smorkalov
8ea939f7eb
Merge pull request #24929 from asmorkalov:as/imdecode_user_buffer
Do not release user-provided buffer, if image decoder failed
2024-01-29 17:33:42 +03:00
Alexander Smorkalov
54b7cafd2a
Merge pull request #24936 from mshabunin:fix-rvv07-scale64f
RISC-V: fix scale64f performance for RVV 0.7
2024-01-29 17:32:51 +03:00
Maksim Shabunin
65784dddeb RISC-V: fix scale64f for RVV 0.7 2024-01-29 01:24:44 +03:00
Maksim Shabunin
2ea2483bec RISC-V: fix mul 8/16 bit for RVV 0.7 2024-01-27 22:41:26 +03:00
Alexander Smorkalov
c9671da732 Do not release user-provided buffer, if decoder failed. 2024-01-27 13:33:39 +03:00
Alexander Alekhin
efc9837df1
Merge pull request #24892 from opencv-pushbot:gitee/alalek/dnn_avoid_16s_usage
DNN: avoid CV_16S usage for FP16 #24892

**Merge after**: #24918

TODO:
- [x] measure performance changes
- [x] optimize convertTo for OpenCL: #24918

12700K iGPU:

|Name of Test|0|1|1 vs 0 (x-factor)|
|---|:-:|:-:|:-:|
|AlexNet::DNNTestNetwork::OCV/OCL_FP16|7.441|7.480|0.99|
|CRNN::DNNTestNetwork::OCV/OCL_FP16|10.776|10.736|1.00|
|DenseNet_121::DNNTestNetwork::OCV/OCL_FP16|52.762|52.833|1.00|
|EAST_text_detection::DNNTestNetwork::OCV/OCL_FP16|60.694|60.721|1.00|
|EfficientNet::DNNTestNetwork::OCV/OCL_FP16|33.373|33.173|1.01|
|FastNeuralStyle_eccv16::DNNTestNetwork::OCV/OCL_FP16|81.840|81.724|1.00|
|GoogLeNet::DNNTestNetwork::OCV/OCL_FP16|20.965|20.927|1.00|
|Inception_5h::DNNTestNetwork::OCV/OCL_FP16|22.204|22.173|1.00|
|Inception_v2_SSD_TensorFlow::DNNTestNetwork::OCV/OCL_FP16|47.115|47.460|0.99|
|MPHand::DNNTestNetwork::OCV/OCL_FP16|6.760|6.670|1.01|
|MPPalm::DNNTestNetwork::OCV/OCL_FP16|10.188|10.171|1.00|
|MPPose::DNNTestNetwork::OCV/OCL_FP16|12.510|12.561|1.00|
|MobileNet_SSD_Caffe::DNNTestNetwork::OCV/OCL_FP16|17.290|17.072|1.01|
|MobileNet_SSD_v1_TensorFlow::DNNTestNetwork::OCV/OCL_FP16|19.473|19.306|1.01|
|MobileNet_SSD_v2_TensorFlow::DNNTestNetwork::OCV/OCL_FP16|22.874|23.404|0.98|
|OpenFace::DNNTestNetwork::OCV/OCL_FP16|9.568|9.517|1.01|
|OpenPose_pose_mpi_faster_4_stages::DNNTestNetwork::OCV/OCL_FP16|539.899|539.845|1.00|
|PPHumanSeg::DNNTestNetwork::OCV/OCL_FP16|18.015|18.769|0.96|
|PPOCRv3::DNNTestNetwork::OCV/OCL_FP16|63.122|63.540|0.99|
|ResNet_50::DNNTestNetwork::OCV/OCL_FP16|34.947|34.925|1.00|
|SFace::DNNTestNetwork::OCV/OCL_FP16|10.249|10.206|1.00|
|SSD::DNNTestNetwork::OCV/OCL_FP16|213.068|213.108|1.00|
|SqueezeNet_v1_1::DNNTestNetwork::OCV/OCL_FP16|4.867|4.878|1.00|
|VIT_B_32::DNNTestNetwork::OCV/OCL_FP16|200.563|190.788|1.05|
|VitTrack::DNNTestNetwork::OCV/OCL_FP16|7.528|7.173|1.05|
|YOLOX::DNNTestNetwork::OCV/OCL_FP16|132.858|132.701|1.00|
|YOLOv3::DNNTestNetwork::OCV/OCL_FP16|209.559|208.809|1.00|
|YOLOv4::DNNTestNetwork::OCV/OCL_FP16|221.357|220.924|1.00|
|YOLOv4_tiny::DNNTestNetwork::OCV/OCL_FP16|24.446|24.382|1.00|
|YOLOv5::DNNTestNetwork::OCV/OCL_FP16|43.922|44.080|1.00|
|YOLOv8::DNNTestNetwork::OCV/OCL_FP16|64.159|63.842|1.00|
|YuNet::DNNTestNetwork::OCV/OCL_FP16|10.177|10.231|0.99|
|opencv_face_detector::DNNTestNetwork::OCV/OCL_FP16|15.121|15.445|0.98|

Co-authored-by: Alexander Alekhin <alexander.a.alekhin@gmail.com>
2024-01-26 16:34:17 +03:00
Yuantao Feng
37156a4719
Merge pull request #24925 from fengyuentau:loongarch_handle_warnings
Handle warnings in loongson-related code #24925

See https://github.com/fengyuentau/opencv/actions/runs/7665377694/job/20891162958#step:14:16

Warnings needs to be handled before we add the loongson server to our CI.

### 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-01-26 13:38:00 +03:00
Alexander Alekhin
40533dbf69
Merge pull request #24918 from opencv-pushbot:gitee/alalek/core_convertfp16_replacement
core(OpenCL): optimize convertTo() with CV_16F (convertFp16() replacement) #24918

relates #24909
relates #24917
relates #24892

Performance changes:

- [x] 12700K (1 thread) + Intel iGPU

|Name of Test|noOCL|convertFp16|convertTo BASE|convertTo PATCH|
|---|:-:|:-:|:-:|:-:|
|ConvertFP16FP32MatMat::OCL_Core|3.130|3.152|3.127|3.136|
|ConvertFP16FP32MatUMat::OCL_Core|3.030|3.996|3.007|2.671|
|ConvertFP16FP32UMatMat::OCL_Core|3.010|3.101|3.056|2.854|
|ConvertFP16FP32UMatUMat::OCL_Core|3.016|3.298|2.072|2.061|
|ConvertFP32FP16MatMat::OCL_Core|2.697|2.652|2.723|2.721|
|ConvertFP32FP16MatUMat::OCL_Core|2.752|4.268|2.662|2.947|
|ConvertFP32FP16UMatMat::OCL_Core|2.706|2.601|2.603|2.528|
|ConvertFP32FP16UMatUMat::OCL_Core|2.704|3.215|1.999|1.988|

Patched version is not worse than convertFp16 and convertTo baseline (except MatUMat 32->16, baseline uses CPU code+dst buffer map).
There are still gaps against noOpenCL(CPU only) mode due to T-API implementation issues (unnecessary synchronization).


- [x] 12700K + AMD dGPU

|Name of Test|noOCL|convertFp16 dGPU|convertTo BASE dGPU|convertTo PATCH dGPU|
|---|:-:|:-:|:-:|:-:|
|ConvertFP16FP32MatMat::OCL_Core|3.130|3.133|3.172|3.087|
|ConvertFP16FP32MatUMat::OCL_Core|3.030|1.713|9.559|1.729|
|ConvertFP16FP32UMatMat::OCL_Core|3.010|6.515|6.309|4.452|
|ConvertFP16FP32UMatUMat::OCL_Core|3.016|0.242|23.597|0.170|
|ConvertFP32FP16MatMat::OCL_Core|2.697|2.641|2.713|2.689|
|ConvertFP32FP16MatUMat::OCL_Core|2.752|4.076|6.483|4.191|
|ConvertFP32FP16UMatMat::OCL_Core|2.706|9.042|16.481|1.834|
|ConvertFP32FP16UMatUMat::OCL_Core|2.704|0.229|15.730|0.176|

convertTo-baseline can't compile OpenCL kernel for FP16 properly - FIXED.
dGPU has much more power, so results are x16-17 better than single cpu core. 
Patched version is not worse than convertFp16 and convertTo baseline.
There are still gaps against noOpenCL(CPU only) mode due to T-API implementation issues (unnecessary synchronization) and required memory transfers.

Co-authored-by: Alexander Alekhin <alexander.a.alekhin@gmail.com>
2024-01-26 12:56:52 +03:00
Alexander Smorkalov
ae21368eb9
Merge pull request #24832 from AryanNanda17:Aryan#22177
Resolved issue number #22177
2024-01-26 10:42:47 +03:00
Alexander Smorkalov
cb92974914 Test for Rect2f in Python. 2024-01-25 18:35:03 +03:00
Alexander Smorkalov
69772b0260
Merge pull request #24873 from AleksandrPanov:fix_charuco_board
Fix generateImage for charuco chessboard
2024-01-23 15:33:56 +03:00
Alexander Smorkalov
48ba45f856
Merge pull request #24875 from tailsu:sd/jpeg-turbo-color-extensions
jpeg: use libjpeg-turbo built-in color conversions
2024-01-23 14:32:56 +03:00
AleksandrPanov
37c76b815c fix generate of charuco chessboard image, add test 2024-01-23 13:45:28 +03:00
Sean McBride
e64857c561
Merge pull request #23736 from seanm:c++11-simplifications
Removed all pre-C++11 code, workarounds, and branches #23736

This removes a bunch of pre-C++11 workrarounds that are no longer necessary as C++11 is now required.
It is a nice clean up and simplification.

* No longer unconditionally #include <array> in cvdef.h, include explicitly where needed
* Removed deprecated CV_NODISCARD, already unused in the codebase
* Removed some pre-C++11 workarounds, and simplified some backwards compat defines
* Removed CV_CXX_STD_ARRAY
* Removed CV_CXX_MOVE_SEMANTICS and CV_CXX_MOVE
* Removed all tests of CV_CXX11, now assume it's always true. This allowed removing a lot of dead code.
* Updated some documentation consequently.
* Removed all tests of CV_CXX11, now assume it's always true
* Fixed links.

---------

Co-authored-by: Maksim Shabunin <maksim.shabunin@gmail.com>
Co-authored-by: Alexander Smorkalov <alexander.smorkalov@xperience.ai>
2024-01-19 16:53:08 +03:00
Alexander Smorkalov
d066c44bce
Merge pull request #24841 from mshabunin:rvv-071-update
RISC-V: updated intrin_rvv071.hpp to work with modern toolchain 2.8.0
2024-01-19 08:11:08 +03:00
Alexander Smorkalov
62ef27ac1e
Merge pull request #24750 from YusukeKameda:4.x
Update applyColorMap document
2024-01-18 15:06:36 +03:00
Alexander Smorkalov
e56e500cd9
Merge pull request #24878 from TolyaTalamanov:at/g-api-ifdef-openvino-api10-backend
G-API: Ifdef OpenVINO API 1.0 functionality
2024-01-18 13:59:38 +03:00
Alexander Smorkalov
72f07170f3
Merge pull request #24868 from zchrissirhcz:fix-qnx-sdp-700-build
fix qnx-sdp-700 build
2024-01-18 11:10:42 +03:00
fengyuentau
d269de0a03 initial commit 2024-01-18 11:17:50 +08:00
alexlyulkov
bfad61f433
Merge pull request #24869 from alexlyulkov:al/android-camera-view-rotate
Added screen rotation support to JavaCamera2View amd NativeCameraView. Fixed JavaCamera2View initialization. #24869

Added automatic image rotation to JavaCamera2View and NativeCameraView so the video preview was matched with screen orientation.
Fixed double preview initialization bug in JavaCamera2View.
Added proper cameraID parsing to NativeCameraView similar to JavaCameraView

### 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-01-17 21:35:35 +03:00
Alexander Smorkalov
d1e4bd8543
Merge pull request #24809 from Abdurrahheem:ash/yolo-nas-test
Added test for YOLO NAS
2024-01-17 20:36:15 +03:00
Maksim Shabunin
6b77f50269 RISC-V: use non-saturating 64-bit add in intrin_rvv071.hpp 2024-01-17 20:34:12 +03:00
Maksim Shabunin
224b9ee33f RISC-V: updated intrin_rvv071.hpp to work with modern toolchain 2.8.0
- intrinsics implementation (071) reworked to use modern RVV intrinsics syntax
- cmake toolchain file (071) now allows selecting from predefined configurations

Co-authored-by: Fang Sun <fangsun@linux.alibaba.com>
2024-01-17 20:34:12 +03:00
Alexander Smorkalov
ac4c0bffac
Merge pull request #24813 from fengyuentau:speedup_scatter
dnn: improve scatter and scatterND speed with multi-threading
2024-01-17 17:16:50 +03:00
Zhuo Zhang
37b02d170f fix qnx-sdp-700 build
based on https://github.com/opencv/opencv/pull/24864
2024-01-17 21:49:13 +08:00
TolyaTalamanov
8ba69562b5 Ifdef OpenVINO API 1.0 usage in G-API module 2024-01-17 13:28:53 +00:00