CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7
  1. #1
    Join Date
    Feb 2012
    Posts
    3

    Image Processing algo in C to measure are of a image

    Hi everyone.....
    I am new to this forum..
    I am familiar with C++ , but I am new to the world of digital
    image processing...
    I have hardly any clue about the sytax used in
    image processing... and i am given an
    assignment on it ..

    I have been given a ppm(its a binary ppm image) image of Great Salt Lake and I need to write a image processing algorithm in C/C++ which measures area of lake in pixels
    and also i have to create a mask image by labelling lake in white pixels and remaining in black..
    Can any of you please tell me how to proceed about it??
    or something where i can get the the functions/codes
    related to it..

  2. #2
    Join Date
    Jun 2010
    Location
    Germany
    Posts
    2,675

    Re: Image Processing algo in C to measure are of a image

    I'm no expert on image processing either, but I guess creating the mask image is the first step that should be done here. In order to accomplish that, you'll likely need to do some color proximity calculations, and here's an - IMO - quite interesting thread that probably at least will give you an idea of what that's about: http://www.codeguru.com/forum/showthread.php?t=306787

    Once you have the mask, it shouldn't be too complicated anymore to determine the area covered by its white pixels.
    I was thrown out of college for cheating on the metaphysics exam; I looked into the soul of the boy sitting next to me.

    This is a snakeskin jacket! And for me it's a symbol of my individuality, and my belief... in personal freedom.

  3. #3
    Join Date
    Jul 2002
    Location
    Portsmouth. United Kingdom
    Posts
    2,727

    Re: Image Processing algo in C to measure are of a image

    If the lake is of an even colour or has distinct edge boundaries then some sort of flood fill may work. Starting with a point known to be within the lake, the algorithm could flood fill the neighbouring pixels with white. It would then be a simple task to turn every other pixel that was not white, to black.
    "It doesn't matter how beautiful your theory is, it doesn't matter how smart you are. If it doesn't agree with experiment, it's wrong."
    Richard P. Feynman

  4. #4
    Join Date
    Feb 2012
    Posts
    3

    Re: Image Processing algo in C to measure are of a image

    ^Is there any actual c code to detect the edge(like Prewitts algorithm) in an ppm(Binary aka P6) file?

  5. #5
    Join Date
    Sep 2004
    Location
    Holland (land of the dope)
    Posts
    4,123

    Re: Image Processing algo in C to measure are of a image

    Don't focus on the fileformat itself. Read the imagefile to a buffer and start working on the buffer. This way it doesn't matter which fileformat you are using.

  6. #6
    Join Date
    Feb 2012
    Posts
    3

    Re: Image Processing algo in C to measure are of a image

    Quote Originally Posted by Skizmo View Post
    Don't focus on the fileformat itself. Read the imagefile to a buffer and start working on the buffer. This way it doesn't matter which fileformat you are using.
    thanks for your reply.. I did it actually, i do have d program to read it into a buffer..But i am confused wid what to do next. How can i use it to detect the edges of d lake..?

  7. #7
    Lindley is offline Elite Member Power Poster
    Join Date
    Oct 2007
    Location
    Seattle, WA
    Posts
    10,895

    Re: Image Processing algo in C to measure are of a image

    It is unlikely your teacher would have assigned this project without giving you the tools necessary to accomplish it. Check your textbook and/or class notes and/or powerpoint slides.

    Edge detection is non-trivial, but also not *that* difficult of an algorithm. The harder part is determining which edges are the boundaries of the lake.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured