Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calibration fixes: Supporting OpenCV prior to and after breaking changes in 4.7 #138

Merged
merged 21 commits into from
Sep 9, 2024

Conversation

glvov-bdai
Copy link
Collaborator

@glvov-bdai glvov-bdai commented Sep 4, 2024

In OpenCV 4.7.0, charuco was moved from the contrib part of opencv to the core part of opencv (https://github.com/opencv/opencv/pull/22986/files#diff-09508dfcb283f5b8f2e58538584a58ce28d369f8c7e23705f004f7d15e6f40e9). Previously, the code assumed an OpenCV version prior to 4.7.0.

This adds an explicit check for the opencv version prior to prior to many charuco operations, so that the correct charuco method can be called for opencv>=4.7 despite the breaking change in 4.7

More information about OpenCV changes:
opencv/opencv#26126

This also adds an explicit dependency on opencv. Previously, this dependency was likely implicitly included if you use the spot_ros2 package (due to dependency on things like cv bridge), but this not cover the use case of using spot_wrapper completely independently of ROS2.

It is better to check OpenCV version, and adjust behavior accordingly, then just depending on opencv-contrib-python, as
depending on contrib can break existing versions of OpenCV on your system when the requirements.txt is installed

Testing:

Tested on physical robot. For code changes with OpenCV, verified the results in prior to 4.7 and after:
opencv/opencv#26126

Copy link
Collaborator Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @glvov-bdai and the rest of your teammates on Graphite Graphite

@coveralls
Copy link

Pull Request Test Coverage Report for Build 10703859405

Details

  • 0 of 10 (0.0%) changed or added relevant lines in 3 files are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage decreased (-0.05%) to 42.626%

Changes Missing Coverage Covered Lines Changed/Added Lines %
spot_wrapper/calibration/calibrate_multistereo_cameras_with_charuco_cli.py 0 1 0.0%
spot_wrapper/calibration/calibrate_spot_hand_camera_cli.py 0 1 0.0%
spot_wrapper/calibration/calibration_util.py 0 8 0.0%
Files with Coverage Reduction New Missed Lines %
spot_wrapper/calibration/calibrate_multistereo_cameras_with_charuco_cli.py 1 0.0%
Totals Coverage Status
Change from base Build 10686271922: -0.05%
Covered Lines: 1867
Relevant Lines: 4380

💛 - Coveralls

@coveralls
Copy link

coveralls commented Sep 4, 2024

Pull Request Test Coverage Report for Build 10774998334

Details

  • 0 of 165 (0.0%) changed or added relevant lines in 4 files are covered.
  • 9 unchanged lines in 3 files lost coverage.
  • Overall coverage decreased (-1.3%) to 41.415%

Changes Missing Coverage Covered Lines Changed/Added Lines %
spot_wrapper/calibration/spot_in_hand_camera_calibration.py 0 2 0.0%
spot_wrapper/calibration/calibrate_spot_hand_camera_cli.py 0 3 0.0%
spot_wrapper/calibration/calibrate_multistereo_cameras_with_charuco_cli.py 0 40 0.0%
spot_wrapper/calibration/calibration_util.py 0 120 0.0%
Files with Coverage Reduction New Missed Lines %
spot_wrapper/calibration/calibrate_spot_hand_camera_cli.py 1 0.0%
spot_wrapper/calibration/calibration_util.py 4 0.0%
spot_wrapper/calibration/calibrate_multistereo_cameras_with_charuco_cli.py 4 0.0%
Totals Coverage Status
Change from base Build 10686271922: -1.3%
Covered Lines: 1867
Relevant Lines: 4508

💛 - Coveralls

@glvov-bdai glvov-bdai marked this pull request as draft September 4, 2024 20:49
@glvov-bdai glvov-bdai self-assigned this Sep 4, 2024
@glvov-bdai glvov-bdai changed the title Calibration fixes: better charuco creation Calibration fixes: Supporting OpenCV prior to and after breaking changes in 4.7 Sep 5, 2024
@glvov-bdai glvov-bdai marked this pull request as ready for review September 6, 2024 18:46
@@ -7,9 +7,11 @@ bosdyn-mission==4.0.2
grpcio==1.59.3
image==1.5.33
inflection==0.5.1
opencv-python>=4.5.4
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a way to not add this here? When you depend on opencv via rosdep in ros 1 or ros 2, it is pulled in via apt. We have had problems in the past with conflicting versions of opencv between apt and pip.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jbarry-bdai @khughes-bdai @tcappellari-bdai Thoughts? It should be a dependency for this to be a stand alone package, but then spot_ros2 needs to uninstall it similar to what we do elsewhere which isn't great.

Copy link
Collaborator Author

@glvov-bdai glvov-bdai Sep 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@amessing-bdai I would maybe suggest just splitting up the requirements.txt between spot_ros2 and spot_wrapper if possible, and then using that to manage dependencies for both independently. Not sure if there's a good reason to share a requirements.txt (other than potentially maintainability) that I am not aware of/not thinking of

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ya i like gary's suggestion of splitting them up (assuming that wouldn't break everything lol)

Copy link
Collaborator Author

glvov-bdai commented Sep 9, 2024

Merge activity

@glvov-bdai glvov-bdai merged commit 0a58923 into main Sep 9, 2024
7 checks passed
@glvov-bdai glvov-bdai deleted the 09-04-calibration_fixes_better_charuco_creation branch September 9, 2024 18:57
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.

4 participants