OpenCV encoding problem depth image

asked 2017-02-26 16:00:04 -0600

Alessio gravatar image

Hi, I'm facing some problems during the encoding of the depth image coming from a kinect sensor. The hardware is simulated on Vrep. The kinect is publishing a standard depth image and I have no problem at all if I try to visualize it on Rviz. It displays well showing a normal behavior.

If I try to do the same thing using a python node and OpenCV I have the following result. As you can see the Depth Image does not show a grey-scale behavior but it has some horizontal lines!

image description

Here the python code.

I have also tried with "passthrough" instead of 16UC1 but the result is the same.

def depth_callback(self, ros_image):
try:
    depth_image = self.bridge.imgmsg_to_cv2(ros_image,"16UC1")
    except CvBridgeError, e:
            print e

cv2.imshow("Depth Image", depth_image)
edit retag flag offensive close merge delete