Ask Your Question

mary's profile - activity

2020-03-26 12:01:18 -0600 received badge  Notable Question (source)
2017-07-01 06:08:21 -0600 received badge  Popular Question (source)
2016-07-11 21:33:55 -0600 received badge  Famous Question (source)
2015-08-29 16:32:56 -0600 received badge  Notable Question (source)
2015-05-23 06:06:10 -0600 received badge  Popular Question (source)
2014-09-18 22:49:45 -0600 received badge  Student (source)
2013-08-06 06:23:12 -0600 received badge  Teacher (source)
2013-08-01 03:18:38 -0600 received badge  Self-Learner (source)
2013-08-01 03:12:34 -0600 answered a question Detect if image is blurry

Finally I traslated a c++ good code that I had found in internet to java and it works very well. This is my code:

BitmapFactory.Options opt = new BitmapFactory.Options();
opt.inDither = true;
opt.inPreferredConfig = Bitmap.Config.ARGB_8888;
Bitmap image = BitmapFactory.decodeByteArray(im, 0, im.length);
int l = CvType.CV_8UC1; //8-bit grey scale image
Mat matImage = new Mat();
Utils.bitmapToMat(image, matImage);
Mat matImageGrey = new Mat();
Imgproc.cvtColor(matImage, matImageGrey, Imgproc.COLOR_BGR2GRAY);

Bitmap destImage;
destImage = Bitmap.createBitmap(image);             
Mat dst2 = new Mat();
Utils.bitmapToMat(destImage, dst2);
Mat laplacianImage = new Mat();
dst2.convertTo(laplacianImage, l);
Imgproc.Laplacian(matImageGrey, laplacianImage, CvType.CV_8U);
Mat laplacianImage8bit = new Mat();
laplacianImage.convertTo(laplacianImage8bit, l);

Bitmap bmp = Bitmap.createBitmap(laplacianImage8bit.cols(),
    laplacianImage8bit.rows(), Bitmap.Config.ARGB_8888);
Utils.matToBitmap(laplacianImage8bit, bmp);
int[] pixels = new int[bmp.getHeight() * bmp.getWidth()];
bmp.getPixels(pixels, 0, bmp.getWidth(), 0, 0, bmp.getWidth(),
    bmp.getHeight());

int maxLap = -16777216;

for (int i = 0; i < pixels.length; i++) {
if (pixels[i] > maxLap)
    maxLap = pixels[i];
}

int soglia = -6118750;      

if (maxLap < soglia || maxLap == soglia) {
    Log.d(MIOTAG, "blur image");
}
2013-07-19 04:58:45 -0600 commented answer Problem with Laplacian Filter

Thank you for your response! you're right! :)

2013-07-19 04:57:24 -0600 received badge  Scholar (source)
2013-07-19 04:57:18 -0600 received badge  Supporter (source)
2013-07-19 03:13:02 -0600 asked a question 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!

2013-07-17 09:50:50 -0600 commented answer Detect if image is blurry

I have searched in a carefully way before I posted this question, I have read the topics that you link but some of them are difficult to understand for me and other of them are written with language different from java, so I hoped to receive more help.

2013-07-17 08:47:02 -0600 received badge  Editor (source)
2013-07-17 08:42:58 -0600 asked a question Detect if image is blurry

Hello, I search a way to determine if an image is blurry or not in my Android application. I don't know opencv library and image processing but I read that I can use a Laplacian filter so I need help to understand how use it. Thank you!