I am trying to write an android app that allows for realtime processing of camera feed from a device to detect contours. Despite following many examples online, when I run the following code, an exception is thrown (also shown below).
Code:
Bitmap image = mTextureView.getBitmap();
Mat mat = new Mat();
Mat matConverted = new Mat();
Utils.bitmapToMat(image, mat);
mat.convertTo(matConverted, CvType.CV_32SC1);
List<MatOfPoint> contours = new ArrayList<>();
Imgproc.findContours(matConverted, contours, new Mat(), Imgproc.RETR_FLOODFILL,
Imgproc.CHAIN_APPROX_SIMPLE);
Exception:
CvException [org.opencv.core.CvException: cv::Exception:
/Volumes/Linux/builds/master_pack-android/opencv/modules/imgproc/src/contours.cpp:198:
error: (-210) [Start]FindContours supports only CV_8UC1 images when mode !=
CV_RETR_FLOODFILL otherwise supports CV_32SC1 images only in function _CvContourScanner*
cvStartFindContours(void*, CvMemStorage*, int, int, int, CvPoint)
Am I missing something obvious here?