Mat type CV_8U but ByteBuffer values range from -128 to 127
Hello guys,
I have a frame which has its type = 24. According to this table this means the frame is CV_8U, thus its values should be around 0 and 255.
I wanted to confirm that in fact the values I'm getting are 0-255, so I did the following: byte[] buff= new byte[frame.cols() * frame.rows() * 4]; //nº total de valores (3 canais)
frame.get(0,0,buff);
Log.d("frame type:","frame_type:"+frame.type());
max_pixel=-100;
min_pixel=100;
for(int i=0; i<frame.cols(); i++) {
for(int j=0; j<frame.cols(); j++) {
if (buff[i]>max_pixel) {
max_pixel=buff[i]; }
else if(buff[i]<min_pixel){
min_pixel=buff[i];
}
}
}
Log.d("max_pixel", "max_pixel:"+max_pixel);
Log.d("min_pixel", "min_pixel:"+min_pixel);
What I got from this was: (1) min_pixel = -128 (2) max_pixel = 127
Is this normal for a ByteBuffer? Because it seems like its type is a CV_8S instead
Thanks for the help!