Getting negative value of pixel openCV Java
In a java project when trying to access pixel value, I am getting negative value.
Code ::
Mat srcImage = imageToMatFormat(imgSource);
byte[] buffer = new byte[3];
for (int x = 0; x < srcImage.rows(); x++) {
for (int y = 0; y < srcImage.cols(); y++) {
srcImage.get(x, y, buffer);
if(buffer[0]!=0)
System.out.println(buffer[0] + buffer[1] + buffer[2]);
}
}
Some values that I am getting is
126-119-115
125-120-116
124-121-117
So what does this negative number in here signi
rather :
System.out.print(srcImage);
it is get(y,x), the type() of the Mat probably is not bytes, and
buffer[0] + buffer[1] + buffer[2]
is probably an addition, not a string concatenation@berak How is it
get(y,x)
when the we are parsing srcImage.rows for x and srcImage.cols for y?