Improved Gaussian Blur #27795
- Horizontal and vertical kernels of 3N131 and 5N14641 are combined for non-border(inner) regions.
- Temporary storage of intermediate results are avoided by combining the kernels.
- Further refinement of other 3N, 5N to be added later.
### 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
imgcodecs: bmp: relax decoding size limit to over 1GiB #27811
Close https://github.com/opencv/opencv/issues/27789
Close https://github.com/opencv/opencv/issues/23233
### 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
libtiff upgrade to version 4.7.1 #27806
close https://github.com/opencv/opencv/issues/27784
### 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.
- [ ] The feature is well documented and sample code can be built with the project CMake
stitching: enable loop unrolling in fast.cpp to improve ARM64 performance #27642
### 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
- This PR introduces an ARM64-specific performance optimization in the FAST_t function by applying loop unrolling.
- The optimization is guarded with #if defined(_M_ARM64) to ensure it only affects ARM64 builds.
- This optimizations lead to performance improvements in stitching module functions.
**Performance Improvements:**
- This change significantly improved the performance on Windows ARM64 targets.
<img width="935" height="579" alt="image" src="https://github.com/user-attachments/assets/a03833d1-ac9b-408f-916b-243fd6ae2d53" />
dnn: improve performance of softmax_3d with loop unrolling #27777
### 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
- This PR applies loop unrolling in the softmax function.
- The change does not affect functional correctness.
**Performance Improvements**
- The optimization significantly improves the performance of softmax_3d on Windows ARM64 targets.
<img width="703" height="203" alt="image" src="https://github.com/user-attachments/assets/85997c15-f543-432c-95e5-69099d71fe71" />
dnn: Tune CONV_NR_FP32 size for WASM #27773
We can see ~20% inference time reduction on local benchmark.
The local benchmark includes face detection with res10_300x300_ssd_iter_140000_fp16.caffemodel and image classification with squeezenet.onnx .
### 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
features2d: performance optimization of detect function on Windows-ARM64 #27776
### 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
- This PR improves the performance of the detect function on Windows ARM64 targets.
- Added the defined(_M_ARM64) macro in agast.cpp and agast_score.cpp files, aligning ARM64 behavior with how x64 selects internal functions for computation.
- As a result, ARM64 now executes the same internal functions as x64 where applicable, leading to measurable performance improvements in detect function.
- This changes is limited to Windows ARM64 and does not affect other architectures
**Performance impact:**
- Detect function shows improved runtime on ARM64 targets due to reuse of existing efficient computation paths.
<img width="1419" height="408" alt="image" src="https://github.com/user-attachments/assets/feab411a-d256-4bff-bec2-22b2583f63d1" />
Skip ARM assembly file on QNX #27774
This fixes build failures on QNX caused by unsupported ARM NEON assembly in arm/filter_neon.S. The QNX environment does not handle this assembly source correctly, resulting in compilation errors.
Build and test instruction for QNX:
https://github.com/qnx-ports/build-files/blob/main/ports/opencv/README.md
### 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
- [ ] 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
Add strict validation for encoding parameters for APNG, Animation WebP #27769
Extra fix for https://github.com/opencv/opencv/issues/27557
- Fix for build errors with libspng library.
- Add strict validation for APNG.
- Add strict validation for Animation WebP.
### 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
Fix Python Scalar typing issue #27528#27620
- Add ScalarInput and ScalarOutput types for better type safety
- ScalarInput: Union[Sequence[float], float] for function parameters
- ScalarOutput: Sequence[float] for function return values
- Keep original Scalar type for backwards compatibility (deprecated)
- Add refinement functions to apply new types to specific functions
- Functions returning scalars now use ScalarOutput (mean, sumElems, trace)
- Drawing functions now use ScalarInput for color parameters
- Resolves MyPy compatibility issues with scalar return values
- Maintains full backwards compatibility
closes#27528
### 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
Optimize FFmpeg VideoCapture with swscale threads option #27755
### Pull Request Readiness Checklist
resolves https://github.com/opencv/opencv/issues/21969
* Switch to `sws_scale_from` for `libswscale >= 6.4.100` (FFmpeg >= 5.0)
* Use new context init API with threads option (`libswscale >= 8.12.100`: 2a091d4f2e)
* Replicate `sws_getCachedContext` with threads option for `libswscale < 8.12.100`
1 hour mp4 video every frame reading
| HW | sws_scale | sws_scale_frame + 16 threads | sws_scale_frame + 24 threads (#cpus) |
|---|---|---|---|
| Intel Core i9-12900 CPU | 45.1 sec | 25.4 sec (x1.77) | 30 sec (x1.50) |
| NVIDIA GPU 4090 | 232 sec | 89.4 sec (x2.59) | 77 sec (x3.01) |
```
import time
import numpy as np
import os
import cv2 as cv
# os.environ["OPENCV_FFMPEG_CAPTURE_OPTIONS"] = "hwaccel;cuvid|video_codec;h264_cuvid|vsync;0"
start = time.time()
video = "test.mp4"
cap = cv.VideoCapture(video, cv.CAP_FFMPEG)
while True:
has_frame, frame = cap.read()
if not has_frame:
break
print(time.time() - start)
```
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
imgcodecs: bmp: support to write 32bpp BMP with BI_BITFIELDS #27559
### 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
Set limitation to IPP Bilateral Filter tiles number to avoid too small tiles #27720
### Pull Request Readiness Checklist
This PR fixes the following issue in Bilateral Filter tiling in IPP integration: image ROI can't be closer to the image border than the filter window radius. This issue shows itself during separation of the image to tiles for multithreaded processing. If the tile size small enough, the second tile is closer to the upper image border than the bilateral filter radius, which leads to the incorrect result. To fix this, we need a limitation to the tile size - done in this PR.
_Note: red build status looks like unrelated to the current change_
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
- [ ] 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
[videoio][VideoWriter] Fix return code from CvVideoWriter_FFMPEG::writeFrame() when encapsulating encoded video #27737
Currently the return code from `CvVideoWriter_FFMPEG::writeFrame()` when `encode_video==true` (encapsulating raw encoded video) is wrong and results in the following warning implying it has been unsuccessful
> [ WARN:0@15.551] global cap_ffmpeg.cpp:198 write FFmpeg: Failed to write frame
### 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
doc: fix doxygen warnings for imgcodecs, flann and objdetect #27730
Close https://github.com/opencv/opencv/issues/27729
### 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.
- [ ] The feature is well documented and sample code can be built with the project CMake
libpng upgrade to 1.6.45 and cICP metadata support for PNG imwrite #27741
### Pull Request Readiness Checklist
resolves#24185
libpng docs: https://www.w3.org/TR/png-3/#cICP-chunk
similar code from ffmpeg: a700f0f72d/libavcodec/pngenc.c (L452-L456)
So issue #24185 can be solved by replacing `cv.imwrite` in user's code to `cv.imwriteWithMetadata`:
```python
cv.imwriteWithMetadata("frame.png", frame, [cv.IMAGE_METADATA_CICP], np.array([[9, 18, 0, 1]], np.uint8))
```
```
$ exiftool /home/d.kurtaev/opencv_build/frames_pr/image_38.png
ExifTool Version Number : 12.76
File Name : image_38.png
Directory : /home/d.kurtaev/opencv_build/frames_pr
File Size : 3.8 MB
File Modification Date/Time : 2025:09:02 20:48:22+03:00
File Access Date/Time : 2025:09:02 20:48:22+03:00
File Inode Change Date/Time : 2025:09:02 20:48:22+03:00
File Permissions : -rw-r--r--
File Type : PNG
File Type Extension : png
MIME Type : image/png
Image Width : 1080
Image Height : 1920
Bit Depth : 8
Color Type : RGB
Compression : Deflate/Inflate
Filter : Adaptive
Interlace : Noninterlaced
Color Primaries : BT.2020, BT.2100
Transfer Characteristics : BT.2100 HLG, ARIB STD-B67
Matrix Coefficients : Identity matrix
Video Full Range Flag : 1
Image Size : 1080x1920
Megapixels : 2.1
```
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
fix: FFmpeg 8.0 support #27746
### Pull Request Readiness Checklist
related comment: https://github.com/opencv/opencv/pull/27691#discussion_r2322695640
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