Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

OpenCV Android- Using Imgproc.moments causes crash

In OpenCV 3.1, the Moments class is back in the Android SDK. Yay!!!

However, upon calling the Imgproc.moments function, any of the multiple declarations with either contours or masks as parameters, the app crashes. I am unable to find an error in logcat. I do not understand what's going wrong.

Is anyone else getting similar issues?

 cd.caploop();
 //Do image processing
    if (cd.getCon() != null) {
        telemetry.addData("area", "" + Imgproc.contourArea(cd.getCon()));
        Point center;
        //I want to store the centroid of the mask in the point 'center'
        //I also have access to the contour I want to use above
        //but however I try to compute the moments, I get a crash
        Moments m = Imgproc.moments(CurrentFrame.CURRENT_MASK);
    } else
        telemetry.addData("area", "not detected");
}

OpenCV Android- Using Imgproc.moments causes crash

In OpenCV 3.1, the Moments class is back in the Android SDK. Yay!!!

However, upon calling the Imgproc.moments function, any of the multiple declarations with either contours or masks as parameters, the app crashes. I am unable to find an error in logcat. I do not understand what's going wrong.

Is anyone else getting similar issues?

 cd.caploop();
 //Do image processing
    if (cd.getCon() != null) {
        telemetry.addData("area", "" + Imgproc.contourArea(cd.getCon()));
        Point center;
        //I want to store the centroid of the mask in the point 'center'
        //I also have access to the contour I want to use above
        //but however I try to compute the moments, I get a crash
        Moments m = Imgproc.moments(CurrentFrame.CURRENT_MASK);
Imgproc.moments(cd.getConn());
    } else
        telemetry.addData("area", "not detected");
}