Guidelines:Write a C program that can find black rectangles against a white background in a PGM image. Here is an example image. Your program produces a report that describes each rectangle found, including its (x,y) location within the image and its width and height in pixels. Note that the image provided is merely an example. Your code must work correctly regardless of the number of rectangles and their relative positions within the image. You may assume that all images used for testing will be 640x480.
I wrote out instructions to do:
1. determine the difference between the background and a rectangle. (probably based on color)
2. determine the location of the rectangle
3. calculate its width and height
4. work correctly regardless of the number of rectangles
5. all images are going to be 640*480
And I know I need a for loop like this:
Code:
for (x; x <= 640; x++)
{
for (y ; y <= 480; y++)
{
*do stuff*
}
I'm just stuck now. D: