Absdiff between channels crashes (Android)

asked 2018-05-01 16:03:47 -0500

iss gravatar image

Hi, I would like to find all the gray pixels (R-G<10)and (G-B<10) but the absdiff line crashes every time if I remove it and give cvtColor(bgr.get(0) for example it works fine. I tried converting to float before and back to int after but it did not solve the problem ` using opencv341

    public Mat onCameraFrame(CvCameraViewFrame inputFrame) {
    rgba = inputFrame.rgba();
    ArrayList<Mat> bgr=new ArrayList<Mat>();
    Mat diff=new Mat();

    Core.split(rgba, bgr);
    Core.absdiff(bgr.get(0),bgr.get(1), diff);
    Imgproc.cvtColor(diff, rgba, Imgproc.COLOR_GRAY2BGRA, 4);
    return rgba;
}

Thank you

edit retag flag offensive close merge delete