Skip to content

Conversation

@asmorkalov
Copy link
Contributor

@asmorkalov asmorkalov commented Oct 22, 2025

OpenCV Contrib: opencv/opencv_contrib#4028

#27736 from s-trinh:use_USAC_P3P_in_solvePnP
#27810 from D00E:known-foreground-mask
#27841 from dkurt:ffmpeg_camera
#27866 from JayPol559:4.x
#27876 from MaximSmolskiy:fix_charuco_board_pattern_in_generate_pattern.py
#27883 from asmorkalov:as/win32_warning_fix
#27889 from Xingchen1224:4.x
#27893 from asmorkalov:as/no_return_fix
#27895 from asmorkalov:as/unreachible_gapi
#27897 from asmorkalov:as/alernative_win_arm_neon_check
#27900 from MaximSmolskiy:refactor-minEnclosingCircle-tests
#27903 from victorget:dev/ipp_hal_threading
#27904 from MaximSmolskiy:fix_minEnclosingCircle
#27906 from asmorkalov:as/cairosvg
#27908 from badshah400:4.x
#27909 from DasoTD:fix-ambiguous-rect-assignment
#27910 from MaximSmolskiy:add_corner_cases_tests_for_minEnclosingCircle
#27914 from MaximSmolskiy:refactor_minEnclosingCircle
#27919 from Kumataro:fix27830
#27920 from MaximSmolskiy:support_qr_decomposition_for_stereoCalibrate
#27922 from Kumataro:fix27921
#27923 from cudawarped:move_throw_no_cuda_to_stub
#27926 from MaximSmolskiy:add_comments_for_fisheye_undistortPoints

Moved to contrib:
#27443 from ritamelo06:gapi-feature
#27887 from asmorkalov:as/flacky_gapi
#27898 from asmorkalov:as/gapi_warning_fix_more
#27915 from MaximSmolskiy:fix_ml_kdtree_findNearest

Manually ported before:
#27890 from Kumataro:fix26899

Previous "Merge 4.x": #27879

ritamelo06 and others added 30 commits June 13, 2025 14:11
Implemented:

- A C++ proxy class PythonCustomStreamSource that implements the
  IStreamSource interface. This class acts as a bridge between
  G-API’s internal streaming engine and user-defined Python
  objects. Internally, it stores a reference to a Python object
  (PyObject*) and is responsible for: calling the Python object’s
  pull() method to retrieve the next frame, calling the descr_of()
  method to obtain the frame format description, acquiring and
  releasing the Python GIL as needed, converting the returned
  numpy.ndarray into cv::Mat, and handling any exceptions or
  conversion errors with proper diagnostics.

- A Python-facing factory function, cv.gapi.wip.make_py_src(),
  which takes a Python object as an argument and wraps it into a
  cv::Ptr<IStreamSource>. Internally, this function constructs a
  PythonCustomStreamSource instance and passes the Python object to
  it. This design allows Python users to define any class that
  implements two methods: pull() and descr_of(). No subclassing or
  special decorators are required on the Python side. The user
  simply needs to implement the expected interface.

Co-authored-by: Leonor Francisco <leonor.francisco@tecnico.ulisboa.pt>
Fixed warnings produced by x86 builds on Windows.
Skip LimitedSourceInfer.ReleaseFrameAsync test in CI as it hangs sporadically
fix: Refactor tuple creation in nlm.cu for fixing nvcc build…
…pattern_in_generate_pattern.py

Fix charuco_board_pattern in generate_pattern.py opencv#27876

### Pull Request Readiness Checklist

Fix opencv#27871 

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
Fixed -Wretrun-type warning in Highgui
Removed unreachible code reported by MS Visual Studio on Windows
…_neon_check

Enabled fp16 conversions, but disabled NEON FP16 arithmetics on Windows for ARM for now opencv#27897

### Pull Request Readiness Checklist

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

- [x] I agree to contribute to the project under Apache 2 License.
- [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
- [ ] The PR is proposed to the proper branch
- [ ] There is a reference to the original bug report and related work
- [ ] There is accuracy test, performance test and test data in opencv_extra repository, if applicable
      Patch to opencv_extra has the same branch name.
- [ ] The feature is well documented and sample code can be built with the project CMake
2025-10-14T05:53:31.5387050Z C:\GHA-OCV-1\_work\ci-gha-workflow\ci-gha-workflow\opencv\modules\imgcodecs\src\bitstrm.cpp(156,57): warning C4244: 'argument': conversion from 'int64_t' to 'ptrdiff_t', possible loss of data [C:\GHA-OCV-1\_work\ci-gha-workflow\ci-gha-workflow\build\modules\imgcodecs\opencv_imgcodecs.vcxproj]

### Pull Request Readiness Checklist

Optional Known Foreground Mask for Background Subtractors opencv#27810

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

### Description
This adds an optional foreground input mask parameter to the MOG2 and KNN background subtractors, in line with issue opencv#26476

4 tests are added under test_bgfg2.cpp:
2 for each subtractor type (1 with shadow detection and 1 without)
A demo shows the feature with only 3 parameters and with a 4th optional foreground mask for both core subtractor types.

Note: To patch contrib inheritance of the background subtraction class, empty apply method which throws a not implemented error is added to contrib subclasses. This is done to keep the overloaded apply function as pure virtual. Contrib PR to be made and linked shortly.  
Contrib Repo Paired Pull Request: opencv/opencv_contrib#4017
…ective in IPP HAL.

- Changed splitting logic to improved performance for all warp related functions in IPP HAL for multithreaded mode.
- Removed IPP 7.0 preprocessor condition from warp in IPP HAL, since unsupported.
- Added preprocessor condition to enforce IPP warp calls for custom builds.
…ingCircle-tests

Refactor minEnclosingCircle tests opencv#27900

### Pull Request Readiness Checklist

Separate input points for tests

Before this, next input points depended on previous ones and it was not obvious which input points specific test checked

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
Use `link_libraries` instead of `add_defintions` to link against Qt 6.9
and newer to avoid un-expanded generator expressions from Qt cmake files
being appended to linker flags when building the HighGUI module.

The actual bug is likely in how Qt cmake files end up with these
un-expanded generator expressions in the first place — see discussion in
https://bugreports.qt.io/browse/QTBUG-134774 — but the recommended way
to link against the library is to use `link_libraries` anyway, so this
fix should do the trick.

Fixes issue opencv#27223.
…ment

Fix ambiguous operator error in Rect assignment for C++ modules
Fixed linking for HighGUI against Qt 6.9 and newer
…ests_for_minEnclosingCircle

Add corner cases tests for minEnclosingCircle
core: support 16 bit LUT opencv#27890

Close opencv#26899

### 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
Use cairosvg for pattern rendering to get rid of double resize. opencv#27906

Depends on opencv/ci-gha-workflow#269

### 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
Fixed parallel invoke for warp perspective for best performance
s-trinh and others added 19 commits October 16, 2025 15:21
Update Gao P3P with Ding P3P opencv#27736

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

---

The current Gao P3P implementation does not cover all the degenerate cases, **see last line** in: https://github.com/opencv/opencv/blob/6d889ee74c94124f6492eb8f0d50946d9c31d8e9/modules/calib3d/src/p3p.cpp#L211-L221

See also:
- opencv#4854

---

<details>

<summary>OBSOLETE</summary>

To fix this, the USAC P3P from OpenCV 5 is used instead: https://github.com/opencv/opencv/blob/7e6da007cddcf83a527dfda95d57228fa5a535d3/modules/3d/src/usac/pnp_solver.cpp#L282

---

## Some results

### Old P3P vs new

In the following video, I have tried to highlight the viewpoints which cause issues:

https://github.com/user-attachments/assets/97bec6a6-4043-4509-b50e-a9856d6423bd

| | Old P3P    | New P3P |
| -------- | ------- | ------- |
| Mean (ms)  | 0.045701 | 0.024816 |
| Median (ms) | 0.025146 | 0.023193 |
| Std (ms)    | 0.028953    | 0.006124 |

### New P3P vs AP3P

https://github.com/user-attachments/assets/eaeb21dc-3ffd-4b6c-9902-4352f824aa45

The AP3 method is superior both in term of accuracy and computation time:

| | New P3P    | AP3P |
| -------- | ------- | ------- |
| Mean (ms)  | 0.043750 | 0.023442 |
| Median (ms) | 0.023193 | 0.021484 |
| Std (ms)    | 0.039920 | 0.005265 |

### New P3P vs AP3P (range test)

https://github.com/user-attachments/assets/572e7b7a-2966-4bed-8e0c-b93d863987dc

The implemented P3P method does not work well when the tag is small, at long range.

| | New P3P    | AP3P |
| -------- | ------- | ------- |
| Mean (ms)  | 0.031351 | 0.025189 |
| Median (ms) | 0.022217 | 0.020996 |
| Std (ms)    | 0.024920 | 0.009633 |

---

- I have tried to simplify the P3P code, hope I did not break the implementation code
- calculations are performed using double type for simplicity.
- code such as the following are redundant and no more needed and should be replaced by `cv::Rodrigues`:

https://github.com/opencv/opencv/blob/6d889ee74c94124f6492eb8f0d50946d9c31d8e9/modules/calib3d/src/usac/pnp_solver.cpp#L395

</details>
Open camera device by index through FFmpeg opencv#27841

### Pull Request Readiness Checklist

resolves opencv#26812

Example of explicit backend option (similar to `-f v4l2` from command line)
```
export OPENCV_FFMPEG_CAPTURE_OPTIONS="f;v4l2"
```
see https://trac.ffmpeg.org/wiki/Capture/Webcam for available options

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
…sition_for_stereoCalibrate

Support QR decomposition for stereoCalibrate
…t included in the same file that requires cudart
imgcodecs: Workaround for image flipping bug in older GDAL FITS drivers
imgcodecs: GDAL: show GDAL version at OpenCV configuration
…_stub

[core][cuda] Move throw_no_cuda to it an independant stub
…isheye_undistortPoints

Add comments for fisheye::undistortPoints
Fix HDR tutorial result mismatch by adding gamma note opencv#27866

This PR fixes opencv#22219 by clarifying the gamma correction value in the HDR tutorial.

The function cv.createTonemap() has a default gamma value of 1.0. To match the tutorial example results, gamma should be explicitly set to 2.2. This note has been added to the Tonemap HDR image section of the tutorial.
feat: G-API: Custom stream sources in Python (opencv#27276)
@asmorkalov
Copy link
Contributor Author

pylint fixes: #27932

@asmorkalov asmorkalov self-assigned this Oct 23, 2025
@asmorkalov asmorkalov merged commit 98bf72b into opencv:5.x Oct 23, 2025
35 of 51 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.