I want to use a Mat object generated using openCV in JOGL, and therefore I need to convert it to a ByteBuffer of GL_RGBA type. what options do I have to do this?
1 Answer
i'm not sure, if a byte[] does the trick, but here we go:
Mat m;
byte[] bytes = new byte[ m.rows() * m.cols() * m.channels() ];
m.get(0,0, bytes);
(also note, that unless you're on android, opencv images tend to be 24bit bgr, not rgba, so you probably need to change the flag passed to JOGL, when uploading the texture)
1 Comment
gouessej
He can still use the byte array to fill a direct NIO byte buffer that he can pass to JOGL, it seems to be correct.