CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Sep 2009
    Posts
    4

    Question suggestion with program design - jpeg file interpreter

    I'm trying to come up with a way to easily measure the surface area of a leaf. It occurred to me that I could scan the leaf and then count the number of pixels in the image. I have a scanner that will produce a jpeg file.

    Any suggestion for how to turn that file into something that would be "countable"?

    Thanks,
    Ken

  2. #2
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: suggestion with program design - jpeg file interpreter

    How would you want to count the leaf? Colors? Angles? It's possible, but if you do snowflakes, then none are the same...
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  3. #3
    Join Date
    Sep 2009
    Posts
    4

    Re: suggestion with program design - jpeg file interpreter

    I would be scanning a dark image against a white background so I think I could just count anything that was non-white (or some other measure of non-whiteness). The scanner is pretty good at identifying forground from background when cropping the image. In that way I could equate the image width in pixels to the measured width of the leaf. That would give me a conversion factor from pixels to inches and total pixels to inches squared.

  4. #4
    Join Date
    Sep 2009
    Posts
    4

    Re: suggestion with program design - jpeg file interpreter

    I just reread your post and see that I didn't quite answer it. I would want to count the number of "dark" pixels in the image.

  5. #5
    Join Date
    Dec 2001
    Posts
    6,332

    Re: suggestion with program design - jpeg file interpreter

    If you load the image into a PictureBox, it will then have accessible pixels that you can iterate through. You can also load it into an StdPicture object, then create a memory DC. Either way, the GetPixel API will retrieve the color of any pixel.
    Please remember to rate the posts and threads that you find useful.
    How can something be both new and improved at the same time?

  6. #6
    Join Date
    Sep 2009
    Posts
    4

    Re: suggestion with program design - jpeg file interpreter

    Thanks! that should work!

Tags for this Thread

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