Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Problem with Laplacian Filter

Hello, I use opencv for Android and I would like to use a Laplacian Filter for the 8-bit greyscale image so I use the follow code:

Bitmap image = BitmapFactory.decodeByteArray(im, 0, im.length);
int l=CvType.CV_8UC1;
Mat matImage = new Mat();               
Utils.bitmapToMat(image, matImage); 
Mat matImageGrey = new Mat();
Imgproc.cvtColor(matImage,matImageGrey, Imgproc.COLOR_BGR2GRAY);
Mat matImageGrey8bit = new Mat();
matImageGrey.convertTo(matImageGrey8bit, l);

Bitmap destImage;
destImage=Bitmap.createBitmap(image);
Mat dst2=new Mat();
Utils.bitmapToMat(destImage, dst2); 
Mat laplacianImage = new Mat();
dst2.convertTo(laplacianImage, l);

Imgproc.Laplacian(matImageGrey8bit, laplacianImage, '2');

The problem is that my image (laplacianImage) is too dark. I don't know image processing but I think that the third parameter of the Laplacian function can be the reason but if I try to change it from '2' to '1' I have an exception.

07-19 10:09:31.331: E/cv::error()(19796): OpenCV Error: The function/feature is not implemented        (Unsupported combination of source format (=0), and destination format (=1)) in cv::Ptr<cv::BaseFilter> cv::getLinearFilter(int, int, cv::InputArray, cv::Point, double, int), file /home/reports/ci/slave_desktop/50-SDK/opencv/modules/imgproc/src/filter.cpp, line 3192

The question is: Why does it produce this exception? Thank you!

Problem with Laplacian Filter

Hello, I use opencv for Android and I would like to use a Laplacian Filter for the 8-bit greyscale image so I use the follow code:

Bitmap image = BitmapFactory.decodeByteArray(im, 0, im.length);
int l=CvType.CV_8UC1;
Mat matImage = new Mat();               
Utils.bitmapToMat(image, matImage); 
Mat matImageGrey = new Mat();
Imgproc.cvtColor(matImage,matImageGrey, Imgproc.COLOR_BGR2GRAY);
Mat matImageGrey8bit = new Mat();
matImageGrey.convertTo(matImageGrey8bit, l);

Bitmap destImage;
destImage=Bitmap.createBitmap(image);
Mat dst2=new Mat();
Utils.bitmapToMat(destImage, dst2); 
Mat laplacianImage = new Mat();
dst2.convertTo(laplacianImage, l);

Imgproc.Laplacian(matImageGrey8bit, laplacianImage, '2');

The problem is that my image (laplacianImage) is too dark. I don't know image processing but I think that the third parameter of the Laplacian function can be the reason but if I try to change it from '2' to '1' I have an exception.

07-19 10:09:31.331: E/cv::error()(19796): OpenCV Error: The function/feature is not implemented        (Unsupported combination of source format (=0), and destination format (=1)) in cv::Ptr<cv::BaseFilter> cv::getLinearFilter(int, int, cv::InputArray, cv::Point, double, int), file /home/reports/ci/slave_desktop/50-SDK/opencv/modules/imgproc/src/filter.cpp, line 3192

The question is: Why does it produce this exception? Thank you!