Reputation: 185
I'm trying to use Laplacian in my app:
Bitmap result = source.copy(source.getConfig(), true);
Utils.bitmapToMat(source, in);
Imgproc.Laplacian(in, out, 3, 3, 1, 0);
Utils.matToBitmap(out, result);
But I get the following error:
E/cv::error()﹕ OpenCV Error: Assertion failed (src.type() == CV_8UC1 || src.type() == CV_8UC3 || src.type() == CV_8UC4) in void Java_org_opencv_android_Utils_nMatToBitmap2(JNIEnv*, jclass, jlong, jobject, jboolean)
Upvotes: 0
Views: 1306
Reputation: 2164
According to documentation Utils.matToBitmap
accepts only Mat
of CV_8U
depth. In your example you specify output depth to CV_16S
. You should specify output depth for Imgproc.Laplacian
, as follows:
Imgproc.Laplacian(in, out, CvType.CV_8U, 3, 1, 0);
Utils.matToBitmap(out, result);
See documentation for Laplacian.
Upvotes: 2