I have an image:
size 1000x1000 white with random black dots. (It may contain a black square (size 50x50))
Is there an easy way to find out if an image contains a black square (size 50x50)? I was thinking about scanning each pixel of the image, and if a black pixel was found, scan it next to it until I get a 50x50 square or until I get a white pixel and start scanning. but he will have to scan more than a million pixels (if he did not find the square).
This is basically code (you don’t need to fill it, as I said, it will take too much time to scan it), a million times if the entire image is white and much larger in accordance with the number of black pixels.)
for (int i = 0; i < pic.Width; i++)
{
for (int j = 0; j < pic.Height; j++)
{
if (pic.GetPixel(i, j) == Color.Black)
{
}
}
}
, ( ). ?