Accessing pixel values in a depth image in OpenCV
I need to use the depth image from a Kinect sensor for my next project, but I'm still stuck in the basics. Obtaining a point cloud was way easier.
I tried to use cv_bridge to convert the /camera/depth/image_raw into an OpenCV matrix, and then, just to test it, I saved it in a .pgm and .jpg file. The image was there, but it doesn't look as I expected. Here's the image:
You can see the silhouette, but there are only two colors in the whole image, black and white and nothing in between. I expected a grayscale representation of depth in more shades. I tried printing out the first few pixels in the opencv matrix as floats and like the images would suggest, they are all zero, which doesn't seem right compared to the scene that I recorded. Therefore, it looks as the problem is in the cv_bridge conversion. What exactly should I do to get a proper depth image matrix?