opencv中值滤波和低通滤波器对椒盐噪声处理的效果比较
void showimage(const std::string &str,const cv::Mat &image){ namedWindow(str,CV_WINDOW_AUTOSIZE); imshow(str,image); } Mat salt(const cv::Mat &image,int n){ Mat result = image.clone(); for (int i = 0; i<n;++i) { int row = rand()%result.rows; int col = rand()%result.cols; result.at<Vec3b>(row,col)[0] = 255; result.at<Vec3b>(row,col)[1] = 255; result.at<Vec3b>(row,col)[2] = 255; } return result; } int _tmain(int argc, _TCHAR* argv[]) { Mat image = imread("boldt.jpg"); showimage("image",image); Mat saltimage = salt(image,500); showimage("saltimage",saltimage); Mat medianimage,blurimage; blur(saltimage,blurimage,Size(5,5)); showimage("blurimage",blurimage); medianBlur(saltimage,medianimage,5); showimage("medianimage",medianimage); waitKey(0); return 0; }
opencv中值滤波和低通滤波器对椒盐噪声处理的效果比较,布布扣,bubuko.com
原文地址:http://blog.csdn.net/h_wlyfw/article/details/38591539