I am attempting to loop through a cv::Mat image's pixels using this code
for (int i = 0; i < src.rows;i++)
{
for (int j = 0; j < src.cols;j++)
{
int temp2=IMAGE.at<uchar>(i,j)+b;
if (temp2<0)
{
IMAGE.at<uchar>(i,j) = 0;
}
else if (temp2>255)
{
IMAGE.at<uchar>(i,j) = 255;
}
else
{
IMAGE.at<uchar>(i,j) = temp2;
}
}
}
The issue is when i show the IMAGE it only adjusts the pixel values for about 1/4 of the image, so it seems like it is not looping through each pixel. Is there a better way to loop through each pixel using the row/col?