I. Introduction
II. Mean filter
#include <opencv2 / Core / core.hpp> #include <opencv2 / HighGUI / highgui.hpp> #include <opencv2 / imgproc / imgproc.hpp> #include <the iostream> the using namespace CV; the using namespace STD; int main () { // read image source CV = CV :: :: Mat srcImage imread ( " a.jpg " ); IF (srcImage.empty ()) return - . 1 ; // converted to grayscale cv :: Mat srcGray; :: cvtColor CV (srcImage, srcGray, CV_RGB2GRAY); CV :: imshow ( " srcGray " , SrcGray); // mean smoothing CV :: Mat blurDstImage; Blur (srcGray, blurDstImage, CV :: Size ( . 5 , . 5 ), CV :: Point (- . 1 , - . 1 )); CV :: imshow ( " blurDstImage " , blurDstImage); // write the image file CV :: imwrite ( " blurDstImage.png " , blurDstImage); CV :: waitKey ( 0 ); return 0 ; }