Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to load image from byte array with an offset?

Hi,

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