I try to get the RGB Values of a pixel using mat.get(inx, int y) on Android and OpenCV 2.4.4.
Mat img = Utils.loadResource(getBaseContext(), R.drawable.ex3);
double[] tmp = img.get(100, 100);
if(printLog) Log.v(tag, "Color: "+ tmp[0] +","+ tmp[1] +","+ tmp[2] +"");
Normaly I got the tmp-Array returned. But at some pixels, i got returned "null". (That points are in range of the picture!)
So why I get at some coordinates a array and on some others "null" and how to fix that?
At OpenCV by getting pixelinformations with Mat.get(row, col) the meaning of X and Y is changed: Use Y for the row and X for the col.
Mat.get(Y, X);
So in my case I was out of range but openCV did not return a Exception. It returns "null"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With