Ask Your Question

Correct way to read depth images

asked 2013-03-14 11:52:17 -0500

Shin gravatar image

updated 2013-03-14 11:52:50 -0500

I need to use the dataset at and i'd like to know how to correctly read in the depth images using opencv.

I've uploaded one of these depth images here:

Thank you.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2013-03-14 12:42:14 -0500

xaffeine gravatar image

updated 2013-03-14 12:46:07 -0500

The pgm file format is a "portable gray map" described at There is also a wikipedia article about the netpbm standards.

Opencv imread is documented as being able to read these.

edit flag offensive delete link more


Thank you. Well, i was reading them using a cv::Mat object of type CV_16UC1. I'd like to know if some scaling operation is needed (considering that these are indeed kinect depth images) and that most opencv functions work with CV_8U matrixes.

Shin gravatar imageShin ( 2013-03-14 14:15:51 -0500 )edit

I would just look at the data and see what min and max values you find there. For display, you probably want to scale or normalize them before converting to 8 bit.

xaffeine gravatar imagexaffeine ( 2013-03-14 18:04:36 -0500 )edit

Question Tools


Asked: 2013-03-14 11:52:17 -0500

Seen: 2,112 times

Last updated: Mar 14 '13