Commit Graph

27807 Commits

Author SHA1 Message Date
Abhishek Gola
93ced79e0b Merge pull request #31249 from sshivensolanki/dnn-hardmax-stale-axis
Problem
Hardmax::forward wrote the normalized axis back into the axis attribute, so a later input of a different rank used the stale index: the wrong axis for higher rank, an assertion for lower rank.

Fix
Store the result of normalize_axis in a local normAxis and pass it to hardmaxApply. The axis attribute keeps the value from the model.
2026-11-30 09:42:49 +05:30
Abhishek Gola
35b5ce1563 Merge pull request #31230 from ChandraguptSharma07/fix-mat-scalar-fill
Sped up uniform 8-bit fills in Mat::setTo
2026-11-29 23:21:47 +05:30
Shiven Solanki
b946499f3b dnn: keep the Hardmax axis attribute unchanged in forward 2026-11-29 23:00:07 +08:00
abhishek-gola
7aae1af9bd dnn: avoid unsafe fork fallback in NonZero death test 2026-11-29 12:13:08 +05:30
Abhishek Gola
7236b399b8 Merge pull request #31207 from lingyicute/5.x
geometry: don't overwrite custom model constraints in SACSegmentation…
2026-11-29 12:08:31 +05:30
ChandraguptSharma07
c2296fcb84 Sped up uniform 8-bit fills in Mat::setTo 2026-11-29 00:42:00 +05:30
Abhishek Gola
c685c9a222 Merge pull request #31206 from poojithparchuri-iiitk/qr-encoder-validate-5x
objdetect: forward-port QR encoder parameter validation
2026-11-28 20:16:34 +05:30
Abhishek Gola
9aa8cebea9 Merge pull request #31204 from poojithparchuri-iiitk/clahe-tile-grid-5x
imgproc: forward-port CLAHE tile grid check
2026-11-28 20:15:53 +05:30
Abhishek Gola
5d4d13b610 Merge pull request #31203 from poojithparchuri-iiitk/hough-circles-nan-5x
imgproc: forward-port NaN argument checks in HoughCircles
2026-11-28 19:26:13 +05:30
lingyicute
9012ae4aa3 geometry: don't overwrite custom model constraints in SACSegmentation::segment
Signed-off-by: lingyicute <xlyxinglinyi@gmail.com>
2026-11-28 13:32:55 +00:00
Parchuri Poojith Kumar
aa49235f97 objdetect: validate the QR encoder version and correction level
QRCodeEncoder::create accepted any version and any correction level, and a version outside of [0, 40] or an unknown level made the encoder read or write out of range. Check the version with CV_CheckGE and CV_CheckLE and the level with CV_Check in the constructor, so that the encoder raises an error. This is the same change and the same tests as #31042 on 4.x.
2026-11-28 18:51:48 +05:30
Abhishek Gola
349eca0280 Merge pull request #31192 from Prasadayus/octree_test_rng_seed
ptcloud: make OctreeTest independent of test execution order
2026-11-28 18:11:59 +05:30
Abhishek Gola
10c5b1f5d3 dnn(onnx): add ONNX TensorScatter operator (opset 24) (#30641)
- Implement TensorScatterLayer supporting linear and circular modes along specified axis

- Register TensorScatter in LayerFactory and ONNX importer

- Copy contiguous slice blocks per outer row with std::memcpy, bounded chunking, and nstripes tuning

- Un-denylist 3 official ONNX conformance tests and shield OpenVINO backend

- Add dedicated unit tests for circular wrapping, default indices, int64 bounds, zero-work domains, and chunk scheduling
2026-11-28 16:54:55 +05:30
Shiven Solanki
8bf44dcd8b Merge pull request #31201 from sshivensolanki/dnn-onnx-denylist-cleanup
dnn: remove passing tests from ONNX conformance parser denylist
2026-11-28 16:52:30 +05:30
Abhishek Gola
18f6b8c0ab Merge pull request #31199 from sshivensolanki/dnn-relu-int
dnn: support integer inputs in ONNX Relu
2026-11-28 16:52:18 +05:30
Parchuri Poojith Kumar
6ac0779a99 imgproc: reject a CLAHE tile grid without tiles
createCLAHE and setTilesGridSize accepted a tile grid with a zero in it, and CLAHE_Impl::apply then divided by the number of tiles, which crashed. Check that both numbers of tiles are positive in apply, after the type check. This is the same change and the same test as #31109 on 4.x, in test_histograms.cpp because 5.x has no test_clahe.cpp.
2026-11-28 15:10:11 +05:30
Parchuri Poojith Kumar
78294236b9 imgproc: reject NaN arguments in HoughCircles
A NaN is false for every comparison in dp <= 0, minDist <= 0, param1 <= 0, param2 <= 0 and param2 >= 1, so it passed all of them, and a NaN dp with HOUGH_GRADIENT_ALT ended in a segmentation fault. Write the checks as !(x > 0) and !(param2 < 1), so that NaN is rejected as well. This is the same change and the same test as #31100 on 4.x.
2026-11-28 14:51:55 +05:30
Tushar Burla
da45186698 dnn(onnx): add ONNX TensorScatter operator (opset 24)
- Implement TensorScatterLayer supporting linear and circular modes along specified axis

- Register TensorScatter in LayerFactory and ONNX importer

- Copy contiguous slice blocks per outer row with std::memcpy, bounded chunking, and nstripes tuning

- Un-denylist 3 official ONNX conformance tests and shield OpenVINO backend

- Add dedicated unit tests for circular wrapping, default indices, int64 bounds, zero-work domains, and chunk scheduling
2026-11-28 14:43:23 +05:30
Abhishek Gola
e7c1bd5849 imgproc: forward-port large-aperture medianBlur for more channels (#31031)
Port the per-plane fallback from opencv/opencv#29638 by Aaron. Add 5.x
coverage for strided ROIs and in-place output.
2026-11-28 12:58:16 +05:30
Shiven Solanki
fef8f32589 dnn: support integer inputs in ONNX Relu 2026-11-28 14:01:14 +08:00
Madan mohan Manokar
a03b821bba Merge pull request #31180 from amd/5x_port_boxfilter
Key changes

Fused row+column filter: box filters with 3x3 or 5x5 kernels run in one pass with no intermediate row buffer. Large images are split into row bands that run in parallel.
Float accuracy: 32F and 64F kernels up to 5x5 use blockSum, which accumulates in double. Fused float kernels are removed. Results now match pre-Optimized Blur and Box filters by implementing a combined row-and-column separable approach #28224 4.x, and cancellation works ([1e8, 1, -1e8] gives 3).
Bug fixes: in-place boxFilter on ROIs, and a false src/dst overlap check.
2026-11-27 18:56:31 +05:30
Prasadayus
7a535e81be seed theRNG in OctreeTest::SetUp so the fixture is order-independent 2026-11-27 18:34:39 +05:30
Abhishek Gola
2ca6076273 Merge pull request #31026 from ternaus/codex/forward-port-area-resize-channels
imgproc: forward-port C>4 fractional INTER_AREA resize 🤖🤖🤖
2026-11-27 15:32:54 +05:30
Abhishek Gola
2b33bdac61 dnn: return all false in IsInf when both detect flags are 0 (#31171)
Problem
IsInf threw "Unsupported mode" when detect_positive and detect_negative were both 0. ONNX expects an all-false output in that case.

Fix
Fill the output with zeros in that branch instead of calling CV_Error.
2026-11-27 13:22:49 +05:30
SWETANK KUMAR
9d8621c824 dnn: make ONNX Constant value_int and value_ints int64 (#31181)
* dnn: make ONNX Constant value_int and value_ints int64

The new engine created Constant nodes with a value_int or value_ints
attribute as CV_32S, but ONNX defines both attributes as int64. When such
a constant meets an int64 tensor in an elementwise op (e.g. Equal with a
Split of a shape), NaryEltwise fails with "All inputs should have equal
types". This broke the expanded AffineGrid conformance tests, which are
now enabled.

* dnn: skip the expanded AffineGrid conformance tests on OpenVINO
2026-11-27 13:21:31 +05:30
omrope79
75ab176045 Merge pull request #30440 from omrope79/arm-fastgemm
dnn: fastGemm NEON kernel for AArch64
2026-11-27 13:06:04 +05:30
Abhishek Gola
4075f24217 Merge pull request #31179 from sshivensolanki/dnn-resize-tfcrop-edge
Problem
Bilinear Resize2 in tf_crop_and_resize mode treated a sample that lands exactly on the last input pixel as out of bounds, so the last output row and column got extrapolation_value whenever the crop box reached the input edge.

Fix
Check the sample position src against [0, inLen - 1] instead of checking floor(src) >= inLen - 1, and cap the second neighbour i1 at inLen - 1 so the last pixel never reads past the row.
2026-11-27 12:53:47 +05:30
Abhishek Gola
9adaa7c853 video(test): revert OpenCL Farneback half-size crop (#31167)
Restore the full-frame input. The CPU-vs-OpenCL dissimilarity drops to ~0.004 (about 28× under the 0.1 bound) and all 24 cases pass.
Reproduced on an Apple Silicon (M5) OpenCL GPU.
2026-11-27 10:05:10 +05:30
Shiven Solanki
84f7fe9044 dnn: fix last row and column in bilinear tf_crop_and_resize 2026-11-27 12:21:35 +08:00
omrope79
fe96914443 dnn: early stop in NonMaxSuppression and bigger stripes for per-element layers (#31134)
* dnn: split per-element loops into ~64k-element stripes

* dnn: stop NonMaxSuppression once max_output_boxes_per_class boxes are kept
2026-11-27 00:10:29 +05:30
pranjal9091
2868492769 core: forbid trace and setIdentity for non-2D matrices (#30785)
* core: support 1D Mat in trace and setIdentity for non-float types

In OpenCV 5.x, 1D Mat support was introduced and cv::trace and
cv::setIdentity were updated with CV_Assert(m.dims <= 2). However,
both functions previously relied on m.diag() as the general fallback
path for non-float types (e.g. integer and multi-channel types).
Since Mat::diag strictly asserts dims == 2, calling cv::trace or
cv::setIdentity on a 1D non-float Mat resulted in an assertion failure
in Mat::diag.

Fix this by using m.col(0) when m.dims <= 1 (mirroring the behavior of
1xN 2D matrices), and gracefully handling empty matrices. Also add unit
tests covering 1D Mat across integral, floating point, and multi-channel
types for both cv::trace and cv::setIdentity.

* core: handle 0-D Mat in trace and setIdentity for non-float types

Properly handle 0-D matrices (scalars) in cv::trace using cv::sum(m)
and in cv::setIdentity using m = s without invoking m.col(0).
Also add unit tests for 0-D Mat covering integral, floating-point,
and multi-channel types.

* core: forbid trace and setIdentity for non-2D matrices
2026-11-26 18:00:46 +05:30
Shiven Solanki
ffcc3c5179 dnn: return all false in IsInf when both detect flags are 0 2026-11-26 20:19:11 +08:00
Abhishek Gola
371782f3c4 tests: enable disabled perf tests, remove orphaned ml perf files and unused test data generators (#30935)
* tests: re-enable and fix disabled perf tests, remove dead test code

Signed-off-by: abhishek-gola <abhishek@opencv.org>

* tests: drop OpticalFlowPyrLK_ovx, check RANSAC and multi-encode results, remove stale UPDATE_* hints

Signed-off-by: Abhishek Gola <abhishek.gola@bigvisionllc.com>

---------

Signed-off-by: abhishek-gola <abhishek@opencv.org>
Signed-off-by: Abhishek Gola <abhishek.gola@bigvisionllc.com>
2026-11-26 16:34:33 +05:30
Alexander Smorkalov
1a4423909c Merge pull request #31164 from sshivensolanki:dnn-maxunpool-pads
dnn: accept 4-value pads in ONNX MaxUnpool and read them as [H, W]
2026-11-26 13:22:00 +03:00
Varun Jaiswal
1864ba6aa3 video(test): revert OpenCL Farneback half-size crop 2026-11-26 14:17:06 +05:30
Abhishek Gola
17683cab81 fix phaseCorrelate origin for odd FFT sizes (#31160) 2026-11-26 13:50:45 +05:30
pbkx
a06a29dc41 dnn: fix NonZero output for grouped parallel ranges (#31009)
Incorrect prefix offsets can be generated when different partitions are used for counting and emission, leading to some coordinates being overwritten or not written at all. Despite this, the output shape remains correct.

Each logical stripe is counted independently. We have added a parameterized test for dense and sparse inputs. It covers three different counting partitions and tests that all coordinates are correctly generated in row-major order. The test also verifies that the output shape and type are correct, that output memory was reused and that input data was preserved.
2026-11-26 13:27:19 +05:30
Varun Jaiswal
a1b14ca7fe Merge pull request #30423 from varun-jaiswal17/dnn-fastgemm-threads
fastGemm optimizations and add flashattention without MLAS

fastGemm cuts every product into fixed tiles (60 × 320 on AVX/AVX2, from #23897) and runs one tile per parallel task. Transformer layers have few rows, so they make fewer tasks than there are threads. On a 32-thread CPU, a 50 × 3072 projection gives 10 tasks, and one attention MatMul of DeiT-Tiny (3 heads × 197 × 64 × 197) gives 12.
2026-11-26 13:00:18 +05:30
Shiven Solanki
dbaf062c67 dnn: accept 4-value pads in ONNX MaxUnpool and read them as [H, W] 2026-11-26 14:37:36 +08:00
Madan mohan Manokar
be44bb6112 Port 4.x faster bit-exact BGR(A)2GRAY on x86 AVX-512 to 5.x (#30962)
* imgproc: bit-exact BGR(A)2GRAY on AVX-512 (5.x)

Port of https://github.com/opencv/opencv/pull/29848.
5.x already dispatches color_rgb through AVX512_ICL, but the uchar RGB2Gray kernel was still the universal SIMD path. Use vpmaddwd for BGRA and vpermb+vpmaddwd for BGR, and keep that kernel as the fallback.

* imgproc: fix AVX-512 RGB2Gray tail for overlapping buffers (5.x)

Additional fixes.

- Take the AVX-512 kernels only when the source and destination byte ranges are disjoint. The clamped final block re-reads source pixels, and an overlapping store can overwrite them (src == dst, or a 1-channel dst that starts 1-3 bytes into the source). Those cases use the existing fallback.
- Use 'i <= n - 16' as the loop bound so the check cannot overflow for very large rows.
- Add exact integer-reference tests for CV_8UC4 BGRA2GRAY and RGBA2GRAY at widths 1-263 with random alpha, and aliased-storage tests at widths 15-33.

* imgproc: scalar tail for overlapping BGR(A)2GRAY buffers (5.x)

Rewinding the final vector block re-reads source pixels already overwritten when dst overlaps src. Use the scalar tail for overlapping buffers, and test widths 63-129 on both the dispatched and baseline paths.

* imgproc: tidy BGRA/RGBA2GRAY 4ch tests (5.x)

- Use the shared theRNG() instead of fixed seeds
- Reduce exact-check widths to 1, 16, 17, 263

* imgproc: drop BGRA/RGBA2GRAY 4ch tests (5.x)

- Existing BGRA2GRAY/RGBA2GRAY bit-exact tests already cover color conversion
- Remove the 4ch exact and aliased checks added in this branch

* imgproc: check buffer overlap once in RGB2Gray float/ushort (5.x)
2026-11-26 10:21:24 +05:30
Abhishek Gola
ca47dcf876 Merge pull request #31149 from Prasadayus/fix/filter-tile-nstripes-5x
imgproc: keep each thread's filter tiles contiguous
2026-11-26 10:18:21 +05:30
Abhishek Gola
307bb379c5 features: fix XFeat initialization with ORT engine (#31151) 2026-11-26 10:14:45 +05:30
pbkx
f0ca3b1a20 fix phaseCorrelate origin for odd FFT sizes 2026-11-25 10:47:29 -08:00
Hardik K
2d579693d8 Merge pull request #31148 from hardikkaurani/fix/flann-neon-hamming-tail-5x
flann: handle non-multiple of 16 vector sizes in NEON Hamming distance
2026-11-25 20:03:59 +05:30
Abhishek Gola
ba8003d9fe Merge pull request #31145 from Prasadayus/fix/ecc-stripe-accumulators-5x
video: fix false sharing in ECC multi-scale stripe accumulators
2026-11-25 18:45:15 +05:30
Alexander Smorkalov
d19330ddcc Android default updates to SDK 36 and NDK 30. (#31075)
Android default updates to SDK 36 and NDK 30. - #31075

CI: https://github.com/opencv/ci-gha-workflow/pull/365

### 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
2026-11-25 15:29:14 +03:00
saiAnderson
507e872bfb features: fix XFeat initialization with ORT engine 2026-11-25 19:47:30 +08:00
Abhishek Gola
e45cf0217a tests: reduce iterations, input sizes and perf grids of slow tests (#30844)
This cuts the runtime of slow accuracy and perf tests by giving them less work on the same code paths: fewer iterations, smaller inputs, and fewer perf parameter combinations that measure the same thing. The table lists every change and why the code path the test was written for is still exercised; most changes also carry a short comment in the code.
2026-11-25 17:05:19 +05:30
Abhishek Gola
72d9ae750b Merge pull request #30807 from lazerg/fix/issue-30790-solvecubic-double-root-5.x
core: fix solveCubic missing double roots after coefficient normalization (5.x)
2026-11-25 16:18:41 +05:30
Abhishek Gola
6767539300 features: check DNN output shapes in DISK, ALIKED and LightGlue (#31114)
DISK, ALIKED and the two LightGlueMatcher variants read the ONNX network outputs through raw pointers and Mat::at<> with the layout of the reference exports, but never check the shape or element type that the loaded model actually returned. Any model passed to DISK::create, ALIKED::create or LightGlueMatcher::create (file or buffer) reaches this code:

DISK::detectAndCompute reads kptsData[i * 2 + 1] for every row of keypoints without checking it has 2 columns.
ALIKEDImpl::runNetwork reads at<float>(i, 1) on keypoints and at<float>(i, 0) on scores without checking 2 columns or the float type.
ALIKEDLightGlueMatcherImpl::lightglueMatch reads at<int64_t>(i, 1) on matches0 and at<float>(i) on mscores0 for every match row without checking 2 columns, the int64 type or one score per match.
DISKLightGlueMatcherImpl::lightglueMatch already checks the element counts but reads at<int64_t>(i) on matches0 without checking the int64 type.
2026-11-25 16:10:43 +05:30