# Include "opencv2/imgproc. HPP "# include" opencv2/highgui. HPP "# include <stdlib. h> # include <stdio. h> using namespace CV; int main (INT argc, char ** argv) {// variable declaration mat SRC, DST; MAT kernel; point Anchor; Double Delta; int ddepth; int kernel_size; char * window_name = "filter2d Demo"; int C; // load image src = imread (argv [1]); If (! SRC. data) {return-1;} // create a window named window (window_name, cv_window_autosize); // initialize anchor = point (-1,-1) for the filter ); // The default anchor point is Delta = 0 in the Processing Kernel Window center. // the value added to each pixel of the image during convolution. The default value is 0 ddepth =-1; // negative number indicates that the processing result image is the same as the original image depth // loop-will filter the image with Different kernel sizes each 0.5 seconds int ind = 0; while (true) {c = waitkey (500); // press 'esc 'to exit the program if (char) C = 27) {break ;} // update kernel size for a normalized Box Filter kernel_size = 3 + 2 * (IND % 5); // ensure that the processing kernel size is an odd number of kernel = mat :: ones (kernel_size, kernel_size, cv_32f)/(float) (kernel_size * kernel_size); // use a filter to process filter2d (SRC, DST, ddepth, kernel, anchor, Delta, border_default ); imshow (window_name, DST); ind ++;} return 0 ;}