1 | initial version |
You can use OpenCV inbuilt filter2D instead your own.
Mat src=imread("dst.jpg");
Mat dst;
Mat kernel=(Mat_<float>(3,3)<< 1/9.0, 1/9.0, 1/9.0,\
1/9.0, 1/9.0, 1/9.0,\
1/9.0, 1/9.0, 1/9.0);
filter2D(src, dst,-1, kernel,Point(-1,-1),0,BORDER_DEFAULT );
2 | No.2 Revision |
You can use OpenCV inbuilt filter2D instead your own.
Mat src=imread("dst.jpg");
src=imread("img.jpg");
Mat dst;
Mat kernel=(Mat_<float>(3,3)<< 1/9.0, 1/9.0, 1/9.0,\
1/9.0, 1/9.0, 1/9.0,\
1/9.0, 1/9.0, 1/9.0);
filter2D(src, dst,-1, kernel,Point(-1,-1),0,BORDER_DEFAULT );
3 | No.3 Revision |
In your code probably you are passing 3 channel image and accessing pixel value using 'uchar', so either pass gray image or use vec3b
to access pixel value.
You can use OpenCV inbuilt filter2D instead your own.
Mat src=imread("img.jpg");
Mat dst;
Mat kernel=(Mat_<float>(3,3)<< 1/9.0, 1/9.0, 1/9.0,\
1/9.0, 1/9.0, 1/9.0,\
1/9.0, 1/9.0, 1/9.0);
filter2D(src, dst,-1, kernel,Point(-1,-1),0,BORDER_DEFAULT );
4 | No.4 Revision |
In As Martin Peris said in your code probably you are passing 3 channel image and accessing pixel value using 'uchar', so either pass gray image or use vec3b
to access pixel value.
You can use OpenCV inbuilt filter2D instead your own.
Mat src=imread("img.jpg");
Mat dst;
Mat kernel=(Mat_<float>(3,3)<< 1/9.0, 1/9.0, 1/9.0,\
1/9.0, 1/9.0, 1/9.0,\
1/9.0, 1/9.0, 1/9.0);
filter2D(src, dst,-1, kernel,Point(-1,-1),0,BORDER_DEFAULT );