Median filtering statistics rank-order filter value of the salt and pepper noise is good suppression medianBlur (Mat src, Mat dest, ksize) bilateral filtering mean blur insurmountable edge pixel defect information is lost. The reason is that mean filtering is based on the average weighted Gaussian blur partially overcome this defect, but can not be completely avoided, because different pixel values without considering Gaussian bilateral blur - a filtering method edge retention, avoiding the edge information loss, retains the outline of the image is not variable bilateralFilter (the src, dest, D = 15 , 150 , . 3 ); - 15 - calculation of the radius, as the number will be included within the calculated radius, if provided - . 1 then the value of the parameter according sigma space - 150 - Sigma Color determines the number of pixel difference value will be calculated - . 3 - the value of sigma space if d is greater than 0 invalid stated otherwise, according to its value d is calculated blur ksize size must be greater than 1 and it must be odd.
int main ( int argc, char ** the argv) { Mat the src, DST; the src = imread (STRPAHT3); IF (! src.data) { the printf ( " Could Not Load Image ... \ n- " ); return - . 1 ; } // median blur // medianBlur (the src, DST,. 3); // bilateral fuzzy bilateralFilter (the src, DST, 15 , 100 , . 5 ); namedWindow ( " BiBlur the Filter the Result ", CV_WINDOW_AUTOSIZE); imshow("BiBlur Filter Result", dst); //Mat resultImg; //Mat kernel = (Mat_<int>(3, 3) << 0, -1, 0, -1, 5, -1, 0, -1, 0); //filter2D(dst, resultImg, -1, kernel, Point(-1, -1), 0); //imshow("Final Result", resultImg); waitKey(0); return 0; }