Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

What is your kernel like?

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.

For more useful functions for convolution you can see this page

What is your kernel like?

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.

For more useful functions for convolution you can see this page