Files
opencv/samples/python
yehsin b8f84264fb Merge pull request #30144 from Yehsin0815:fix-odometry-python-sample
samples: fix Python odometry sample for 5.x bindings - #30144

Fixes #30143

`samples/python/odometry.py` fails on 5.x:

- It uses `cv.DEPTH`, `cv.RGB` and `cv.RGB_DEPTH`, which the Python bindings don't export. The enum values are exposed as `cv.OdometryType_*`, the same names `modules/ptcloud/misc/python/test_odometry.py` uses. Every mode fails with `AttributeError`.
- RGB mode calls `compute(rgb1, rgb2, Rt)`, and that overload always raises "This odometry algorithm requires depth and rgb data simultaneously" (`modules/ptcloud/src/odometry.cpp`). The sample now loads the depth frames in RGB mode too and uses the 5-argument overload.

Tested with opencv-python 5.0.0.93 on Windows 11 and Linux: `--algo DEPTH`, `RGB`, `RGB_DEPTH` and the default (all modes) each run and print `Rt`.

This change was prepared with the help of an AI coding tool; I reviewed it and reproduced the bug and the fix locally.

### 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
- [ ] 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
2026-10-05 14:34:13 +03:00
..
2015-12-18 11:00:32 +03:00
2023-07-14 15:06:53 +03:00
2026-02-14 15:37:33 +03:00
2020-02-20 16:19:24 +03:00
2023-07-14 15:06:53 +03:00
2025-07-22 09:47:19 +03:00
2026-07-09 12:17:24 +03:00
2019-10-16 18:49:33 +03:00
2026-02-14 15:37:33 +03:00
2019-12-30 13:00:29 +00:00