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

Odometry: prepareRGBFrameBase asserts !depth.empty() #23103

Open
4 tasks done
JoeHowse opened this issue Jan 6, 2023 · 2 comments
Open
4 tasks done

Odometry: prepareRGBFrameBase asserts !depth.empty() #23103

JoeHowse opened this issue Jan 6, 2023 · 2 comments
Assignees
Labels
Milestone

Comments

@JoeHowse
Copy link
Contributor

JoeHowse commented Jan 6, 2023

System Information

OpenCV version: 5.x, commit d499581

Detailed description

prepareRGBFrameBase calls prepareScaleDepth, which asserts !depth.empty(). This assertion appears to be spurious because prepareRGBFrameBase is associated with the case OdometryType::RGB. OdometryType::RGB (unlike OdometryType::DEPTH and OdometryType::RGB_DEPTH) should not require a depth frame.

Steps to reproduce

The bug can be reproduced with Python code similar to the following, for any BGR images:

od = cv2.Odometry(cv2.ODOMETRY_TYPE_RGB)
odFrame1 = cv2.OdometryFrame(image=bgrFrame1)
odFrame2 = cv2.OdometryFrame(image=bgrFrame2)
od.prepareFrames(odFrame1, odFrame2)

This throws odometry_functions.cpp:49: error: (-215:Assertion failed) !depth.empty().

Issue submission checklist

  • I report the issue, it's not a question
  • I checked the problem with documentation, FAQ, open issues, forum.opencv.org, Stack Overflow, etc and have not found any solution
  • I updated to the latest OpenCV version and the issue is still there
  • There is reproducer code and related data files (videos, images, onnx, etc)
@asmorkalov
Copy link
Contributor

@savuor please take a look.

@savuor
Copy link
Contributor

savuor commented Jan 11, 2023

@JoeHowse Thanks a lot again!

The bug is not in the code but in the documentation.

All Odometry algorithms require depth data for calculation. Depth data for both frames is required to establish pixel-to-pixel correspondences at each iteration.
The difference is in the objective function they minimize:

  • OdometryType::RGB minimizes the difference in image pixels
  • OdometryType::DEPTH minimizes point-to-plane error (see KinectFusion paper)
  • OdometryType::RGB_DEPTH combines both

We need to fix the documentation: now it says that RGB requires image data only.

@asmorkalov asmorkalov added category: documentation Documentation fix or update and removed bug labels Jan 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants