Commit Graph

8 Commits

Author SHA1 Message Date
Shawn
0a4e150127 Merge pull request #30597 from ShawnNotFound:fix-20979-python-empty-umat
stitching: wrap default constructors of ImageFeatures, MatchesInfo and CameraParams - #30597

Fixes #20979

`cv2.detail_ImageFeatures()`, `cv2.detail_MatchesInfo()` and `cv2.detail_CameraParams()` have no wrapped constructor, so the Python bindings create the object without running the C++ constructor and the fields are left zero-filled:

- reading `ImageFeatures().descriptors` copies a zeroed `UMat` and segfaults
- `MatchesInfo()` returns `src_img_idx`/`dst_img_idx` 0 instead of -1
- `CameraParams()` returns `focal` 0.0 and `R` None instead of 1 and the identity

This marks the existing default constructors of `MatchesInfo` and `CameraParams` as `CV_WRAP` and adds one for `ImageFeatures` (`img_idx(0)`), so the generator emits a constructor for all three. Stitching is only wrapped for Python, so other bindings are not affected.

### Testing

Added `stitching_detail_default_construct_test` to `modules/stitching/misc/python/test/test_stitching.py`. Without the fix the `ImageFeatures` test segfaults and the other two fail on the default values. With the fix, `test_stitching.py` (10 tests) and `opencv_test_stitching` (22 tests) pass locally (Linux x86-64, GCC 13, Python 3.13).

### 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
2026-11-17 12:14:36 +03:00
Andrew Chinery
26a7647e0e Fix stitching Python bindings PR #22329 2022-09-13 14:35:42 +01:00
Oguzhan Guclu
38788a3161 Merge pull request #21803 from oguzhanguclu:matches_info_pybinding
python binding for matches and inliers_mask attributes of cv2.detail_MatchesInfo class

* making matches and inliers_mask attributes of cv2.detail_MatchesInfo class accessible from python interface

* binding test for cv2.detail_MatchesInfo class
2022-04-01 22:13:14 +00:00
Tejas M R
676a724491 Merge pull request #21180 from tezz-io:4.x
Added CV_PROP_RW macro to keypoints

* Added CV_PROP_RW macro to keypoints

As outlined in the feature request in the issue https://github.com/opencv/opencv/issues/21171 : the keypoints field has been made parsable by the bindings.

* Added test for keypoints

Added test to check if the CV_PROP_RW macro added in the previous commit makes keypoints public and accessible through the python API.
2021-12-05 12:47:44 +00:00
Alexander Alekhin
fa25faa2d2 Merge remote-tracking branch 'upstream/3.4' into merge-3.4 2020-08-06 14:15:52 +00:00
danielenricocahall
f2ca7e664a add python binding and tests for composePanorama
fix tests

    pick 54039c2afd add python binding and tests for composePanorama
2020-08-02 19:29:16 -04:00
Alexander Alekhin
4635356435 Merge remote-tracking branch 'upstream/3.4' into merge-3.4 2019-04-13 20:00:54 +00:00
Alexander Alekhin
a0a1fb5fec python: discover tests from module/misc/python/test paths 2019-04-10 18:35:35 +00:00