mirror of
https://github.com/opencv/opencv.git
synced 2026-10-28 16:46:46 +08:00
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