hello. i am trying to change the background color to black. it's white so i am trying to go throught all the pixels and check whether its white or no if so change the value to 0. but somthing went wrong here is my code.
Mat img = imread("t.PNG");
for (int x = 0; x < img.rows; x++)
{
for (int y = 0; y < img.cols; y++)
{
if (img.at<Vec3b>(Point(x, y))[0] >=245 && img.at<Vec3b>(Point(x, y))[1] >= 245 && img.at<Vec3b>(Point(x, y))[2] >= 245)
{
img.at<Vec3b>(Point(x, y)) = { 0,0,0 };
}
}
}
imwrite("img.png",img);
imshow(" ",img);
waitKey(0);