Ask Your Question

Revision history [back]

You can use int Mat.get(int row, int col, byte[] data) method of Core.Mat object. Size of retrieved data depends on size of data array. You can call allocate byte array the same size, as matrix data and get all matrix elements. Your code will be like this:

byte[] data = new byte[mRgba.cols()*mRgba.rows()*mRgba.elemSize()];
mRgba.get(0, 0, data);
...
process(data);
...

You can use int Mat.get(int row, int col, byte[] data) method of Core.Mat object. Size of retrieved data depends on size of data array. You can call allocate byte array the same size, as matrix data and get all matrix elements. Put method works in the same manner. Your code will be like this:

byte[] data = new byte[mRgba.cols()*mRgba.rows()*mRgba.elemSize()];
mRgba.get(0, 0, data);
...
process(data);
...
mRgba.put(0, 0, data);