Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OpenCV Error: Assertion failed (ksize.width > ...... for GaussianBlur

when I call Imgproc.GaussianBlur(dst, dst ,new Size(3,3),1); in my application it works perfectly fine. As soon as I increase the kernel size to new Size(4,4) or else I get an

OpenCV Error: Assertion failed (ksize.width > 0 && ksize.width % 2 == 1 && ksize.height > 0 && ksize.height % 2 == 1) in cv::createGaussianFilter, file

........\opencv\modules\imgproc\src\smooth.cpp, line 816 Caused by: CvException [org.opencv.core.CvException: cv::Exception: ........\opencv\modules\imgproc\src\smooth.cpp:816: error: (-215) ksize.width > 0 && ksize.width % 2 == 1 && ksize.height

0 && ksize.height % 2 == 1 in function cv::createGaussianFilter ] at org.opencv.imgproc.Imgproc.GaussianBlur_1(Native Method) at org.opencv.imgproc.Imgproc.GaussianBlur(Imgproc.java:533)

Can please someone put me on the right track for this? I have no idea where/what to look for this.

Thx.

like image 910
Mr.Fu Avatar asked Dec 17 '14 14:12

Mr.Fu


1 Answers

As I understood from the trace, you are only allowed to use new Size(x,y) where x and y are odd

like image 85
Hichamov Avatar answered Oct 23 '22 18:10

Hichamov