Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Bilateral filter error, Assertion failed ((src.type() == CV_8UC1 || src.type() == CV_8UC3) && src.data != dst.data)

My code is shown in the following:

Bitmap b = BitmapFactory.decodeResource(getResources(), R.drawable.image1);
int width = b.getWidth();
int height =  b.getHeight();
Mat tmp = new Mat (width, height, CvType.CV_8UC3);
Mat tmp2 = tmp.clone();
Utils.bitmapToMat(b, tmp);
Imgproc.bilateralFilter(tmp,tmp2,10,50,10);

and give the following error,

OpenCV Error: Assertion failed ((src.type() == CV_8UC1 || src.type() == CV_8UC3) && src.data != dst.data) in void cv::bilateralFilter_8u(const cv::Mat&, cv::Mat&, int, double, double, int), file /Volumes/Linux/builds/master_pack-android/opencv/modules/imgproc/src/smooth.cpp, line 3145

May i ask what's wrong with my code, Thanks a lot!!

click to hide/show revision 2
retagged

updated 2016-06-11 16:48:52 -0600

berak gravatar image

Bilateral filter error, Assertion failed ((src.type() == CV_8UC1 || src.type() == CV_8UC3) && src.data != dst.data)

My code is shown in the following:

Bitmap b = BitmapFactory.decodeResource(getResources(), R.drawable.image1);
int width = b.getWidth();
int height =  b.getHeight();
Mat tmp = new Mat (width, height, CvType.CV_8UC3);
Mat tmp2 = tmp.clone();
Utils.bitmapToMat(b, tmp);
Imgproc.bilateralFilter(tmp,tmp2,10,50,10);

and give the following error,

OpenCV Error: Assertion failed ((src.type() == CV_8UC1 || src.type() == CV_8UC3) && src.data != dst.data) in void cv::bilateralFilter_8u(const cv::Mat&, cv::Mat&, int, double, double, int), file /Volumes/Linux/builds/master_pack-android/opencv/modules/imgproc/src/smooth.cpp, line 3145

May i ask what's wrong with my code, Thanks a lot!!