Giter Site home page Giter Site logo

Comments (3)

tpanzarella avatar tpanzarella commented on August 21, 2024

The o3d3xx-ros camera node uses the image_transport package to publish the OpenCV images. I just read this on the ROS wiki:

image_transport does not yet support Python, though it is on the Roadmap. If you need to interface a Python node with some compressed image transport, try interposing a republish node.

If you must use Python, to get around this, the suggestion is to use republish. I'm not sure if that fits your use case, but that seems to be the official suggestion as of Indigo (and Jade). Do you get this behavior using C++ as well?

from o3d3xx-ros.

andsmith avatar andsmith commented on August 21, 2024

You are converting to uint8 here: np.fromstring(msg.data,np.uint8. Did you try np.fromstring(msg.data,np.uint16?

It doesn't seem to matter what kind of integer np.fromstring converts it to; the imdecode converts it back to uint8.

If you must use Python, to get around this, the suggestion is to use republish.

Running a republish node (rosrun image_transport republish compressed in:=/o3d3xx/camera/depth raw out:=/depth) and then subscribing to /depth gets me an sensor_msgs.msg.Image message, that looks like this:

 msg.width:  176
 msg.height:  132
 len(msg.data):  23232
 msg.encoding:  'mono16'

The data array is exactly half the length it should be if it were really encoding a uint16 image. The CV bridge fails to decode this message, as expected:

  pic = cvb.imgmsg_to_cv2(msg)
  ...
  TypeError: buffer is too small for requested array

Casting to uint8 and reshaping to a 176 x 132 image, I see something that looks exactly like the incorrect uint8 image I described in my original comment.

The feeling I'm getting is that the compressed depth image does not contain all the info it should (i.e. all the info in the raw depth image).

Do you get this behavior using C++ as well?

I haven't tried it yet. This will be my next step before biting the bullet and using the raw topic.

from o3d3xx-ros.

kaixin-bai avatar kaixin-bai commented on August 21, 2024

is it possible to convert a mono16 depth image back to the raw depth data?

from o3d3xx-ros.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.