Hello!
I am working on a blur detection with OpenCV for Android and used following code found here which seemed to work correctly:
http://answers.opencv.org/question/111798/android-blur-image-detection-with-opencv-results-into-heavy-apk-size/
Now, my problem is that it crashs, if the resolution of the image is too small. In the sample code the transformed image gets resized to 2000*2000, but only if it is bigger than that.
It happens here:
Imgproc.Laplacian(matImageGrey,
laplacianImage, CvType.CV_8U);
I have tested it serveral times and no crash with big images!
No crash image resolution: 1048 * 1048
Crash with resolution: 511*532
Does anybody now why this happens? It seems that there is a minimum image resolution size needed, but I can not find any info in the OpenCV documentation or in the internet.
UPDATE: Maybe someone can provide me a link to the C++ implementation of the laplacian funciton...can't find the code...should be open source?
Here a some working resolutions:
1713 x 1217;
537 x 562;
1089 x 563;
527 x 563;
522 x 542;
Not working resolutions:
511 x 532;
1662 x 562;
1661 x 562;
1662 x 563;
Test results! Maybe somebody sees a logic behind it:
1659 x 562: works
1660 x 562: works
1661 x 562: Application crash
1662 x 562: Application crash
1663 x 562: Application crash
1664 x 562: works
1665 x 562: works
1666 x 562: works
1667 x 562: works
1668 x 562: works
1669 x 562: works
I have a photo app where my users can crop images in different ratios like 4:3, 16:9 etc. Different ratios means different resulting image resolutions. The resolution is not only dependent by the ratio, but also by the zoom factor. The ratio is always the same, no matter how much the users zoomed in or out. The resolution is dependet on the zoom. The above resolutions represent the maximum resolution for the ratios I use for my app e.g. 1660x562 = 1:2.95 ratio. The cropped image with a ratio of 1:2.95 could have a resolution of 580x281(zoomed out). I then need to resize that image so I take the maxium supported size of 1660x562. I just adjusted the resolution until it did not crash. So instead of 1661x562 I took 1660x562 and it worked. I have 12 different resolutions/ratios for my app and 4 of them crashed. I just adjusted the resolution one pixel +/- until it worked. I still do not know what the problem is, but it works now.
Thanks!