Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Android jpeg byte array to mat

Hi everyone,

i'm new on opencv android development. I'm receiving a jpeg byte array on android client by sockets. On server side, a c++ program encodes a mat frame to jpeg before send. I'm receiving at 18fps on android phone with encoding. it's good, but i only have a byte array. I don't know how to decode jpeg to Mat object. I'm looking for a function like c++ Highgui.imdecode(inbuf, IMREAD_UNCHANGED). Can i use this using jni? If yes, how can i use byte[] frame from java in jni function? and, how can i return the mat objet?

Thanks!

click to hide/show revision 2
retagged

updated 2014-07-10 12:31:34 -0600

berak gravatar image

Android jpeg byte array to mat

Hi everyone,

i'm new on opencv android development. I'm receiving a jpeg byte array on android client by sockets. On server side, a c++ program encodes a mat frame to jpeg before send. I'm receiving at 18fps on android phone with encoding. it's good, but i only have a byte array. I don't know how to decode jpeg to Mat object. I'm looking for a function like c++ Highgui.imdecode(inbuf, IMREAD_UNCHANGED). Can i use this using jni? If yes, how can i use byte[] frame from java in jni function? and, how can i return the mat objet?

Thanks!