img1.at<uchar>(i,j)=255;

 Mat img1(200,500,CV_8U,cv::Scalar(0));
    for(int k=0;k<3000;k++)
    {
        int i=rand() % img1.rows;
        int j=rand() % img1.cols;
        img1.at<uchar>(i,j)=255;

    }
   

  

    // drawing the results
    namedWindow("img", 1);
   
    imshow("img", img1);
    waitKey(0);

 

posted @ 2018-03-21 15:10  sky20080101  阅读(675)  评论(0)    收藏  举报