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

25665 Commits

Author SHA1 Message Date
Adrian Kretz
29d68af2a8 Use Mat::total() in Darknet IO 2026-01-10 16:39:44 +01:00
Alexander Smorkalov
d8bc5b94b8 Merge pull request #28373 from vrabaud:lsh
Fix potential pointer overflow in BlockSum
2026-01-07 11:04:35 +03:00
Alexander Smorkalov
481ebe0ac0 Merge pull request #28371 from WalkingDevFlag:fix/copyTo-empty-fixed-type-28343
Fix copyTo on empty fixed-type matrices (#28343)
2026-01-07 11:04:05 +03:00
Vincent Rabaud
b7efc11b51 Merge pull request #28361 from vrabaud:msan
Prevent a potential crash in FMEstimatorCallback::runKernel #28361
 
With solveCubic sometimes failing, n can be -1.

### 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
2026-01-06 11:07:19 +03:00
Alexander Smorkalov
b227993ad5 Merge pull request #28372 from amd:RaceConditionFix
Issue Fix: Race condition in GaussianBlurFixedPoint
2026-01-06 11:05:50 +03:00
Vincent Rabaud
e9c6cb98ea Fix potential pointer overflow.
srcY-roi.y is promoted to size_t which creates problems when it is
negative.
2026-01-06 01:18:54 +01:00
WalkingDevFlag
175dd57bdd Fix copyTo on empty fixed-type matrices (#28343)
PR #27972 added _dst.create(size(), type()) in copyTo's empty() block.
In Debug builds, Mat::release() was resetting flags to MAGIC_VAL,
clearing the type information and causing assertion failures when
destination has fixedType().

Preserve type flags in Mat::release() debug mode by using:
  flags = (flags & CV_MAT_TYPE_MASK) | MAGIC_VAL

Thanks to @akretz for suggesting this better approach.
2026-01-06 00:51:06 +05:30
Madan mohan Manokar
abd0eb94f6 Fixes Issue: Race condition in GaussianBlurFixedPoint #28370 2026-01-05 18:24:27 +00:00
Vincent Rabaud
5622958189 Replace pow with std::pow
The C pow casts to double while std::pow has overloads that can be
optimized by the compiler.
Also replace pow(*, 1./3) by cbrt.
2026-01-04 15:12:59 +01:00
Alexander Smorkalov
f8c04bafa8 Typing fix in tests for modern Numpy 2026-01-02 16:30:28 +03:00
Mark Harfouche
13c8ec3aa9 Fix macro definition for Power10 architecture 2026-01-01 20:37:01 -05:00
Alexander Smorkalov
3c34e42209 Merge branch 'as/release_4.13.0' into 4.x 2025-12-30 21:56:39 +03:00
Alexander Smorkalov
fe38fc608f release: OpenCV 4.13.0 2025-12-30 10:52:05 +03:00
Alexander Smorkalov
f9c2961411 Define installation layout for Python standalone builds. 2025-12-29 15:01:07 +03:00
Alexander Smorkalov
2addae071e Fixed DLPack detection in Python standalone builds 2025-12-29 13:45:19 +03:00
Alexander Smorkalov
40ab411032 Merge pull request #28285 from akretz:fix_issue_28241
Fixed stack-use-after-scope errors in charuco detector
2025-12-27 18:17:58 +03:00
Kumataro
364f21fd24 docs(core): update Universal Intrinsics for VLA (RVV/SVE) and OpenCV 4.11+ API changes 2025-12-27 10:54:06 +09:00
Alexander Smorkalov
a49eb47057 Merge pull request #28306 from asmorkalov:as/ffmpeg_4.x_20251225
FFmpeg binaries update for Windows.
2025-12-27 00:41:19 +03:00
Alexander Smorkalov
b618676a53 Merge pull request #28311 from asmorkalov:as/ipp_compare_perf_regression
Disable IPP with AVX512 in cv::compare because of performance regression
2025-12-26 22:55:08 +03:00
0AnshuAditya0
5d5b5c14a9 Fix Qt HighGUI lifecycle issue when external QApplication exists
Respect QApplication::quitOnLastWindowClosed() before calling qApp->quit().
This prevents OpenCV from unintentionally terminating externally managed
Qt applications when the last HighGUI window is closed.

Fixes #28291
2025-12-26 13:36:17 +05:30
Alexander Smorkalov
497e9037b4 FFmpeg binaries update for Windows. 2025-12-26 10:52:37 +03:00
Alexander Smorkalov
2b1cf03a9d Disable IPP with AVX512 in cv::compare because of performance regression. 2025-12-26 09:19:28 +03:00
Alexander Smorkalov
cff7581175 Merge pull request #28304 from raimbekovm:fix-typos-batch5
docs: fix spelling errors
2025-12-25 17:55:20 +03:00
Alexander Smorkalov
459a609271 Merge pull request #28283 from asmorkalov:as/ffmpeg_picture_leak
Fixed picture_sw object leak in ffmpeg backend with hardware codecs. #28283

Replacement for https://github.com/opencv/opencv/pull/28221

### 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-25 15:43:38 +03:00
raimbekovm
a41857f3c2 docs: fix spelling errors
- 'tirangle' -> 'triangle'
- 'cirlce' -> 'circle'
- 'gradiantSize' -> 'gradientSize'
- 'unnotied' -> 'unnoticed'
- 'consistensy' -> 'consistency'
- 'implemention' -> 'implementation'
- 'suppported/Unsuppported/suppport' -> 'supported/Unsupported/support'
2025-12-25 15:45:08 +06:00
Alexander Smorkalov
c1c893ff73 Merge pull request #28299 from AsyaPronina:rename_workload_type_notify
[G-API] Renamed `WorkloadType::notify()` -> `WorkloadType::set()`
2025-12-25 11:59:05 +03:00
raimbekovm
229941f6a2 docs: fix spelling errors in documentation and comments
- Fixed 'arrray' -> 'array' in calib3d.hpp
- Fixed 'varaible' -> 'variable' in matmul_layer.cpp
- Fixed 'PreprocesingEngine' -> 'PreprocessingEngine' in onevpl sample
- Fixed 'convertion/convertions' -> 'conversion/conversions' in quaternion.hpp, grfmt_tiff.cpp, nary_eltwise_layers.cpp, instance_norm_layer.cpp
2025-12-25 11:48:31 +06:00
Alexander Smorkalov
5c1737e0dc Merge pull request #28297 from raimbekovm:fix-documentation-typos
docs: fix typos in documentation
2025-12-25 08:35:19 +03:00
Anastasiya Pronina
e16fbb392c [G-API] Renamed WorkloadType::notify() -> WorkloadType::set() 2025-12-24 22:44:54 +00:00
raimbekovm
17a01d687c docs: fix spelling errors in documentation
- Fixed 'reinitalized' -> 'reinitialized' in background_segm.hpp
- Fixed 'dimentions/dimentional/dimentinal' -> 'dimensions/dimensional' in mat.hpp, imgproc.hpp, gmat.hpp, recurrent_layers.cpp
- Fixed 'tresholded' -> 'thresholded' in aruco_detector.cpp
2025-12-24 22:37:09 +06:00
raimbekovm
2fb95415dd Fix typos in documentation: 'algorighm' -> 'algorithm', 'necesary' -> 'necessary' 2025-12-24 22:11:28 +06:00
Alexander Smorkalov
3e89c3e26f Merge pull request #28287 from asmorkalov:update_version_4.13.0-pre
pre: OpenCV 4.13.0 (version++)
2025-12-24 11:18:20 +03:00
Alexander Smorkalov
73737bb3f1 Merge pull request #28286 from asmorkalov:as/warning_fix_win32
Warning fix on Windows.
2025-12-23 21:58:11 +03:00
Dheeraj Alamuri
d3c539bf71 Merge pull request #28227 from dheeraj25406:docs-moments-degenerate
docs(imgproc): clarify cv::moments behavior for degenerate contours #28227

relates to https://github.com/opencv/opencv/issues/28222
Clarifies that for degenerate contours (single point or collinear points),
cv::moments() returns m00 == 0 and centroid is undefined.
Documents common workarounds such as boundingRect center or point averaging.
2025-12-23 20:53:43 +03:00
Alexander Smorkalov
e63d2a12f0 pre: OpenCV 4.13.0 (version++). 2025-12-23 18:31:50 +03:00
Alexander Smorkalov
a1b682254e Warning fix on Windows. 2025-12-23 18:25:26 +03:00
Adrian Kretz
54fc9dce0b Guarantee temporary object lifetime extension 2025-12-23 15:54:37 +01:00
Alexander Smorkalov
4705320496 Merge pull request #28239 from AdwaithBatchu:optimize-stitching-allocations
optimize: replace push_back with emplace_back in core loops
2025-12-23 15:05:35 +03:00
Alexander Smorkalov
81893fac24 Merge pull request #28282 from abhishek-gola:conv_kernel_size_fix
Support Conv kernel inference from initializer weights
2025-12-23 15:04:51 +03:00
Shruti Arsode
7e66c0504a Merge pull request #28275 from Shruti192903:docs/simpleblobdetector-api
docs(features2d): document getBlobContours and collectContours in SimpleBlobDetector #28275

Description: This PR adds missing Doxygen documentation for the getBlobContours() method and the collectContours parameter in SimpleBlobDetector. These features were previously undocumented, making the contour collection functionality difficult for users to discover and use correctly.

Changes:
Added a @brief and detailed note for SimpleBlobDetector::Params::collectContours.
Added documentation for SimpleBlobDetector::getBlobContours(), including a @note regarding the required parameter setup.

Testing:
Verified the documentation build locally on macOS using ninja opencv_docs.
Confirmed the generated HTML displays the descriptions and cross-references accurately.

Partially fixes: #25904
Related PR that adds method: https://github.com/opencv/opencv/pull/21942

### 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-23 15:03:57 +03:00
Vadim Pisarevsky
eaccbe24b2 Merge pull request #28242 from vpisarev:fix_input_array_std_vector
modified Input/OutputArray methods to handle 'std::vector<T>' or 'std::vector<std::vector<T>>' properly #28242

This is port of #26408 with some further improvements (all switch-by-vector-type statements are consolidated in a single macro)

### 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-23 14:25:07 +03:00
Abhishek Gola
2bce8e6a46 Added conv kernel size 2025-12-23 13:49:07 +05:30
Alexander Smorkalov
031e7de85c Merge pull request #28272 from abhishek-gola:heap_overflow_fix
Fixed heap-buffer-overflow in DNN NaryEltwiseLayer
2025-12-23 08:52:16 +03:00
fcmiron
ad9387340a Merge pull request #27460 from fcmiron:gapi_set_workloadtype_dynamically
G-API: Add support to set workload type dynamically in both OpenVINO and ONNX OVEP #27460

### 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-22 21:04:53 +03:00
Jonas Perolini
2bca09a191 Merge pull request #23190 from JonasPerolini:pr-output-marker-score
Include pixel-based confidence in ArUco marker detection #23190

The aim of this pull request is to compute a **pixel-based confidence** of the marker detection. The confidence [0;1] is defined as the percentage of correctly detected pixels, with 1 describing a pixel perfect detection. Currently it is possible to get the normalized Hamming distance between the detected marker and the dictionary ground truth [Dictionary::getDistanceToId()](https://github.com/opencv/opencv/blob/4.x/modules/objdetect/src/aruco/aruco_dictionary.cpp#L114) However, this distance is based on the extracted bits and we lose information in the [majority count step](https://github.com/opencv/opencv/blob/4.x/modules/objdetect/src/aruco/aruco_detector.cpp#L487). For example, even if each cell has 49% incorrect pixels, we still obtain a perfect Hamming distance.

**Implementation tests**: Generate 36 synthetic images containing 4 markers each (with different ids) so a total of 144 markers. Invert a given percentage of pixels in each cell of the marker to simulate uncertain detection. Assuming a perfect detection, define the ground truth uncertainty as the percentage of inverted pixels. The test is passed if `abs(computedConfidece - groundTruthConfidence) < 0.05` where `0.05` accounts for minor detection inaccuracies.

- Performed for both regular and inverted markers
- Included perspective-distorted markers
- Markers in all 4 possible rotations [0, 90, 180, 270]
- Different set of detection params:
    - `perspectiveRemovePixelPerCell`
    - `perspectiveRemoveIgnoredMarginPerCell`
    - `markerBorderBits`

![TestCases](https://github.com/user-attachments/assets/1113abd3-ff7a-45c8-8b4b-a9d2182eda82)


The code properly builds locally and `opencv_test_objdetect` and `opencv_test_core` passed. Please let me know if there are any further modifications needed. 

Thanks!


I've also pushed minor unrelated improvement (let me know if you want a separate PR) in the [bit extraction method](https://github.com/opencv/opencv/blob/4.x/modules/objdetect/src/aruco/aruco_detector.cpp#L435). `CV_Assert(perspectiveRemoveIgnoredMarginPerCell <=1)` should be `< 0.5`. Since there are margins on both sides of the cell, the margins must be smaller than half of the cell. When setting `perspectiveRemoveIgnoredMarginPerCell >= 0.5`, `opencv_test_objdetect` fails. Note: 0.499 is ok because `int()` will floor the result, thus `cellMarginPixels = int(cellMarginRate * cellSize)` will be smaller than `cellSize / 2`



### Pull Request Readiness Checklist

- [x] I agree to contribute to the project under Apache 2 License.
- [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
- [ ] 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 PR is proposed to the proper branch
- [x] The feature is well documented and sample code can be built with the project CMake
2025-12-22 20:54:40 +03:00
Abhishek Shinde
ea9b183d9b Merge pull request #28259 from falloficarus22:fix/bilateral-filter-oob
Fix the out-of-bounds read in cv::bilateralFilter for 32f images #28259

### Root Cause Analysis

The issue was caused by a discrepancy between the image range used to allocate the color weight look-up table (LUT) and the actual range of pixel values encountered during filtering, especially near the image borders.

- Range Computation: `cv::bilateralFilter` computes the min/max values of the source image and allocates a `LUT (expLUT)` of size `kExpNumBins + 2` based on this range.
- Border Padding: If `cv::BORDER_CONSTANT` is used (defaulting to 0), and 0 is outside the image's original range (e.g., an image with values between 100 and 200), the padded image will contain values (0) that create differences larger than those accounted for in the `LUT`.
- Out-of-Bounds Access: When calculating the color weight, the code computes an index `idx` from the absolute difference. If this difference exceeds the expected range, `idx` can reach or exceed `kExpNumBins + 1`. Since the code performs linear interpolation using `expLUT[idx]` and `expLUT[idx + 1]`, an `idx` of `kExpNumBins + 1` causes an access to `expLUT[kExpNumBins + 2]`, which is out of bounds.

### Fix

I implemented a robust clamping mechanism in both the SIMD (AVX/SSE) and scalar paths of the bilateral filter invoker:

- Signature Update: Updated `bilateralFilterInvoker_32f` to accept `kExpNumBins` (the maximum valid `LUT` index).
- Clamping: Clamped the computed color difference (alpha) to `kExpNumBins` before calculating the `LUT` index. This ensures that any difference exceeding the planned range is safely treated as the maximum difference in the `LUT` (which usually corresponds to a weight of 0), avoiding any out-of-bounds memory access.

### Modified Files

Modified Files:
`modules/imgproc/src/bilateral_filter.simd.hpp`: Updated the invoker class and SIMD/scalar loops to clamp the LUT index.
`modules/imgproc/src/bilateral_filter.dispatch.cpp`: Updated the dispatch call site to pass the correct LUT size.

Closes #28254 

### Pull Request Readiness Checklist

- [x] I agree to contribute to the project under Apache 2 License.
- [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
- [x] The PR is proposed to the proper branch
- [x] There is a reference to the original bug report and related work
- [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-22 20:41:58 +03:00
Abhishek Gola
f86bdfcff4 fixed heap buffer overflow issue 2025-12-22 17:19:32 +05:30
Alexander Smorkalov
165b464cff Merge pull request #28216 from happy-capybara-man:4.x
js: restore deep copy behavior for Mat.clone() #28216

### Problem
In OpenCV.js, `cv.Mat.clone()` may resolve to Embind `ClassHandle.clone()` (handle/shallow clone) instead of OpenCV deep copy.

### Changes
- modules/js/src/helpers.js: override `cv.Mat.prototype.clone` -> `mat_clone` after runtime init
- modules/js/test/test_mat.js: update/extend tests to validate deep copy semantics of `clone()`

Fixes  #27572
Related: PR #26643 (js_clone_fix), PR #27985 (documentation update)

### Verification
- Built OpenCV.js with Emscripten 2.0.10
- QUnit: bin/tests.html
- CoreMat: test_mat_creation (0 failures)
<img width="745" height="362" alt="clone_fix" src="https://github.com/user-attachments/assets/16399abf-b94c-4591-b4aa-6e0fbd6cf23b" />

### 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
2025-12-22 14:30:10 +03:00
satyam yadav
15fe69b5af Merge pull request #28250 from satyam102006:fix/stackblur-overflow-28233
imgproc: fix heap-buffer-overflow in stackBlur #28233 #28250

### Summary
Fixes a heap-buffer-overflow in `cv::stackBlur` when the kernel size is larger than the image dimensions 
### Changes
* Added input validation to clamp the kernel size to the image dimensions.
* Added a regression test (`regression_28233`) covering 1x1 and small image cases.

Fixes #28233
2025-12-22 11:22:12 +03:00
Alexander Smorkalov
a66443fdc2 Merge pull request #28265 from shahkarnav115-beep:dnn-blobfromimages-umat-error
dnn: add error message for unimplemented UMat NCHW blob conversion
2025-12-22 11:04:31 +03:00