0
0
mirror of https://github.com/opencv/opencv.git synced 2026-01-18 17:21:42 +01:00

35924 Commits

Author SHA1 Message Date
satyam yadav
dbe11a4d1c Update cap_dshow.cpp 2025-12-16 23:46:29 +05:30
Alexander Smorkalov
e4d294d018 Merge pull request #28196 from vrabaud:msan
Prevent integer overflow in dimension checks.
2025-12-16 20:47:06 +03:00
Alexander Smorkalov
9f1a2d3736 Fixes for issues found by PVS Studio. 2025-12-16 18:34:20 +03:00
Alexander Smorkalov
2a29d87e1d Merge pull request #28137 from Ghazi-raad:fix/null-pointer-gapi-state-28095-v2
Fix null pointer dereference in G-API stateful kernels
2025-12-16 15:17:58 +03:00
Vincent Rabaud
5c6c584c01 Prevent integer overflow in dimension checks.
This fixes https://g-issues.oss-fuzz.com/issues/446726230
2025-12-16 13:09:31 +01:00
Alexander Smorkalov
c03734475f Merge pull request #28159 from asmorkalov:as/java_cleaners
Introduce option to generate Java code with finalize() or Cleaners interface #28159
 
Closes https://github.com/opencv/opencv/issues/22260
Replaces https://github.com/opencv/opencv/pull/23467

The PR introduce configuration option to generate Java code with Cleaner interface for Java 9+ and old-fashion finalize() method for old Java and Android. Mat class and derivatives are manually written. The PR introduce 2 base classes for it depending on the generator configuration.

Pros:
1. No need to implement complex and error prone cleaner on library side.
2. No new CMake templates, easier to modify code in IDE.

Cons:
1. More generator branches and different code for modern desktop and Android.

TODO: 
- [x] Add Java version check to cmake
- [x] Use Cleaners for ANDROID API 33+

### 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
2025-12-16 14:21:34 +03:00
Alex
7ca9d9ce03 Merge pull request #27878 from 0lekW:ffmpeg-negative-dts-seeking-fix
Fix frame seeking with negative DTS values in FFMPEG backend #27878

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

Fixes https://github.com/opencv/opencv/issues/27819
Fixes https://github.com/opencv/opencv/issues/23472
Accompanied by PR on https://github.com/opencv/opencv_extra/pull/1289

The FFmpeg backend fails to correctly seek in H.264 videos that contain negative DTS values in their initial frames. This is a valid encoding practice used by modern video encoders (such as DaVinci Resolve's current export) where B-frame reordering causes the first few frames to have negative DTS values.

When picture_pts is unavailable (AV_NOPTS_VALUE), the code falls back to using pkt_dts:
`picture_pts = packet_raw.pts != AV_NOPTS_VALUE_ ? packet_raw.pts : packet_raw.dts;`

If this DTS value is negative (which is legal per H.264 spec), it propagates through the frame number calculation:
`frame_number = dts_to_frame_number(picture_pts) - first_frame_number;`

This results in negative frame numbers, messing up seeking operations.

Solution implemented in this branch is a timestamp normalization similar to FFmpegs -avoid_negative_ts_make_zero flag:
- Calculate a global offset once on the first decoded frame by getting the minimum timestamp in either:
    - Container start_time
    - Stream start_time
    - First observed timestamp (PTS, then DTS).
- Apply the offset consistently to all timestamps, shifting negative values to begin at 0 while keeping relative timing.
- Simplify timestamp converters to remove `start_time` subtractions since timestamps are pre-normalized.

This also includes a new test `videoio_ffmpeg.seek_with_negative_dts`
This test verifies that seeking behavior performs as expected on a file which has negative DTS values in the first frames. 
A PR on opencv_extra accompanies this one with that testing file: https://github.com/opencv/opencv_extra/pull/1279

```
opencv_extra=ffmpeg-videoio-negative-dts-test-data
```

<cut/>

### Pull Request Readiness Checklist

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

- [x] I agree to contribute to the project under Apache 2 License.
- [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
- [x] The PR is proposed to the proper branch
- [x] There is a reference to the original bug report and related work
- [ ] There is accuracy test, performance test and test data in opencv_extra repository, if applicable
      Patch to opencv_extra has the same branch name.
- [x] The feature is well documented and sample code can be built with the project CMake
2025-12-16 11:38:51 +03:00
Abhishek Gola
33ebceddb2 Merge pull request #28168 from abhishek-gola:mergeDebevec_fix
Added 16U and 32F support in merge functions in photo module #28168

closes: https://github.com/opencv/opencv/issues/27873
### 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
2025-12-16 10:45:19 +03:00
Kumataro
9c48c69c8a Merge pull request #28179 from Kumataro:fix28178
js: add C++17 requirement check for Emscripten 4.0.20+ #28179
 
Close https://github.com/opencv/opencv/issues/28178

### Pull Request Readiness Checklist

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

- [x] I agree to contribute to the project under Apache 2 License.
- [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
- [x] The PR is proposed to the proper branch
- [x] There is a reference to the original bug report and related work
- [ ] There is accuracy test, performance test and test data in opencv_extra repository, if applicable
      Patch to opencv_extra has the same branch name.
- [x] The feature is well documented and sample code can be built with the project CMake
2025-12-16 10:41:43 +03:00
Alexander Smorkalov
fdb1ad3aa4 Merge pull request #28156 from asmorkalov:as/cuda_bufferpool_raise
Enabled Python test for CUDA BufferPool.
2025-12-16 10:37:50 +03:00
Alexander Smorkalov
75ede342cf Merge pull request #28186 from shahkarnav115-beep:fix-stitching-argparse-safety
samples(python): fix argparse boolean flag for --try_cuda
2025-12-16 10:22:19 +03:00
Alexander Smorkalov
507a0a6c5a Merge pull request #28192 from shahkarnav115-beep:fix-sample-launcher-selection
Fix crash in sample launcher when no item is selected
2025-12-16 10:21:54 +03:00
Karnav Shah
4e2c39b1a0 Fix crash in sample launcher when no item is selected 2025-12-16 11:30:55 +05:30
Alexander Smorkalov
7291f638b6 Merge pull request #28182 from shahkarnav115-beep:samples-guard-stft-timestep
samples(python): guard against invalid STFT time step
2025-12-15 19:26:01 +03:00
pratham-mcw
ddf2863aaa NEON: fix incorrect accumulation in v_dotprod_expand_fast 2025-12-15 21:29:10 +05:30
Karnav Shah
1eb1157490 samples(python): fix argparse boolean flag for --try_cuda 2025-12-15 15:53:04 +05:30
Karnav Shah
9a7e88eb3e samples(python): guard against invalid STFT time step 2025-12-15 15:04:10 +05:30
Yuantao Feng
912d27a7b7 Merge pull request #28180 from fengyuentau:rvv_hal/flip
rvv_hal: fix flip inplace #28180

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

### 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
2025-12-15 10:51:48 +03:00
Karnav Shah
f5d6fe5392 Merge pull request #28176 from shahkarnav115-beep:docs-animation-frame-duration
Docs(imgcodecs): clarify animation frame duration units #28176

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

Docs-only change. No code or tests affected.
2025-12-15 09:24:58 +03:00
satyam yadav
748d654535 Merge pull request #28173 from satyam102006:fix/issue-28165-videoio-ios-crash
videoio(ios): fix NSInvalidArgumentException in VideoWriter release #28173

Summary
Fixes a crash on iOS when calling `VideoWriter::release()` in OpenCV 4.12.0.

Issue
Fixes #28165

Detailed Description
This PR resolves a regression where an `NSInvalidArgumentException` was thrown with the message ` -[NSAutoreleasePool retain]: Cannot retain an autorelease pool`.

The crash was caused by the manual usage of `NSAutoreleasePool` in the `~CvVideoWriter_AVFoundation` destructor. The local pool variable was being captured by the completion handler block passed to `[mMovieWriter finishWritingWithCompletionHandler:]`. Since `NSAutoreleasePool` instances cannot be retained, capturing them in a block causes a crash.

Changes:
- Replaced manual `NSAutoreleasePool` allocation and draining with modern `@autoreleasepool` blocks in `CvVideoWriter_AVFoundation`.
- applied this modernization to the Constructor, Destructor, and `write` methods.
- Specifically in the destructor, an inner `@autoreleasepool` is now used inside the completion block, ensuring no pool object needs to be captured from the outer scope.
2025-12-14 15:25:52 +03:00
zdenyhraz
c5d70a7f22 Merge pull request #28146 from zdenyhraz:iterative-phase-correlation
Iterative Phase Correlation #28146

### 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
2025-12-13 12:45:05 +03:00
Alexander Smorkalov
3eb143cc22 Merge pull request #28139 from asmorkalov:as/webp_1.6.0
WebP update to version 1.6.0 #28139

### 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
2025-12-13 12:44:01 +03:00
Alexander Smorkalov
579dfb6e02 Merge pull request #27640 from asmorkalov:as/kleidicv_mac
Enable KleidiCV on Linux and Mac Mx by default #27640

OpenCV Extra: https://github.com/opencv/opencv_extra/pull/1296

### 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
2025-12-11 18:06:39 +03:00
Stefania Hergane
dee619b628 Merge pull request #28127 from StefaniaHergane:hs/deprecated_ov_element_undefined
Update deprecated ov::element::undefined #28127

### Summary
Fixing OpenCV build error below.
Relates to OpenVINO 2026.0 updates on `ov::element::undefined` (https://github.com/openvinotoolkit/openvino/pull/32573) - replaced by `ov::element::dynamic`.
```
/home/jenkins/agent/workspace/openVINO-builder/opencv_source/opencv-opencv-f627368/modules/gapi/src/backends/ov/govbackend.cpp
[2025-12-03T21:25:54.540Z] /home/jenkins/agent/workspace/openVINO-builder/opencv_source/opencv-opencv-f627368/modules/gapi/src/backends/ov/govbackend.cpp: In function ���ov::element::Type toOV(int)���:
[2025-12-03T21:25:54.540Z] /home/jenkins/agent/workspace/openVINO-builder/opencv_source/opencv-opencv-f627368/modules/gapi/src/backends/ov/govbackend.cpp:114:25: error: ���undefined��� is not a member of ���ov::element���
[2025-12-03T21:25:54.540Z]   114 |     return ov::element::undefined;
...
/home/jenkins/agent/workspace/openVINO-builder/opencv_source/opencv-opencv-f627368/modules/gapi/test/infer/gapi_infer_ov_tests.cpp
[2025-12-03T21:26:19.642Z] /home/jenkins/agent/workspace/openVINO-builder/opencv_source/opencv-opencv-f627368/modules/gapi/test/infer/gapi_infer_ov_tests.cpp: In function ���ov::element::Type opencv_test::toOV(int)���:
[2025-12-03T21:26:19.642Z] /home/jenkins/agent/workspace/openVINO-builder/opencv_source/opencv-opencv-f627368/modules/gapi/test/infer/gapi_infer_ov_tests.cpp:832:25: error: ���undefined��� is not a member of ���ov::element���
[2025-12-03T21:26:19.642Z]   832 |     return ov::element::undefined;
```

### 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
2025-12-10 17:48:35 +03:00
Dmitry Kurtaev
334b7146f5 Merge pull request #28157 from dkurt:normalize_vec_qrdetect
Remove floating point arithmetic from angle computation in QR codes #28157

### Pull Request Readiness Checklist

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

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

- [x] I agree to contribute to the project under Apache 2 License.
- [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
- [x] The PR is proposed to the proper branch
- [x] There is a reference to the original bug report and related work
- [ ] There is accuracy test, performance test and test data in opencv_extra repository, if applicable
      Patch to opencv_extra has the same branch name.
- [x] The feature is well documented and sample code can be built with the project CMake
2025-12-10 10:20:08 +03:00
Ghazi-raad
f704001eb7 Merge pull request #28120 from Ghazi-raad:test/line-connectivity-26413
Test: Add regression test for LINE_4 vs LINE_8 connectivity #28120 

Add test to verify correct behavior of LINE_4 (4-connected) and LINE_8 (8-connected) line drawing. This test ensures:

- LINE_4 produces staircase pattern (more pixels) for diagonal lines
- LINE_8 produces diagonal steps (fewer pixels)
- LINE_4 pixels have only horizontal/vertical neighbors (no diagonal-only)

Regression test for issue #26413 where LINE_4 and LINE_8 behaviors were swapped.
2025-12-09 15:59:24 +03:00
Skreg
2bf4f5c151 Merge pull request #26366 from shyama7004:fix-orb.cpp
Fix ORB inconsistency for masks with values 255 and 1. #26366

### Pull Request Readiness Checklist

The PR fixes : [25974](https://github.com/opencv/opencv/issues/25974)

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
2025-12-09 14:31:53 +03:00
Alexander Smorkalov
02628f0188 Enabled Python test for CUDA BufferPool. 2025-12-09 12:09:41 +03:00
Alexander Smorkalov
9a9ae12475 Merge pull request #28147 from asmorkalov:as/libpng_1.6.53
libpng update to version 1.6.53.
2025-12-09 12:07:24 +03:00
shubham khatri
498853d996 Merge pull request #28143 from Shubh3155:fix-js-ptr-factory-namespace
Fix JS bindings for namespaced Ptr factory return types #28143

This PR fixes an issue in the JS bindings generator for factory functions returning cv::Ptr<T> where T belongs to a namespaced class (for example cv::ximgproc::EdgeDrawing).
The generator previously produced unqualified C++ template arguments such as:
.constructor(select_overload<Ptr<EdgeDrawing>()>(&cv::ximgproc::createEdgeDrawing))

This results in invalid C++ because EdgeDrawing is not found in the global namespace.

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

In modules/js/generator/embindgen.py, inside both:

gen_function_binding_with_wrapper

gen_function_binding

a check is added:

When factory == True,

And the return type begins with Ptr<...>,

And the inner type is missing a namespace (::),
Ptr<T>  →  Ptr<class_info.cname>

This ensures the fully-qualified class name (e.g. cv::ximgproc::EdgeDrawing) is used in the generated bindings.

.constructor(select_overload<Ptr<cv::ximgproc::EdgeDrawing>()>(&cv::ximgproc::createEdgeDrawing))

Configured OpenCV with:
cmake .. -DBUILD_opencv_js=ON

Ran:
make -j gen_opencv_js_source

JS generator completed successfully without errors.

This change does not modify generated files directly — it modifies the generator logic so the correct namespace is applied automatically.
2025-12-09 12:05:55 +03:00
Alexander Smorkalov
0e2373557b Merge pull request #28119 from galinabykova:approxPolyDP_fix_distance_segment
fix bug in approxPolyDP: calculate distance to a segment, not to a straight line
2025-12-09 10:59:33 +03:00
Alexander Smorkalov
e345632aeb Merge pull request #28145 from ramukhsuya:fix-convert-rgb-docs
Docs: Fix CAP_PROP_CONVERT_RGB description to BGR (Fixes #22697)
2025-12-09 10:58:11 +03:00
Alexander Smorkalov
192f0d620e Merge pull request #28149 from vrabaud:rotacli
Increase minAreaRect accuracy
2025-12-09 10:30:07 +03:00
Alexander Smorkalov
5599da14f7 Merge pull request #28155 from vrabaud:msan
Disable MSAn for lapack_LU
2025-12-09 08:24:50 +03:00
Vincent Rabaud
01f2f3c4b9 Disable MSAn for lapack_LU
One of the arguments is sent to Fortran so the whole function has
to be disabled fro MSAN. Arguments cannot be unpoisoned, cf
https://g3doc.corp.google.com/testing/msan/g3doc/index.md?cl=head#memorysanitizer-api
2025-12-08 21:53:53 +01:00
Alexander Smorkalov
c25e48249f Merge pull request #28148 from vrabaud:windows
Add missing combaseapi.h include.
2025-12-08 18:07:50 +03:00
Alexander Smorkalov
1d5bf7a09c Merge pull request #28141 from asmorkalov:as/orbbec_diagnostics
Added Orbbec cameras support to CMake diagnostics.
2025-12-08 14:07:24 +03:00
Vincent Rabaud
4d7ce375fc Increase minAreaRect accuracy
Just keep doubles all the way and avoid arithmetic with CV_PI/2
2025-12-08 09:44:02 +01:00
Alexander Smorkalov
318e2e26bd Merge pull request #28134 from dg0yt:in-lists
Fix CMake foreach loops
2025-12-08 11:25:24 +03:00
Alexander Smorkalov
3574a2fe19 Merge pull request #28128 from asmorkalov:as/qt_unicode
Fixed unicode tracing symbols with QT
2025-12-08 10:58:15 +03:00
Vincent Rabaud
c6220c2b47 Add missing combaseapi.h include.
This is needed for CoCreateGuid.
2025-12-08 08:53:54 +01:00
Alexander Smorkalov
1288aace98 libpng update to version 1.6.53. 2025-12-08 10:34:20 +03:00
Alexander Smorkalov
bd54424f03 Merge pull request #28140 from asmorkalov:as/openjpeg_2.5.4
OpenJPEG update to 2.5.4 #28140

### 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
2025-12-08 08:59:51 +03:00
Alexander Smorkalov
fc6c6bf7de Merge pull request #28142 from parekh-parth2001:doc-imwrite-return
Document imwrite boolean return value
2025-12-08 08:56:41 +03:00
ramukhsuya
6460332780 Docs: Fix CAP_PROP_CONVERT_RGB description to BGR (Fixes #22697) 2025-12-07 19:35:25 +05:30
Alexander Smorkalov
927beeacf6 Merge pull request #28138 from Kumataro:trial26447
doc: add supported src type info for each ColorConversionCodes
2025-12-07 15:26:13 +03:00
Parth Parekh
201db16aa2 Document boolean return value of imwrite 2025-12-07 14:25:56 +05:30
Alexander Smorkalov
7a1425ca2c Added Orbbec cameras support to CMake diagnostics. 2025-12-07 11:38:29 +03:00
Alexander Smorkalov
55eb43fa28 Merge pull request #28131 from Kumataro:chore_libpng_1_6_52
chore: Synchronize 3rdparty libpng version to 1.6.52 in README/CHANGES
2025-12-07 10:13:20 +03:00
Kumataro
7971cbc7d0 doc: add supported src type info for each ColorConversionCodes 2025-12-07 00:33:02 +09:00