# Revision history [back]

I would suggest you to use something like

cv::Mat myKernel((cv::Mat_< uchar >(5, 5) << 1, 1,  1,  1, 1,
1, 1,  1,  1, 1,
1, 1, 25, 1, 1,
1, 1,  1,  1, 1,
1, 1,  1,  1, 1));


and then do your convolution using filter2d

For simple operations, like blur, Gaussian blur, or median blur, there are specific functions where you just need to give the size of the kernel. There is also a bilateral filter. Take a look at this demo.

I would suggest you to use something like

cv::Mat myKernel((cv::Mat_< uchar >(5, 5) << <<
1, 1,  1,  1, 1,
1, 1,  1,  1, 1,
1, 1, 25, 1, 1,
1, 1,  1,  1, 1,
1, 1,  1,  1, 1));


and then do your convolution using filter2d

For simple operations, like blur, Gaussian blur, or median blur, there are specific functions where you just need to give the size of the kernel. There is also a bilateral filter. Take a look at this demo.