I get the following two errors on my code.
'img.cv::Mat::cols' cannot be used as a function
'img.cv::Mat::rows' cannot be used as a function
and I don't know how to fix it. Can someone help me fix this error.
here is my code
using namespace std;
using namespace cv;
void salt(Mat &img,int saltvalue)
{
for(int k=0;k<saltvalue;k++)
{
int i = rand() % img.cols();
int j = rand() % img.rows();
img.at<Vec3b>(j,i)[0]=255;
img.at<Vec3b>(j,i)[1]=255;
img.at<Vec3b>(j,i)[2]=255;
}
}
int main()
{
Mat img;
img = imread("C:\\castle.jpg",CV_LOAD_IMAGE_UNCHANGED);
salt(img,3000);
namedWindow("vOut",CV_WINDOW_AUTOSIZE);
imshow("vOut",img);
waitKey(0);
destroyAllWindows();
return 0;
}