Question

I'm newbie OCV and android developer. I want Imgproc.GaussianBlur filter in my app. When i use it application send "application stopped". I only add 3 lines to "OpenCV Tutorial 3 - Camera Control":

public Mat onCameraFrame(CvCameraViewFrame inputFrame) {
    Mat mat = inputFrame.gray();
    org.opencv.core.Size s = mat.size();
    Imgproc.GaussianBlur(mat, mat, s, 2);
    return mat;
}

What could be wrong? I have Lenovo A820 Android 4.1.2 and tried it on OpenCV 2.4.4, 2.4.5 and 2.4.6. I tried different API. The Imgproc.Sobel(mat,mat,-1,1,1); filter works good.

Was it helpful?

Solution

look at the docs for GaussianBlur

it says: "ksize – Gaussian kernel size. ksize.width and ksize.height can differ but they both must be positive and odd."

so, imho, you confused the kernel size with the Mat's size, try something like:

Mat mat = inputFrame.gray();
org.opencv.core.Size s = new Size(3,3);
Imgproc.GaussianBlur(mat, mat, s, 2);
return mat;
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top