How to load image from byte array with an offset?

asked 2017-07-18 05:38:05 -0600

Genom gravatar image


I would like to load an image from Java primitive byte array into a Mat object. However, the JPG formatted image is within a larger byte array (a raw file but this doesn't matter). I can locate the JPG file embedded in a raw file. I would like to use this subset of primitive byte array to get a Mat object of this embedded JPG file. Java doesn't allow subsetting a primitive array without copying it. MatOfBytes accepts the whole buffer and I can't pass offset or length values. It also doesn't allow to use a ByteBuffer. Is there any other way of accomplishing this in OpenCV?

Best, Genom

edit retag flag offensive close merge delete