I tried to get up the following demo on Android (Java): https://docs.opencv.org/3.4.3/d2/dbd/tutorial_distance_transform.html but it crashes on running:
// Perform the watershed algorithm Imgproc.watershed(imgResult, markers);
The error message is:
"E/cv::error(): OpenCV(3.4.6) Error: Assertion failed (src.type() == CV_8UC3 && dst.type() == CV_32SC1) in void cv::watershed(cv::InputArray, cv::InputOutputArray), file /build/3_4_pack-android/opencv/modules/imgproc/src/segmentation.cpp, line 161 E/org.opencv.imgproc: imgproc::watershed_10() caught cv::Exception: OpenCV(3.4.6) /build/3_4_pack-android/opencv/modules/imgproc/src/segmentation.cpp:161: error: (-215:Assertion failed) src.type() == CV_8UC3 && dst.type() == CV_32SC1 in function 'void cv::watershed(cv::InputArray, cv::InputOutputArray)'"
Only changes I did was the kind of loading the image:
Mat srcOriginal = Utils.loadResource(SuperActivity.context_MainActivity, R.mipmap.cards);
But I think that shouldn't be the problem...
I'm grateful for every help, because I already tried a lot in fixing it.