The four classic filtering algorithms can be found in the opencv documentation. Familiarize yourself with the call specifications.
# Include "CV. H "# include" highgui. H "# include <iostream> using namespace STD; using namespace CV; int main (INT argc, char * argv []) {mat src = imread (" misaka.jpg "); mat DST; // parameters are written in sequence // Gaussian filter // SRC: input image // DST: output image // size (5, 5) template size, it is an odd number of // X direction variance // y direction variance gaussianblur (SRC, DST, size (5, 5),); imwrite ("gauss.jpg", DST ); // median filter // SRC: input image // DST: output image // template width, which is an odd number of medianblur (SRC, DST, 3); imwrite ("med.jpg ", DST); // mean filtering // SRC: input image // DST: output image // template size // point (-1,-1): smoothed point position, negative value: Core center blur (SRC, DST, size (3, 3), point (-1,-1); imwrite ("mean.jpg", DST ); // bilateral filter // SRC: input image // DST: input image // filter template radius // Color Space Standard Deviation // coordinate space standard deviation bilateralfilter (SRC, DST, 5, 10.0, 2.0); // here the filtering is ineffective, do not understand imwrite ("bil.jpg", DST); waitkey (); Return 0 ;}
Processing result:
Source image:
Gaussian filter:
Median Filter:
Mean Filtering:
Bilateral filtering. Do you think it works? How can I adjust parameters: