噪声的定义

来源:互联网 发布:网络名词流行用语解释 编辑:程序博客网 时间:2024/05/20 23:35
  • 椒盐噪声/salt-and-pepper noise
    • a type of noise in which some pixels are replaced by a white or a black pixel.
    • occur in faulty communication when the value of some pixels is lost during transmission.
void salt(Mat &image, int n) {         for (int k=0; k<n; k++) {             int i= rand()%image.cols;             int j= rand()%image.rows;             if (image.channels() == 1) { //gray-level image             image.at<uchar>(j,i)= 255;             } else if (image.channels() == 3) { //color image             image.at<Vec3b>(j,i)[0]= 255;             image.at<Vec3b)(j,i)[1]= 255;             image.at<Vec3b>(j,i)[2]= 255;             }         }     }
1 0
原创粉丝点击