Reputation: 73
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?
Upvotes: 1
Views: 3356
Reputation: 39786
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)
Upvotes: 6