Compare value of a 1x1 Mat to an int

asked 2015-08-21 22:35:05 -0500

nbun gravatar image

updated 2015-08-21 23:44:12 -0500

I want to compare a 1x1 Mat to an int to see if it passes a threshold. I do not know how to do this on android.

public Mat onCameraFrame(CameraBridgeViewBase.CvCameraViewFrame inputFrame) {
    rgbMat = inputFrame.rgba();
    bgrPixel= rgbMat.submat(1,2,1,2).clone();
    grayPixel = new Mat();
    Imgproc.cvtColor(bgrPixel, grayPixel, Imgproc.COLOR_RGBA2GRAY, 1);
    return rgbMat;
}
edit retag flag offensive close merge delete

Comments

3

how about this:

rgbMat = inputFrame.rgba();
grayMat = inputFrame.gray();
double [] grayPixel = grayMat.get(1,1);
int grayVal = (int)grayPixel[0];    // now do your comparison

return rgbMat;
berak gravatar imageberak ( 2015-08-21 23:56:28 -0500 )edit

How would I take grayVal and sample it over and over again till it reaches the right int?

nbun gravatar imagenbun ( 2015-08-22 04:41:07 -0500 )edit

sorry, i do not understand. ?? what is 'the right int' ?

berak gravatar imageberak ( 2015-08-22 04:42:52 -0500 )edit

I want the loop run until grayVal get hits the right value

nbun gravatar imagenbun ( 2015-08-22 16:27:10 -0500 )edit