1 | initial version |
you can acess the pixels from java like:
Mat image = ...
byte [] data = new byte[mat.total() * mat.channels()];
image.get(0,0, data);
note, that this is an 1d array, and it's elements are bytes, not integers. you would treat it like:
byte value = data[ (y * mat.cols() + x) * mat.channels() ]
2 | No.2 Revision |
you can acess the pixels from java like:
Mat image = ...
byte [] data = new byte[mat.total() * mat.channels()];
image.get(0,0, data);
note, that this is an 1d array, and it's elements are bytes, not integers. you would treat it like:
byte value = data[ (y * mat.cols() + x) * mat.channels() ]
(ofc. mat.channels() == 1 for a grayscale image)
3 | No.3 Revision |
you can acess access the pixels from java like:
Mat image = ...
byte [] data = new byte[mat.total() * mat.channels()];
image.get(0,0, data);
note, that this is an 1d array, and it's elements are bytes, not integers. you would treat it like:
byte value = data[ (y * mat.cols() + x) * mat.channels() ]
(ofc. mat.channels() == 1 for a grayscale image)