Blur() segfaults on CentOS Linux release 7.5

In my application i use blur as follows but it triggers a segmentation fault all time. I tried with Size(image.cols,image.rows) but not helped.

blur(image,image,Size(3,3));

terminate called after throwing an instance of ‘cv::Exception’
what(): OpenCV(4.5.0-dev) /openCV/opencv/modules/imgproc/src/filter.simd.hpp:100: error: (-215:Assertion failed) this_.roi.x >= 0 && this_.roi.y >= 0 && this_.roi.width >= 0 && this_.roi.height >= 0 && this_.roi.x + this_.roi.width <= this_.wholeSize.width && this_.roi.y + this_.roi.height <= this_.wholeSize.height in function ‘FilterEngine__start’

Aborted


please help to resolve this issue.

please check image.size() – your input is either invalid, or smaller than the filter

1 Like

and it’s not a segmentation fault. it’s a violated assertion.

1 Like

Input size is 1280,720 that is as expected. My sample application worked with same blur function but in live streaming it is failing.

thanks for your response.

how can we help you if you won’t post source code?

height and width keep changing for different sizes
Mat image = Mat::zeros(height, width, CV_8UC4);
image.data = framePtr;//data of height*width *4
cv::blur(image,image,cv::Size(image.cols,image.rows));

error -
terminate called after throwing an instance of ‘cv::Exception’
what(): OpenCV(4.5.0-dev) /root/Sudarshan/openCV/opencv/modules/imgproc/src/filter.simd.hpp:100: error: (-215:Assertion failed) this_.roi.x >= 0 && this_.roi.y >= 0 && this_.roi.width >= 0 && this_.roi.height >= 0 && this_.roi.x + this_.roi.width <= this_.wholeSize.width && this_.roi.y + this_.roi.height <= this_.wholeSize.height in function ‘FilterEngine__start’

Aborted

the Size argument refers to the filter / kernel size, not to the image size.

please try to find out, what a box filter does, and why it makes not much sense to have one in the size of the whole image