Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Convert OpenGL texture to OpenCV Mat

Is there any way to convert OpenGL's GLuint texture type to OpenCV's cv::Mat ?

like image 228
XterNalz Avatar asked Aug 28 '12 02:08

XterNalz


1 Answers

You may want to take a look at this question which asks about converting from glReadPixels into a cv::Mat, which is exactly the same problem when using glGetTexImage instead of glReadPixels.

My answer to this question explains how to directly read the texture data into the cv::Mat's storage with all possible pitfalls (like padding, color ordering, ...).

like image 84
Christian Rau Avatar answered Sep 18 '22 17:09

Christian Rau