3748 Commits

Author SHA1 Message Date
Alexander Smorkalov
de42350f04 Disabled perf test for IntelligentScissors as it's too long. 2026-09-10 09:42:45 +03:00
Alexander Smorkalov
1c312e0820 Merge pull request #29908 from andreyfe1:andreyfe1/extend_perf_imgproc
Extend OpenCV imgproc performance tests
2026-09-10 09:04:40 +03:00
Alexander Smorkalov
bb9e3eff13 Merge pull request #29858 from ahmadmasood43:boundingrect-29837-4x
imgproc: saturate out-of-range float coordinates in boundingRect
2026-09-09 15:14:10 +03:00
Fedorov, Andrey
ed65b9186e changed imgproc perf tests 2026-09-09 04:34:34 -07:00
Abhishek Gola
42076ef3b7 Merge pull request #29326 from pratham-mcw/guided_filter-opt-simd
ximgproc: add NEON intrinsics support for BoxFilter Function
2026-09-08 16:58:17 +05:30
Alexander Smorkalov
415ba6a444 Merge pull request #29805 from amd:opencl_boxfilter
imgproc: Enable boxFilter OpenCL fast paths on Non-Intel GPUs.
2026-09-05 17:01:29 +03:00
ahmadmasood43
0b475cd66f imgproc: saturate out-of-range float coordinates in boundingRect
pointSetBoundingRect() passed CV_32F coordinates to cvFloor() without
honouring its documented INT_MIN..INT_MAX precondition, so a point set
outside the int range collapsed to a 1x1 rect at INT_MIN, while +inf and
-inf gave INT_MIN and INT_MAX - an inverted rectangle. The extrema are
now searched for in floats, as the vectorized path already did, and
floored and saturated to the closest representable bound once, after the
reduction.

The sides are computed in int64 and clamped to INT_MAX: xmax - xmin + 1
overflows int once the extrema saturate, and did so already for a CV_32S
point set spanning the whole int range.

Fixes #29837
2026-09-05 17:12:24 +05:00
Madan mohan Manokar
a15bcc7ea8 Merge pull request #29393 from amd:fast_moments
imgproc: Optimized Moments & perf test added - #29393

- Added dispatch for moments (CV_8U, CV_16U, CV_32F and CV_64F) 
- CV_16S is kept in scalar due to regresssions observed.
- Perf test added for meanShift, CamShift and matchShapes.
- Extend Moments1 perf coverage to CV_8U alongside 16/32/64-bit depths.

### 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
2026-09-03 16:38:40 +03:00
Alexander Smorkalov
e39c9a2411 Merge pull request #29850 from lazerg:fix/ipc-float32-cps-underflow
imgproc: guard against zero magnitude in phaseCorrelateIterative
2026-09-03 14:35:25 +03:00
Alexander Smorkalov
1209808c70 Merge pull request #29855 from lazerg:fix/issue-29854-empty-input-crash
imgproc: reject empty input in connected components
2026-09-03 14:25:47 +03:00
Lazizbek Ergashev
e7652038ee imgproc: reject empty input in connected components 2026-09-02 23:11:05 +05:00
Lazizbek Ergashev
bf4a8248c9 imgproc: guard against zero magnitude in phaseCorrelateIterative 2026-09-02 18:28:02 +05:00
Madan mohan Manokar
184fb3f51c imgproc: faster bit-exact BGR(A)2GRAY on x86 AVX-512
Use vpmaddwd on BGRA and vpermb+vpmaddwd on BGR; fall back to the universal SIMD kernel.
2026-09-02 10:31:18 +00:00
Pratham Kumar
a9dea1e4a4 Merge pull request #29811 from pratham-mcw:buildPyramid_opt
imgproc: optimize PyrDownVecH<uchar,int,3> using v_load_deinterleave - #29811

**Summary:**

- buildPyramid on Windows-ARM64 (1920×1080, 8UC3) was ~7× slower than x64. 
- Root cause: PyrDownVecH<uchar,int,3> used vx_lut_quads to gather pixels, which on NEON compiles to 80 scalar byte reads per SIMD iteration filling a stack buffer one byte at a time before loading it as a vector. The SIMD unit was effectively idle.

**Root Cause:**

- The 3-channel horizontal pass needs 5 non-contiguous source pixels per output pixel. The existing code precomputes byte-offset index arrays and calls vx_lut_quads(src, idx) five times per loop body. On NEON, vx_lut_quads is implemented as 16 individual scalar reads → vld1q_s8, so 5 calls = 80 scalar loads producing only 12 int32 outputs.

**Fix:**

- Replace the gather loop with v_load_deinterleave, which maps to vld3q_u8 on AArch64 — single instruction, loads 48 bytes and hardware-deinterleaves R/G/B in one shot

**Performance Benchmarks:**

<img width="1021" height="536" alt="image" src="https://github.com/user-attachments/assets/6c4b5d71-d096-4dfd-9bc4-4315d4e679af" />
2026-09-01 10:07:11 +03:00
Alexander Smorkalov
6e4c669be8 Merge pull request #29801 from amd:fast_sobel2d_opt
imgproc: fused spatialGradient + dispatched SIMD Canny
2026-08-31 12:50:54 +03:00
Alexander Smorkalov
1e82d103e5 Merge pull request #29814 from pratham-mcw:laplacian_opt
imgproc: vectorize symmetric <CV_32S, CV_16S> column filter
2026-08-31 10:12:06 +03:00
Arne Baeyens
755546643a Merge pull request #29779 from abaeyens:abaeyens/speed-up-warp
Speed up imgproc warpAffine and warpPerspective for BORDER_TRANSPARENT - #29779

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

## Why
I was using `warpPerspective` to draw several source images on a large destination image in mode `BORDER_TRANSPARENT` and ran into `warpPerspective` being surprisingly slow. Upon reading the code, it turns out that `warpPerspective`, as well as `warpAffine`, iterates over all the destination image's pixels even if the source image gets projected to only a small part of the destination image, resulting in considerable overhead for my use case. I believe other users would also benefit from making this case more efficient.

## Changes
d19c343704 calculates the ROI of the source image in the destination image and then limits the destination image walk to that area. Given that the existing tests didn't cover `BORDER_TRANSPARENT`, I extended that in e451f59cda. Next to that, I added a small performance test dedicated to this use case (c4e271c2dc).

## Performance improvement
The following table show the timing difference before and after, generated using the added perf test (source image projects to 64x64, drawn in a 512x512 destination image):

| function | type | interp | base [ms] | opt [ms] | speedup |
| --- | --- | --- | --- | --- | --- |
| warpAffine | 8UC1 | NEAREST | 0.204 | 0.010 | 19.8× |
| warpAffine | 8UC1 | LINEAR | 0.428 | 0.026 | 16.6× |
| warpAffine | 8UC4 | NEAREST | 0.239 | 0.021 | 11.5× |
| warpAffine | 8UC4 | LINEAR | 0.433 | 0.031 | 14.0× |
| warpPerspective | 8UC1 | NEAREST | 0.759 | 0.033 | 23.2× |
| warpPerspective | 8UC1 | LINEAR | 1.125 | 0.067 | 16.8× |
| warpPerspective | 8UC4 | NEAREST | 0.786 | 0.040 | 19.5× |
| warpPerspective | 8UC4 | LINEAR | 1.110 | 0.101 | 11.0× |

In short, a 10 to 20x speedup.

## Notes
- This is my first PR for the OpenCV project, I'm sorry in case I didn't respect all contribution guidelines.
- If relevant, Clause Opus 4.8 was used for exploring the codebase, some code and style suggestions and review.
2026-08-29 11:52:17 +03:00
Pratham Kumar
8714d8afec imgproc: vectorize symmetric CV_32S, CV_16S column filter 2026-08-27 15:51:44 +05:30
Alexander Smorkalov
6dc8e40903 Merge pull request #29800 from amd:opencl_guassianBlur
imgproc: Enable GaussianBlur OpenCL fast paths on non-Intel GPUs.
2026-08-27 09:24:53 +03:00
Alexander Smorkalov
7699b4c796 Merge pull request #29803 from amd:opencl_medianblur
imgproc: Enable medianBlur OpenCL optimized path on Non-Intel GPUs
2026-08-27 09:24:02 +03:00
Madan mohan Manokar
b0cfda3187 imgproc: fused spatialGradient + dispatched SIMD Canny.
- Add fused single-pass spatialGradient kernels with runtime SIMD dispatch.
- Add dispatched SIMD Canny edge path (canny.dispatch.cpp, canny.simd.hpp).
- Route corner, Canny, and IntelligentScissors gradients through spatialGradient.
- Extend spatialGradient ksize support to 1 via Sobel fallback; gate fused paths to 3/5.
- Extend fused_accuracy ROI tests to ksize 1, 3, and 5 (borders, CV_16S/CV_32F).
2026-08-26 12:55:54 +00:00
Prasad Ayush Kumar
524fbae162 Merge pull request #29410 from Prasadayus:bilateral_filter_ipp_extract
Extract IPP integration as HAL function for bilateral_filter - #29410

Backport of https://github.com/opencv/opencv/pull/29409

**Performance Numbers on Intel(R) Core(TM) i9-11900K:** https://docs.google.com/spreadsheets/d/1rmNB3X_V8rWttUGBqXRs1FmkxeKR0O93x_ez5tVjutY/edit?usp=sharing

### 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-08-26 13:26:18 +03:00
Madan mohan Manokar
8f592d81e8 Enable boxFilter OpenCL fast paths on all aligned GPUs.
Remove Intel-only gates for the 3x3 8UC1 cols16/rows2 kernel and the filterSmall path while keeping alignment and kernel-size preconditions.
2026-08-26 15:23:05 +05:30
Madan mohan Manokar
357fd2e58d Enable medianBlur OpenCL optimized path on all aligned 8UC1 images.
Remove Intel-only gate for medianFilter3_u/medianFilter5_u when cn==1 and dimensions meet alignment requirements.
2026-08-26 14:23:26 +05:30
Madan mohan Manokar
400ded6619 Enable GaussianBlur OpenCL fast paths on non-Intel GPUs.
Remove Intel-only gates from dedicated 3x3/5x5 GaussianBlur kernels and
single-pass separable filter paths so AMD and other OpenCL devices can
use the same optimized implementations with existing fallbacks.
2026-08-26 11:34:38 +05:30
Madan mohan Manokar
44e7b4eb11 Merge pull request #29273 from amd:fast_sobel2d
imgproc: Extended spatialGradient API and applied to different detector algorithms - #29273

imgproc: Add fused Sobel2D gradient API and use it in different detector algorithms

Add a public Sobel2D API computing dx/dy in a single fused pass with 3x3 and 5x5 kernels (SIMD-dispatched). The float (CV_32F) path folds the output scale and float store into the kernel, avoiding a separate convertTo pass.

- Add runtime SIMD dispatch for the Canny edge path.
- Integrate fused Sobel2D into:
    - Canny
    - cornerEigenValsVecs (cornerHarris, cornerMinEigenVal, cornerEigenValsAndVecs, goodFeaturesToTrack)
    - GeneralizedHough
    - IntelligentScissors
    - HoughCircles
- Add performance and accuracy tests.

### 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
2026-08-24 15:06:23 +03:00
Pratham Kumar
2cfad59a38 fuse delta/prefix-sum SIMD loops in row sum 2026-08-23 13:15:01 +05:30
Taiwei Zhang
690f3d25c2 Merge pull request #29071 from zitonwei:fix-masked-ccoeff-normed-constant-template
imgproc: avoid NaN in masked TM_CCOEFF_NORMED for constant templates - #29071
    
### 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

### Summary

Fixes #23257.

This patch handles a degenerate masked `TM_CCOEFF_NORMED` case in `matchTemplate()`. When the template is constant over the effective mask area, the template norm can become zero or NaN, which may propagate NaN/Inf values into the result. The masked path now returns all ones for this case, matching the existing behavior of the unmasked `TM_CCOEFF_NORMED` implementation for constant templates.

### Tests

- `cmake --build build_project4 --target opencv_test_imgproc -j4`
- `./build_project4/bin/opencv_test_imgproc '--gtest_filter=Imgproc_MatchTemplateWithMask.regression_23257_constant_template'`
- `./build_project4/bin/opencv_test_imgproc '--gtest_filter=*MatchTemplate*'`

The MatchTemplate-related test filter ran 147 tests successfully.
2026-08-18 08:42:28 +03:00
Dharshika Pugalenthi
cc293eaff6 Merge pull request #29691 from DPug888:fix-resize-area-channel-limit
allow cv::resize to support more than 4 channels in AREA path - #29691

Fixes  #29651

### 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-08-18 08:27:04 +03:00
Akansha-977
3621c83f2f Merge pull request #29512 from Akansha-977:rectsubpix_IPP_4.x
Extracted IPP to HAL for getRectSubPix function in 4.x - #29512

### 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-08-17 16:17:55 +03:00
Madan mohan Manokar
c3e1b10d3d Merge pull request #29718 from amd:fast_accumulate_2
imgproc: Optimize AVX-512 path for accumulate - #29718

- Add AVX512_SKX/AVX512_ICL to accum dispatch
- Video_RunningAvg.accuracy failure observed in #29394 has been fixed.

### 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
2026-08-17 13:10:20 +03:00
Alexander Smorkalov
9cb2f5e191 Revert "Merge pull request #29394 from amd:fast_accumulate"
This reverts commit c6e84d494c.
2026-08-13 16:19:20 +03:00
Alexander Smorkalov
681d3ecd2b Merge pull request #29695 from Parth1353:fix/26447-cvtcolor-depth-docs
imgproc: document that color conversion depth support varies by code
2026-08-13 16:13:31 +03:00
Pratham Kumar
fece2acfba Merge pull request #28728 from pratham-mcw:calchist-simd-opt
imgproc: add simd support for calchist & calchist1d function - #28728

- This PR adds OpenCV SIMD intrinsics-based optimizations to the Calchist and calcHist1d function for improved performance on Windows-ARM64 platforms.
- The optimized implementation uses vectorized operations to accelerate histogram computation.
- In x64 architecture, `calcHist1d` benefits from IPP-based optimized implementations. However, on ARM64 platforms, the execution falls back to scalar implementation, which results in lower performance.
- After introducing these changes, the calcHist and calchist1d function showed noticeable performance improvements on Windows-ARM64.

**Performance Benchmarks:**
<img width="1247" height="460" alt="image" src="https://github.com/user-attachments/assets/ed740d87-158e-49d4-889e-9c7dda482a63" />
<img width="552" height="210" alt="image" src="https://github.com/user-attachments/assets/76b9e46e-304e-480c-9a57-af0aba6e937a" />

- [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
2026-08-13 14:32:47 +03:00
Madan mohan Manokar
c6e84d494c Merge pull request #29394 from amd:fast_accumulate
imgproc: Optimized accumulate with AVX512 dispatch and AVX2 kernels improved #29394

- Add AVX512_SKX/AVX512_ICL to accum dispatch
- Fine tune AVX2 kernels for float, cn = 1 and 3 cases.

### 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
2026-08-13 12:21:29 +03:00
Aaron
bfa07fc52a Merge pull request #29638 from aarochu:feature-medianblur-arbitrary-channels
imgproc: support arbitrary channel counts in medianBlur #29638

## Summary

Fixes #29592.

`cv::medianBlur`/`cv2.medianBlur` rejects `CV_8U` images with channel counts other than 1, 3, or 4 whenever the optimized large-kernel path is needed — `ksize >= 7` always, and `ksize == 5` on SIMD-enabled builds (the `ksize == 3`/`ksize == 5`-without-SIMD "sort net" path already handles arbitrary channel counts generically, so this only affects the fast path):

```
src.depth() == CV_8U && (cn == 1 || cn == 3 || cn == 4)
```

Median filtering is channel-independent, so there's no correctness reason for this restriction — it's an implementation detail of the optimized SIMD kernels (which hard-code 1/3/4-channel-interleaved layouts), not a property of the algorithm. Users with 2, 5, 6, 9+ channel images (multispectral, feature maps, stacked masks) currently have to split, filter, and re-concatenate manually outside the library — exactly the workaround already implemented downstream in Albucore, per the issue.

## Fix

In `cv::medianBlur` (`modules/imgproc/src/median_blur.dispatch.cpp`), before dispatching to HAL/OpenCL/the optimized SIMD path: if the channel count isn't 1, 3, or 4, split the image into individual channels, run `medianBlur` on each one independently (a single channel is always supported by every existing path, recursively), and merge the results back together. This touches none of the performance-critical kernels — it's a fallback that only runs for channel counts those kernels don't support, and the existing 1/3/4-channel fast paths are completely unaffected.

## Test plan

- [x] Added `Imgproc_MedianBlur.arbitrary_channel_count_29592` in `modules/imgproc/test/test_filter.cpp`, covering channel counts `{1,2,3,4,5,6,9}` × kernel sizes `{3,5,7,9}`. For each combination it asserts `medianBlur` doesn't throw, preserves size/type, and — critically — produces output bit-identical to filtering each channel independently via `cv::split`/`cv::merge` (the reference/expected behavior).
- [x] Built `opencv_core` + `opencv_imgproc` + `opencv_test_imgproc` locally (MSVC) and ran the new test — passes.
- [x] Ran the full existing `Imgproc_MedianBlur.*`, `Imgproc_Filter2D.*`, `Imgproc_Blur.*`, `Imgproc_GaussianBlur.*` suites — all 14 pass, no regressions.
- Note: `GaussianBlurVsBitexact`, `sepFilter2D_types`, and `StackBlur` tests in the same binary fail/crash in this local environment, but reproduce identically on unmodified `4.x` with no changes at all — confirmed pre-existing and unrelated to this change (not investigated further, out of scope here).
2026-08-13 11:35:16 +03:00
Parth Saini
e24dc1ff4c core: add CV_CPU_GET_FN_PTR_<OPT>() to resolve dispatched function pointers
The generated cv_cpu_helper.h sets CV_TRY_<OPT> to 1 both when <OPT> is a
dispatch target and when it is part of the baseline, but an opt_<OPT> namespace
is only emitted for the dispatch case: __ocv_add_dispatched_file() guards it
with CPU_DISPATCH_FINAL, and a baseline optimization is deliberately kept out of
that list. Code that hand-rolls "#if CV_TRY_<OPT> ... opt_<OPT>::fn" therefore
fails to compile as soon as the optimization lands in the baseline, e.g. with
-DCPU_BASELINE=AVX512_ICL or -march=native on an ICL capable CPU:

  lut.dispatch.cpp:22:16: error: 'opt_AVX512_ICL' has not been declared

CV_CPU_CALL_<OPT>() already handles the namespace selection for a call. Add the
same thing for code that needs the function pointer instead:

  CV_CPU_GET_FN_PTR_<OPT>(fn)       per optimization
  CV_CPU_GET_FN_PTR_BASELINE(fn)    chain terminator
  CV_CPU_DISPATCH_FN(fn, modes)     full chain, mirrors CV_CPU_DISPATCH()

In the baseline case it resolves to cpu_baseline::fn, which is the <OPT> build
of the kernel, so no implementation is lost and no second copy is emitted. In
the dispatch case it keeps the cv::checkHardwareSupport() test and returns
opt_<OPT>::fn, and it compiles out when the optimization is unavailable.

Use it in the two places that hit this, which also removes the hand-written
preprocessor blocks. Generated code for the dispatch configuration is unchanged
(byte-identical .text with -DCPU_BASELINE=SSE3 -DCPU_DISPATCH=AVX512_ICL).

Fixes #29694
2026-08-12 18:10:38 +05:30
Parth Saini
3043094d71 imgproc: document per-code depth support on cvtColor/demosaicing src param
cvtColor's @param src promised 8U, 16U and 32F unconditionally, but the accepted
depths depend on the conversion code: CV_16U is rejected by COLOR_BGR2HSV,
COLOR_BGR2Lab, COLOR_BGR2Luv and the packed 16-bit codes, while COLOR_BGR2GRAY,
COLOR_BGR2XYZ, COLOR_BGR2YUV and RGB<->RGB accept it. That is what #26447
reported.

State it on @param src and point at the [8U]/[16U]/[32F] markers already
documented on ColorConversionCodes. The @note only said the source "must be of
an appropriate type", which is now redundant, so drop it from both functions.

demosaicing has the same problem: the Variable Number of Gradients codes accept
8-bit input only, while the other Bayer codes also accept 16-bit.

Fixes #26447
2026-08-12 12:35:49 +05:30
Abhishek Gola
49ca26154e Merge pull request #29554 from mvanhorn/fix/29279-ipp-warpaffine-nearest-bitexact
imgproc: route IPP warpAffine INTER_NEAREST to native kernel for bit-exactness 🤖🤖🤖
2026-08-06 19:09:35 +05:30
Matt Van Horn
92d1ebe1a0 docs: trim the NEAREST-fallback comments per review 2026-07-31 08:02:50 -07:00
Sergiu Deitsch
096759c0b0 imgproc: fix OpenCL remap negative rounding
Truncation toward zero produces incorrect interpolation indices for
negative border coordinates. Use nearest-even rounding so OpenCL remap
matches the CPU behavior.
2026-07-27 10:46:53 +05:30
Sergiu Deitsch
73c9537f3b imgproc: fix NVIDIA OpenCL remap kernel types
Match interpolation coefficient types to the working type so the double
kernel compiles on NVIDIA devices.
2026-07-27 10:46:53 +05:30
pratham-mcw
ed1a25df19 fix NEON box filter build failure on armv7 2026-07-19 16:43:18 +05:30
Matt Van Horn
fe5ab36245 imgproc: fix IPP HAL warpAffine INTER_NEAREST not bit-exact with native
The IPP HAL (hal/ipp/src/warp_ipp.cpp) routed cv::warpAffine with
INTER_NEAREST to iwiWarpAffine for CV_16S{C1,C3,C4}, CV_64F{C1,C3,C4}
and CV_16UC4 via the non-enforced (default) impl[] dispatch table,
whose comment promises results "strictly aligned to OpenCV
implementation". That contract was broken: IPP rounds source
coordinates at the half-pixel boundary differently from the native
fixed-point kernel (warpAffineBlocklineNN, 10-bit AB_BITS), so under
rotation or fractional translation about 0.05-0.07% of destination
pixels resolve to a different source pixel. Because INTER_NEAREST does
no blending, those pixels take entirely different values, so warping
identical data as e.g. CV_16S (IPP path) versus CV_16U (native path)
produced non-identical output, and x86_64 (IPP) silently diverged from
ARM (no IPP). This is the same "Different results" behavior for which
IPP warpAffine was disabled from ~2017 through 4.11.

Zero the INTER_NEAREST column of the non-enforced dispatch table for
the affected types so the dispatch guard falls back to the native
kernel, restoring the "strictly aligned" contract. The LINEAR and
CUBIC columns for these rows were already 0, so IPP was only ever used
for NEAREST here. The IPP_CALLS_ENFORCED table is left untouched so the
opt-in performance-benchmarking build still exercises IPP.

Adds a regression test (Imgproc_Warp.regression_29279) that warps a
gradient image with INTER_NEAREST as each affected type and asserts
bit-exact equality with a native (CV_32F) reference across several
rotation angles and a fractional translation.

Fixes #29279
2026-07-18 10:12:16 -07:00
pratham-mcw
c6b17073e9 Replace CV_NEON_AARCH64 with CV_NEON in box_filter 2026-07-17 15:58:35 +05:30
pratham-mcw
2665cec7f2 fix NEON RowSum build failure on non-float/double type instantiations 2026-07-16 18:49:00 +05:30
Madan mohan Manokar
6b640b424c Merge pull request #28650 from amd:fast_pyrDown
imgproc: Optimized OpticalFlowPyrLK (PyrDownH) #28650

- Optimized Uchar PyrDown Horizontal processing intermediate storage.
- Improved horizontal processing with AVX512 vbmi ISA.
- Todo: further refinement for other archs.

### 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
2026-07-15 12:31:28 +03:00
Madan mohan Manokar
4fe51e51e0 Merge pull request #29507 from amd:fast_remap_ext
imgproc: Optimized remap interpolation #29507

- Add a SIMD dispatch file for remap and vectorize the single-channel (C1) in-bounds paths of bilinear, bicubic and lanczos4 interpolation (32F / 16U / 16S) using width-agnostic gather
- Dispatch the bilinear C1 path and drop the per-pixel weight-table gathers
- Widen the fixed-point coordinate map conversion
- 32F lanczos4 is kept on the scalar path: its vectorized 64-tap accumulation deviates beyond the set float accuracy tolerance
- Vectorize the bilinear inlier/outlier run detection so any-channel linear remap skips constant-status runs with SIMD instead of a per-pixel bounds test

### 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
2026-07-14 15:17:22 +03:00
Akansha Mallick
2c14cc1897 Extracted IPP to HAL for calcHist function 2026-07-13 14:12:52 +05:30
Akansha-977
87af90b847 Merge pull request #29463 from Akansha-977:distransform_IPP_migration_4.x
Distransform function IPP migration to HAL in 4.x #29463

### 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-07-10 18:28:10 +03:00