Thread: Help with PGM project

  1. #1
    Registered User
    Join Date
    Nov 2009

    Help with PGM project

    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:

    for (x; x <= 640; x++)
    for (y ; y <= 480; y++)
    *do stuff*
    I'm just stuck now. D:

  2. #2
    Registered User
    Join Date
    Sep 2006
    First thing is to Google "pgm format", so you can get acquainted with what your program will be working with.

    Second thing is to look over the example programs that same google page shows links to. You need to know how black is represented, in this format.

    Third thing is to break the program down into small parts, that you can handle - like int main() or opening a file, or declaring an x and y variable, and height and width.

    Then post your code up, even if it's just a humble start, and we can see what you need help with. You need to show the initiative here. Otherwise, the only thing we wind up doing is everybody's homework, and that's not what we want or are willing to do (with rare exceptions).

    So, get busy, and we'll see you soon.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Problem Displaying a Struct
    By rockstarpirate in forum C++ Programming
    Replies: 16
    Last Post: 05-05-2008, 09:05 AM
  2. added start menu crashes game
    By avgprogamerjoe in forum Game Programming
    Replies: 6
    Last Post: 08-29-2007, 01:30 PM
  3. Dynamic Binding
    By gpr1me in forum C++ Programming
    Replies: 1
    Last Post: 03-24-2006, 09:01 AM
  4. Game Independent Anti-cheat Project Needs Programmers
    By GIA Project Lea in forum Projects and Job Recruitment
    Replies: 3
    Last Post: 09-15-2005, 07:41 PM

Tags for this Thread