Ask Your Question
1

GaussianBlur error with tutorial Camera-control

asked 2013-03-04 12:04:35 -0500

MysticBE gravatar image

I posted a little part of my code, cause i keep getting a strange error that I can't seem to get rid of. The problem can be found on this line: Imgproc.GaussianBlur(mGray, mGray, new Size (5,5), 2.2, 2);

public Mat onCameraFrame(Mat inputFrame) {

    mGray = new Mat();
    Imgproc.cvtColor(mRgba, mGray, Imgproc.COLOR_RGBA2GRAY);    
    // doing a gaussian blur prevents getting a lot of false hits
    Imgproc.GaussianBlur(mGray, mGray, new Size (5,5), 2.2, 2);
    // Values 3 and 4are the LowerThreshold and UpperThreshold.
    Imgproc.Canny(inputFrame, mIntermediateMat, 80, 100);
    Imgproc.cvtColor(mIntermediateMat,mRgba, Imgproc.COLOR_GRAY2BGRA, 4);
    return mIntermediateMat;


}

The error i get from Eclipse is: The method GaussianBlur(Mat,Mat,Size,double,double) in the type imgproc is not applicable for the arguments (Mat,Mat,CameraSize,int,int)

I am using an edited version of tutorial3 Camera-control where the output is shown as Canny's edge detection (all works fine) but I need the GaussianBlur to get rid of some of the smaller details. Does anyone know what exactly is wrong in this line of the code? Or an alternative which is better would also be appreciated.

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted
2

answered 2013-03-05 01:58:38 -0500

The problem is in Size class. Compiler tries to use Size class from Android SDK, but not from OpenCV SDK. Add import string for org.opencv.core package to begin of source file and specify more complite type name: new core.Size (5,5). Alternatively you can change import for Size class on OpenCV one, but source code will be not obvious.

edit flag offensive delete link more
0

answered 2013-03-04 13:48:35 -0500

xaffeine gravatar image

I would try making both of your sigmas double or both of them int. Or leave out the second sigma. You can also try a bilateral filter, which is may be a better idea, anyway.

edit flag offensive delete link more

Comments

I tried all of the above already, it doesn't help the problem. I'll look up the bilateral filter, but I am curious why this would be better? the filter is way slower then the Gaussian one, which affects the framerate

MysticBE gravatar imageMysticBE ( 2013-03-04 15:43:46 -0500 )edit

The bilateral can remove more noise without affecting edges as much as the gaussian. Yes, it is expected to be slower.

xaffeine gravatar imagexaffeine ( 2013-03-05 13:05:19 -0500 )edit
Login/Signup to Answer

Question Tools

Stats

Asked: 2013-03-04 12:04:35 -0500

Seen: 1,650 times

Last updated: Mar 05 '13