DepthMap with glreadPixels

Hello everyone,

I’m trying to get a depthmap of the scene using glreadpixels, mi command is it:

glReadPixels(0, 0, img.cols, img.rows, GL_DEPTH_COMPONENT, GL_FLOAT, img.data);

and save it in a openCV mat. When I use to get the scene and save intop a cv::mat it’s working but when I try to get the depth component I get the image four times and two times the images are reversed (I can’t put the image here I don’t know why :frowning: ).

so anybody knows what is the problem?

this is the image: imageshack.us/a/img267/2125/depthmap.png

I found the problem, is the data type of the mat that I was saving the image. Sorry for the post