Commit Graph

27658 Commits

Author SHA1 Message Date
Shiven Solanki
1ae9b2b523 core: support 1D Mat in findNonZero
Fixes #30995
2026-11-20 14:37:51 +08:00
Abhishek Gola
4b0b7c6086 Merge pull request #30378 from kari-pikkarainen/fix/photo-debevec-gauge-row-5.x
photo: weight the CalibrateDebevec gauge equation like the data equations (5.x) 🤖🤖🤖

the CalibrateDebevec gauge equation g(128) = 0 is weighted with the hat weight of the middle value instead of 1, so the offset of the response curve no longer depends on float32 rounding in the solver. calibrate.cpp is identical on 4.x and 5.x.
2026-11-20 10:36:23 +05:30
Abhishek Gola
c8ef5d67e2 imgproc: enable medianBlur OpenCL path on all aligned 8UC1 images (5.x) (#30975)
Remove the Intel-only gate for medianFilter3_u/medianFilter5_u when cn==1 and dimensions meet the alignment requirements.

Port of https://github.com/opencv/opencv/pull/29803.
2026-11-20 10:35:24 +05:30
Abhishek Gola
ecd208bc9f Merge pull request #30976 from ternaus/codex/pow-zero-any-channel
core: fix pow with zero exponent on high-channel images 🤖🤖🤖

The zero-exponent branch of cv::pow fills the destination with a four-component Scalar. CPU outputs with more than four channels reject it. Use a single numeric input that broadcasts to every channel for this case. CUDA output continues through the four-component path required by its OutputArray implementation.

The 5.1 wheel reproduces the assertion for five and nine channels. A patched ARM64 Release core build passed a native 24-case check across Mat and UMat, CV_8U, CV_16F and CV_32F, and channels 1, 4, 5 and 9. Added a parameterized Core regression test.
2026-11-20 09:15:31 +05:30
Kari Pikkarainen
3d0d984fb4 photo: weight the CalibrateDebevec gauge equation like the data equations
The Debevec response curve g is defined only up to an additive constant,
which CalibrateDebevec fixes with one equation g(128) = 0 of weight 1
(as in Debevec and Malik's gsolve.m), while the data and smoothness
equations are weighted by the hat function (up to 127) and lambda times
it (up to 1270). The offset is therefore weakly constrained in the
float32 least-squares solve, and rounding differences between builds
shift the whole curve: depending on the build, response(128) is between
0.86 and 1.07 instead of 1. This is most likely the cause of the
intermittent Photo_CalibrateDebevec.regression failure on Windows x64
(0.2147 > 0.15, see #30063).

Weight the gauge equation with the hat weight of the middle value. The
exact least-squares solution is unchanged; the float32 result now
matches a float64 solve to 3e-4.

Add a test that the middle value is fixed and drop the ARM-only and
non-IPP relaxed thresholds of the regression test.

Photo_CalibrateDebevec.bug_24966 now prints max_diff 1.31 and 1.15 on
every build: the values of an exact float64 solve. The earlier,
build-dependent values (0.98 to 1.25) included the offset noise.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 08:42:45 +05:30
wzy712
0946969810 dnn: add ONNX ReverseSequence layer (#30591)
* dnn: add ONNX ReverseSequence layer

- new ReverseSequenceLayer: byte-wise block copy, works for any CV type and rank >= 2
- getTypes(): accept CV_16S as well, grouped by signed/unsigned/float families
- tests: CV_16S rank-2 / rank-3 block copy, both axis layouts, int32 sequence_lens,
  out-of-range sequence_lens must throw

# Conflicts:
#	modules/dnn/test/test_layers.cpp

* dnn: simplify ReverseSequence layer and tests

Parallelize over (batch, time) pairs, take byte strides from X.step, validate sequence_lens up front and drop the redundant type whitelist. Rework the layer test to check an independent reference implementation.

* dnn: reuse tensorToIntVec in ReverseSequence layer

Read sequence_lens through the shared helper and check its element count, so lengths are narrowed once. Compare the layer test against an index-based reference instead of duplicating the layer's stride computation.

* dnn: state supported opsets and skip ReverseSequence for OpenVINO

Drop the future-opsets claim in the layer header and mark the two conformance cases as skipped for the OpenVINO backend, following the Compress operator.

* dnn: add ReverseSequence to the ONNX importer dispatcher

Register an explicit parseReverseSequence() handler instead of relying on the generic custom-layer path. Drop the constant-only layer tests and fold the sequence_lens length check into the out-of-range test.
2026-11-20 08:41:11 +05:30
NIKHIL
ef0ee908a7 imgproc: fix stackBlur results on full-range 16-bit images (5.x) 🤖🤖🤖 (#30675)
cv::stackBlur returns wrong values on 16-bit images whose values use the upper part of the range. A constant image doesn't stay constant, and the output changes with the thread count.

There are two causes, both only in the universal-intrinsics paths for 16-bit data:

opRow<ushort>, opRow<short>, opColumn<ushort, int> and opColumn<short, int> compute (sum * mul) >> shr. stackblurMul is sized for 8-bit sums, so with a 16-bit sum the product overflows 32 bits.
opRow<ushort> and opRow<short> use v_add on two 16-bit samples before the kernel multiply. That add saturates. It's the same loss on any two samples whose sum doesn't fit in 16 bits.
The existing StackBlur.regression test doesn't reach this, because it converts an 8-bit image and the values stay small.

Fix
Add stackblurDivide, which computes trunc(float(sum) * mulVal). That is the same arithmetic the scalar loops already use, so the two now agree, and stripe boundaries no longer change the result. The 8-bit paths are unchanged.
Multiply each 16-bit sample after widening instead of adding two samples first.
Use int64_t sums where the largest sum doesn't fit int: from radius 181 for CV_16U, radius 255 for CV_16S and radius 2901 for CV_8U. Those radii take the scalar loops. Radii that fit keep the 32-bit SIMD paths.
opColumn<uchar, int> multiplies and shifts in v_uint32. From radius 181, sum * stackblurMul[radius] no longer fits a signed 32-bit int for values from 128 up, so vertical CV_8U blurs with kernels 363 to 509 saturated to 255. The largest product fits 32 bits unsigned. This was already on the base; nothing changes below radius 181.
Reject a kernel whose worst-case sum doesn't fit int64_t either, with a CV_Check: radius 11,863,373 and up for CV_16U, 16,777,215 for CV_16S, 190,184,348 for CV_8U. Only images tens of millions of pixels long reach these.
2026-11-20 08:39:58 +05:30
melody419
d89fbd99cf imgproc: fix warpPolar inverse mapping at the angular seam and for sub-matrix input (5.x) (#30851)
* imgproc: fix warpPolar inverse mapping at the angular seam and for sub-matrix input

* imgproc: use a mask for the ring check in the warpPolar seam test
2026-11-20 08:33:16 +05:30
Abhishek Gola
cecc70b290 Merge pull request #30963 from gty111/fix/python-video-stream-seek-5x
videoio: port Python stream seek and callback fixes to 5.x 🤖🤖🤖

Forward-port #30798 from 4.x to 5.x. Opening some videos from a Python stream can fail when a seek offset exceeds the signed 32-bit range. This port preserves 64-bit stream arguments, handles Python callback failures and stream cleanup safely, and reports read failures to FFmpeg as I/O errors.

The diff matches the merged 4.x patch. It includes the original Python videoio regressions and the standalone C++ regression for a throwing IStreamReader. The Python tests reuse fixtures already in opencv_extra/5.x.
2026-11-20 08:28:01 +05:30
Abhishek Gola
6518ef9acb Merge pull request #30967 from ternaus/codex/ipp-warp-perspective-fp32-nearest-ties
imgproc: preserve CV_32FC1 nearest perspective half ties 🤖🤖🤖
2026-11-20 08:25:10 +05:30
Ishita Singh
81cf43c1d8 dnn: handle min > max in Clip layer and enable ONNX conformance test (#30891)
* dnn: handle min > max in Clip layer and enable ONNX conformance test

Under the ONNX specification, the Clip operator is defined mathematically as
y = min(max(x, min), max). When min > max, the operation clamps identically
to max for all input values.

Previously, ClipLayerImpl asserted minValue <= maxValue in its constructor
and actualMin <= actualMax in forward, causing assertion failures on valid
ONNX models with min > max. Additionally, the adjacency graph fusion interpreter
checked a < min first, returning min instead of max.

This commit:
1. Removes the min <= max assertions in ClipLayerImpl constructor and forward,
   allowing ONNX-conforming evaluation where min > max clamps to max.
2. Updates FusionEltwiseOp::CLAMP in AdjacencyGraph interpreter to use
   std::min(std::max(a, n.scalar), n.scalar2), matching the ONNX evaluation order.
3. Removes test_clip_min_greater_than_max from the layer parser denylist.
4. Adds unit tests covering static and dynamic min > max clipping.

* dnn: filter test_clip_min_greater_than_max for OpenVINO backend

* dnn(test): address review comments on Clip min > max tests and fusion coverage
2026-11-20 08:22:26 +05:30
Prasadayus
eedbc4814e fix windows ci warning due to calib test 2026-11-19 16:07:16 +05:30
Parchuri Poojith Kumar
851cc5baa5 geometry: reject degenerate minimal samples in estimateAffine2D / estimateAffinePartial2D (#30829)
* geometry: reject degenerate minimal samples in estimateAffine2D/estimateAffinePartial2D

RANSACPointSetRegistrator::run() has a fast path used whenever exactly
the minimum number of points is supplied (3 for affine, 2 for
similarity). That path skips checkSubset() and trusts the kernel's
return value, but Affine2DEstimatorCallback::runKernel() and
AffinePartial2DEstimatorCallback::runKernel() always returned success,
even when dividing by a zero or near-zero denominator (collinear or
duplicate points). The result was a matrix full of inf/nan with every
point reported as an inlier, instead of a clean failure.

Both kernels now check the denominator against a threshold scaled by
the square of the point coordinates (matching how far float32 input
can drift from true collinearity/coincidence) and return 0 when it is
degenerate. The existing "<= 0" checks in the fast path and the general
RANSAC loop already handle this correctly.

The general RANSAC loop (more than the minimum points) is unaffected,
since a NaN/Inf model already fails computeError's inlier count.

Add test3CollinearPoints and test2DuplicatePoints, matching the
existing test file style.

* geometry: make the degeneracy tolerance independent of coordinate offset

The tolerance used absolute coordinates, so valid points far from the origin were rejected. estimateAffine2D now measures it against the triangle edges, and estimateAffinePartial2D only rejects coincident points. Add large-offset regression tests.

* geometry: tidy the comment in the similarity kernel

* geometry: test points that are collinear only up to float rounding
2026-11-19 15:33:53 +05:30
Vladimir Iglovikov
a8dfd5c99b fix(core): broadcast zero-power output over all channels 2026-11-19 18:47:57 +09:00
Madan mohan Manokar
3021339b72 Merge pull request #30639 from amd/port_5.x_remap
imgproc: Port 4.x Optimized remap interpolation to 5.x

Add remap SIMD kernels for single-channel bilinear, bicubic, and Lanczos4 paths.
Keep remap dispatch in a separate translation unit to avoid the existing warp_kernels dispatch declarations in imgwarp.cpp.
Preserve the 5.x fallback routing needed to match the 4.x remap performance cases.
2026-11-19 15:17:09 +05:30
Vladimir Iglovikov
fa7a73a929 fix(imgproc): preserve CV_32FC1 nearest perspective half ties 2026-11-19 16:57:55 +09:00
Shiven Solanki
e207b496e4 Merge pull request #30954 from sshivensolanki/dnn-nms-batched-negative-coords
dnn: fix NMSBoxesBatched class offset for negative coordinates - #30954

Fixes #30953

### Problem

`NMSBoxesBatched` shifts each class by `class_id * (max_coord + 1)`, which only separates the classes when all coordinates are non-negative. With boxes that start at negative coordinates, the shifted classes can still overlap, and a box gets suppressed by a box of a different class.

### Fix

Also track the smallest top-left coordinate, `min_coord`, and shift by `class_id * (max_coord - min_coord + 1)`, which is the full coordinate range plus one. `min_coord` starts at `0`, so the shift is unchanged when all coordinates are non-negative, and existing results stay the same.

### Tests

Added `BatchedNMS.NegativeCoordinates`: two boxes of different classes that only touch at one corner, one of them at negative coordinates. Before the fix only 1 box is kept; after the fix both are kept. The full `opencv_test_dnn` passes.

### 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
2026-11-19 10:45:26 +03:00
Tianyu Guo
8a711754a2 videoio: port Python stream seek and callback fixes to 5.x
Port opencv/opencv#30798 from 4.x, including its Python and native FFmpeg regression tests.

(cherry picked from commit 3e1cb2371a)
2026-11-19 06:52:42 +00:00
Alexander Smorkalov
6c60cc9a3a Merge pull request #30908 from sshivensolanki/fix-pam-no-tupltype-5x
imgcodecs: read 16-bit and 4-channel PAM files without TUPLTYPE
2026-11-19 08:41:00 +03:00
Alexander Smorkalov
d92a4105fc Merge pull request #30939 from abhishek-gola/tests/test-fixes-5x
tests: pass the mask in AccumulateWeighted.Mask
2026-11-19 08:40:06 +03:00
Madan Mohan Manokar
68ea4999dd imgproc: enable medianBlur OpenCL path on all aligned 8UC1 images (5.x)
Remove the Intel-only gate for medianFilter3_u/medianFilter5_u when cn==1 and dimensions meet the alignment requirements.

Port of https://github.com/opencv/opencv/pull/29803.
2026-11-19 04:49:44 +00:00
Abhishek Gola
529546d011 Merge pull request #30892 from pratham-mcw/svd_backSubst_opt_5x
Add ARMPL HAL backend for cv::SVD::backSubst

Adds a new cv_hal_SVBackSubst32f/64f HAL hook and an ARM Performance Library (ARMPL) backend, accelerating cv::SVD::backSubst for float and double datatype on AArch64.
Unlike the cv::SVD::compute HAL hook (cv_hal_SVD32f/64f), which already existed, SVD::backSubst had no HAL dispatch it called the baseline SVBkSb unconditionally. This PR adds the core for the new hook alongside the ARMPL implementation.
2026-11-18 17:15:03 +05:30
Alexander Smorkalov
72f8810548 Merge pull request #30904 from sshivensolanki:dnn-hardmax-first-index
dnn: fix Hardmax output when no element exceeds the type's lowest value
2026-11-18 14:43:31 +03:00
abhishek-gola
925ce46ef0 tests: pass the mask in AccumulateWeighted.Mask and check the #24966 CRF fix directly
Signed-off-by: abhishek-gola <abhishek@opencv.org>
2026-11-18 16:39:39 +05:30
Shiven Solanki
d2100a9059 imgcodecs: read 16-bit and 4-channel PAM files without TUPLTYPE
PAM files written by imwrite without IMWRITE_PAM_TUPLETYPE have no
TUPLTYPE line. readHeader only guessed the format for 8-bit images with
1 or 3 channels and threw for everything else, so 16-bit and 4-channel
images written by OpenCV could not be read back. Leave the format unset
in that case: readData already handles it with the default layout.

Add an Imgcodecs_Pam regression test.
2026-11-18 16:24:19 +08:00
Shiven Solanki
6158022f07 dnn: fix Hardmax max index when no element exceeds lowest()
Start the search from the first element of each slice instead of numeric_limits<T>::lowest() at index 0, so slices where every value equals the lowest value (e.g. all-zero uint8, all -inf float) get their 1 in the right place. Fixes #30903
2026-11-18 15:31:22 +08:00
Alexander Smorkalov
2ba4647c89 Merge pull request #30893 from pctablet505:fix-video-dis-stale-initial-flow-5x
video: clear stale initial flow in DISOpticalFlow::calc() 🤖🤖🤖
2026-11-18 10:19:25 +03:00
Alexander Smorkalov
772cd730e9 Merge pull request #30898 from RITU940:fix/multiview-visibility-mask-stride
calib: handle non-contiguous detection masks in calibrateMultiview
2026-11-18 10:18:00 +03:00
Abhishek Gola
80db42de85 Merge pull request #30887 from abhishek-gola/fix/sphinx-docs-warnings
Fix Sphinx documentation warning sources
2026-11-18 08:49:36 +05:30
Ritu Baskey
148ba7826b calib: respect detection mask row stride 2026-11-17 20:29:04 +00:00
pctablet505
521dd6bcdb video: fix DISOpticalFlow::calc() crash after collectGarbage()
DISOpticalFlowImpl::collectGarbage() cleared variational_refinement_processors
even though only the constructor populates it, and indexed
finest_scale..coarsest_scale (out of bounds before the first calc()).
Call collectGarbage() across variational_refinement_processors without
clearing the vector, and release the remaining internal buffers.
2026-11-17 20:43:08 +05:30
pctablet505
85d93fdbb6 video: clear stale initial flow in DISOpticalFlow::calc()
prepareBuffers() kept initial_Ux and initial_Uy from an earlier call
when use_flow was false.
2026-11-17 20:43:07 +05:30
Pratham Kumar
433cd83e62 Add ARMPL HAL backend for cv::SVD::backSubst 2026-11-17 20:22:07 +05:30
Alexander Smorkalov
7fd928ae70 Merge pull request #30867 from pratham-mcw:cornersubpix_opt_5x
imgproc: parallelize cornerSubPix using parallel_for_
2026-11-17 15:05:07 +03:00
Vadim Pisarevsky
a30d2be6ea Merge pull request #30618 from vpisarev:dft_opt
Further FFT/DFT/DCT optimizations - #30618

Merge together with https://github.com/opencv/opencv_extra/pull/1456

### Summary

Follow-up to #30061 and relates to #30467. It fixes the 64F 1D regressions measured on x86 after that PR, removes the O(r²) memory of the big prime radix, adds radix-8 stages, and makes the twiddle tables ~1 ulp accurate. Everything below was measured without IPP (`WITH_IPP=OFF`), so the numbers compare the OpenCV code paths only; the IPP logic is not touched.

Four commits, each self-contained:

1. **Memory, plan overhead, vectorization** (784be814b2)
   - Root cause of the x86 1D regressions: `cv::dft()` builds a plan per call, and at n = 65536 the engine allocated three MB-sized blocks per call (twiddles, permutation, workspace). glibc trims the heap after every free (its dynamic trim threshold is 2x the largest freed block), so every call page-faulted the buffers again: 65536 64FC2 ran at 620 us, ~215 us of it outside the transform. Fix: tables, permutation and the owner's workspace are **one allocation** per plan. No memory is retained between calls, no plan cache.
   - Static, lazily built tables for power-of-two lengths nc ≤ 1024 (stage twiddles, digit-reversal, real-FFT twiddles): plan building for 256..2048 points is table lookups only (0.06 us).
   - Generic odd radix: `cs/sn` tables of r entries with a cyclic index instead of h×h (h = (r−1)/2). n = 4093 in double: peak RSS 72.6 MB → 7.7 MB.
   - `DFT_STAGE_SIMD128`: stages with span shorter than the full vector but ≥ 128 bits run on `v_float32x4`/`v_float64x2` instead of scalar code (span 4 on AVX2 floats, i.e. every 4^k length).
   - Fused twiddle-free first stage of radix 3 and 5 for odd lengths (e.g. 4725), fused last radix-4 stage writing the interleaved scaled output, depth-first chunking of the leading stages for long transforms.
2. **`AutoBuffer` alignment** (02c6f39c82): `alignas(max(alignof(_Tp), 8))` on the local storage, so `AutoBuffer<uchar>` used as raw storage for double/int64 data is 8-byte aligned on every platform (it was only 4-byte aligned on 32-bit targets).
3. **Radix-8 stages and cache-set padding** (c7bf418d06): the power-of-two part is factored as r0·8^a·4^b (256: 2 middle stages instead of 3, 4096: 3 instead of 5, 65536: 5 instead of 7). The butterfly follows FFTW's `t1fv_8` (odd legs first, W8 rotations folded into the outputs with FMAs). The real reason an earlier radix-8 attempt was slower turned out to be **4K aliasing**: with a span of a 4 KB multiple, the data legs, the twiddle leg tables and the re/im arrays of one butterfly all map to one L1 set. One cache line of padding between the twiddle legs and between re and im gives 1.3–1.4x at n ≥ 16384 on its own; radix-8 adds 1.1–1.4x on top for complex transforms.
4. **Accurate twiddle generation** (2831df79c8): the tables were built by rotation recurrences and chained leg products and were 12–27 ulps off in double. Now every entry is one product of exactly computed seeds (Cephes sin/cos polynomials on an integer-reduced octant, ~0.5 ulp), computed in double, vectorized and rounded once. The real-FFT twiddles are stored as one table (`rtw_im = rtw_re + nc/2`).

Also: `perf_dft.cpp` gains 256x256 and 512x512 2D sizes (matchTemplate / filter2D tile sizes); `test_dxt.cpp` sweep gains prime and 2·prime lengths (257, 1009, 2018).

### Performance vs 5.x head (c4f7634256)

Environment: Intel Core Ultra 7 255H, Ubuntu 26.04, GCC 15.2, Release, default `CPU_BASELINE`/`CPU_DISPATCH` (AVX2 kernels are dispatched), `WITH_IPP=OFF`. Each binary was run twice and the minimum per case taken; the tables show the speedup `t(5.x) / t(PR)` as geomean over the flags (and row/column for 1D). Everything single-threaded unless stated.

**1D DFT (`dft1d`)**

|  | 32FC1 | 64FC1 | 32FC2 | 64FC2 |
|---|---|---|---|---|
| 256 | 2.11 | 1.84 | 2.25 | 1.73 |
| 1000 | 1.39 | 1.17 | 0.99 | 1.04 |
| 1024 | 2.62 | 2.07 | 2.49 | 1.68 |
| 4096 | 1.38 | 1.36 | 1.58 | 1.44 |
| 4725 | 1.81 | 1.71 | 1.86 | 1.72 |
| 65536 | 1.79 | 1.55 | 2.05 | 1.38 |

geomean 1.66 over 192 cases, min 0.98.

**1D DCT (`dct1d`)**

|  | 32FC1 | 64FC1 |
|---|---|---|
| 256 | 1.65 | 1.51 |
| 1000 | 1.50 | 1.22 |
| 1024 | 1.96 | 1.63 |
| 4096 | 1.52 | 1.37 |
| 65536 | 1.82 | 1.29 |

**2D DFT, 1 thread** (geomean over flags; `DFT_ROWS` cases in the second group)

|  | 32FC1 | 64FC1 | 32FC2 | | ROWS 32FC1 | ROWS 64FC1 | ROWS 32FC2 |
|---|---|---|---|---|---|---|---|
| 256x256 | 1.14 | 1.02 | 1.33 | | 0.97 | 0.97 | 1.70 |
| 512x512 | 1.14 | 1.04 | 1.04 | | 1.44 | 1.01 | 1.09 |
| 320x480 | 0.98 | 1.00 | 1.16 | | 0.98 | 1.00 | 1.62 |
| 800x600 | 1.10 | 1.00 | 0.99 | | 1.34 | 0.98 | 1.00 |
| 1280x1024 | 1.12 | 1.02 | 1.26 | | 1.00 | 1.00 | 1.43 |
| 1920x1080 | 1.12 | 1.00 | 0.99 | | 1.39 | 1.03 | 1.00 |
| 2048x2048 | 1.09 | 1.04 | 1.07 | | 1.34 | 0.99 | 1.21 |

2D DCT, 1 thread: 0.99–1.23 (geomean 1.06). With the default number of threads the 2D geomeans are the same (dft 1.07, dct 1.09) but individual cases are noisy on this hybrid-core CPU (0.75–1.76 between runs of the same code).

**imgproc**: matchTemplate 1.00–1.25 per image/template size (geomean 1.07), filter2D 1.00–1.03.

The one case consistently below 0.95 in the 1-thread tables, 2D 256x256 32FC2 `DFT_INVERSE` (0.84), is bimodal (0.11 / 0.19 ms) with both the old and the new library: it depends on the addresses malloc returns for the row buffers (set aliasing between src/dst and the 2D driver's buffers), so the per-run winner is luck. It is a candidate for a follow-up.

**Plain `cv::dft()` loop** (outside the perf harness, one thread, time per call in us, `create` = plan + workspace, `apply` = transform):

| n | type | 5.x total | PR total | 5.x create / apply | PR create / apply |
|---|---|---|---|---|---|
| 256 | 32FC1 | 0.54 | 0.23 | 0.35 / 0.09 | 0.06 / 0.09 |
| 1024 | 32FC2 | 1.88 | 0.76 | 0.82 / 0.97 | 0.06 / 0.58 |
| 4096 | 64FC2 | 13.3 | 8.7 | 5.1 / 9.1 | 2.3 / 5.7 |
| 4725 | 64FC2 | 47.6 | 17.9 | 8.2 / 24.7 | 3.0 / 14.5 |
| 65536 | 32FC2 | 358 | 109 | 97 / 175 | 26 / 80 |
| 65536 | 64FC2 | 632 | 199 | 155 / 255 | 33 / 159 |

At 65536 the 5.x numbers include ~90–220 us of page faults per call (the glibc trimming described above); the perf harness hides part of this because its warm-up changes the heap state.

### Accuracy

`cv::dft` output vs a long double reference, error in units of eps (2^−52 for double):

| n | impulse response, 5.x | PR | random input (rel. to max\|X\|), 5.x | PR |
|---|---|---|---|---|
| 256 | 12.1 | 0.9 | 15.9 | 0.8 |
| 1024 | 2.4 | 1.1 | 5.2 | 1.25 |
| 4096 | 26.6 | 1.35 | 29.5 | 1.1 |
| 65536 | 11.7 | 1.2 | | |
| 1048576 | 26.4 | 1.4 | | |

Float tables are correctly rounded (0.25 eps). Round trip `idft(dft(x))` at n = 4093 (generic odd radix): max error 5.2e-13 → 7.0e-15.

### Memory

n = 4093 64FC2 (prime length → generic odd radix 4093): peak RSS 72.6 MB → 7.7 MB. No memory is kept between calls apart from the static tables of the power-of-two lengths ≤ 1024 (34 KB float + 67 KB double, built on first use).

### Tests

- `opencv_test_core` (18297 tests) with AVX2 and with `OPENCV_CPU_DISABLE=AVX2`; `Core_DFT`/`Core_DCT` sweeps now include prime lengths.
- `opencv_test_imgproc` matchTemplate / filter2D / phaseCorrelate.
- `dxt.cpp` / `dxt.simd.hpp` syntax-checked for aarch64 NEON, riscv64 RVV, x86 without SIMD, AVX2 baseline, and with `-Wall -Wextra -Wshadow`.

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

🤖 Generated with [Claude Code](https://claude.com/claude-code)
2026-11-17 14:41:43 +03:00
Alexander Smorkalov
82028f2e5c Merge pull request #30847 from pratham-mcw:inpaint_opt_5x
photo: vectorize cv::inpaint (Telea/NS) inner loops
2026-11-17 12:10:27 +03:00
Alexander Smorkalov
e04069c2b7 Merge pull request #30709 from peters:dnn/cuda102-reduce
dnn: fix CUDA 10.2 build of N-D reduce kernels 🤖🤖🤖
2026-11-17 12:05:34 +03:00
Alexander Smorkalov
6d711375a1 Merge pull request #30886 from sshivensolanki:core-magnitude-phase-nd
core: support N-D Mats in cv::magnitude and cv::phase
2026-11-17 12:00:15 +03:00
Alexander Smorkalov
cfc236d75e Merge pull request #30879 from pratham-mcw:cvtColor_opt_5x
imgproc: speed up RGB2Gray and RGB2YCrCb on ARM NEON
2026-11-17 11:37:24 +03:00
Alexander Smorkalov
5c98cb61a8 Merge pull request #30877 from sshivensolanki/core-convert-bool-negative-zero
core: fix convertTo(CV_Bool) turning -0.0 into true for CV_16F and CV_16BF
2026-11-17 11:18:32 +03:00
Alexander Smorkalov
84c8ba4e39 Merge pull request #30872 from pratham-mcw:sortIdx_opt_5x
core: parallelize sortIdx over independent rows/columns
2026-11-17 08:58:06 +03:00
uwezkhan
d4783f1025 ptcloud: check attribute counts against vertices in PlyEncoder 🤖🤖🤖 (#30837)
* ptcloud: check attribute counts against vertices in PlyEncoder

* ptcloud: throw on attribute count mismatch in PlyEncoder, split obj and ply tests
2026-11-17 11:04:39 +05:30
pbkx
043c56d04c features2d: clear knnMatch output before matching (#30856)
The current implementation of DescriptorMatcher::knnMatch() passes the output vector to the matcher implementation without clearing it. This means that when the output is reused, BFMatcher will add more query-result vectors to the output. Similarly, FLANN will add matches to existing inner vectors. If the query is empty, then the previous results are retained.

This PR adds back the call to matches.clear() in the common wrapper. It also adds new regression tests for multiple calls to BFMatcher and FLANN. It also covers empty queries and empty stored training collections.
2026-11-17 11:02:19 +05:30
Shiven Solanki
7c475d2785 core: support N-D Mats in cv::magnitude and cv::phase 2026-11-17 12:09:11 +08:00
Pratham Kumar
75178bb006 imgproc: speed up RGB2Gray and RGB2YCrCb on ARM NEON 2026-11-16 23:26:18 +05:30
Shiven Solanki
9465727b84 core: fix convertTo(CV_Bool) turning -0.0 into true for CV_16F and CV_16BF 2026-11-17 00:16:46 +08:00
Alexander Smorkalov
5d0660acfe Merge pull request #30852 from vrabaud:avif
imgcodecs(avif): fix MSVC C2666 ambiguity in CV_CheckEQ (#30843)
2026-11-16 17:58:32 +03:00
Alexander Smorkalov
ff92bf2147 Merge pull request #30840 from sshivensolanki:core-foreach-1d-position
core: fix forEach position for 1D Mat
2026-11-16 17:56:54 +03:00
Abhishek gola
315ddafc6c Fix Sphinx API targets, navigation and documentation warnings 2026-11-16 20:13:32 +05:30
Pratham Kumar
1c67b283ac core: parallelize sortIdx over independent rows/columns 2026-11-16 18:04:18 +05:30