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

How to publish disparity map? #1167

Closed
jorgemiar opened this issue Apr 14, 2020 · 14 comments
Closed

How to publish disparity map? #1167

jorgemiar opened this issue Apr 14, 2020 · 14 comments

Comments

@jorgemiar
Copy link

I’ve seen there is a disparity filter that can be turned on, but see no difference when visualising the depth stream through rviz. Where can I see the changes when applying this filter? Is it possible to publish a topic with the disparity map and another topic with the depth (in metres) already processed simultaneously?

@MartyG-RealSense
Copy link
Collaborator

MartyG-RealSense commented Apr 15, 2020

A filter type can be selected in the roslaunch instruction.

#742 (comment)

You can then define the specific settings of the filter in a rosrun dynamic_reconfigure command immediately after the roslaunch instruction. The link below has an example of using dynamic_reconfigure to define a filter selected in roslaunch.

#583

I hope that applying filter settings with a rosrun instruction will give you the results you need when the stream is visualised in RViz.

@jorgemiar
Copy link
Author

jorgemiar commented Apr 15, 2020

@MartyG-RealSense yes I’ve been able to turn on the filter by adding it to the roslaunch command however don’t know what topic the filter is being applied to?
Is it the depth topic? When visualising in rviz I saw no difference between turning the filter on or off. Maybe I’m visualising the wrong topic/data stream?

Also, I think the disparity filter is just on or off. It doesn’t have parameters that need changing through dynamic reconfigure but I’ll have to check.

@MartyG-RealSense
Copy link
Collaborator

A list of published topics is here:

https://github.com/IntelRealSense/realsense-ros#published-topics

camera/depth/image_rect_raw seems like a good candidate for a choice of topic.

@jorgemiar
Copy link
Author

In realsense-viewer, if you turn off the Disparity to Depth filter in the Depth Stream, I believe you get to see the Disparity map (instead of Depth Map), as the colors invert (This is logical as Disparity = (baseline * focal length)/depth is the inverse of depth).

Yes, I am checking camera/depth/image_rect_raw in RViz, yet I am seeing no change in the data even if I turn the disparity filter on. I have also checked individual pixel values when applying the filter and they still give me depth data instead of disparity data.

@jorgemiar
Copy link
Author

When turning the filter on, the following topics appear:

/camera/disparity_end/parameters_descriptions
/camera/disparity_end/parameters_updates
/camera/disparity_start/parameters_descriptions
/camera/disparity_start/parameters_updates

These don't seem to publish the disparity data as their data is of the dynamic_reconfigure type. When running rqt_reconfigure, however, no options appear for those topics.

@jorgemiar
Copy link
Author

jorgemiar commented Apr 15, 2020

As per the comment in #724 :

disparity - convert depth to disparity before applying other filters and back.

and also #826

could it be that the disparity filter changes to disparity and then back to depth again? So I can't actually see the disparity map?

Is there any way I can turn off disparity_end so that the data doesn't turn back into depth? @doronhi

I basically want the disparity map to be able to calculate the U-V-Disparity.

@MartyG-RealSense
Copy link
Collaborator

I wondered too about the "and back" part when I saw it. I agree that tagging Doronhi into the discussion was a good idea, as I researched this problem deeply and could not find a solution. I do apologize.

@doronhi
Copy link
Contributor

doronhi commented Apr 17, 2020

Some of the filters give better results when applied over the disparity image then over the depth image. A recommended scheme for using filters is mentioned in post-processing-filters.md
The "disparity" filter in the ROS wrapper enables the depth2disparity transform before some of the other filters and than the disparity2depth transform to produce the depth image again.
Therefor, when applied, it won't make any difference by itself but may improve the performance of other filters.
I hope that helps to explain what you see and apologize for the confusion and misunderstanding caused by the "and back" part. I will happily accept any description improvements.

@jorgemiar
Copy link
Author

@doronhi yeah understood! Thanks!

Is there no way of publishing the disparity map instead of the depth one then?

@MartyG-RealSense
Copy link
Collaborator

Hi @jorgemia Do you still require assistance with this case, please? Thanks!

@jorgemiar
Copy link
Author

jorgemiar commented May 17, 2020

@MartyG-RealSense I never got an answer so I used an alternative method and no longer need a disparity map...but publishing the disparity map as a topic could be a useful feature to have. Don’t think this should be a hard thing to implement as the camera already produces this and then transforms it into depth. So would be good to have an option which you can turn on.

@MartyG-RealSense
Copy link
Collaborator

MartyG-RealSense commented May 17, 2020

The link below has a suggestion about how to visualize a disparity map from stereo_image_proc in RViz or rqt:

https://gitee.com/null_937_5399/avoidance#local-planner

image

@MartyG-RealSense
Copy link
Collaborator

@jorgemia Do you require further assistance please or can this case be closed? Thanks!

@MartyG-RealSense
Copy link
Collaborator

Case closed due to no further comments received.

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

No branches or pull requests

3 participants