CodeGuru Forums -
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic Newsletters VB Forums Developer.com


Newest CodeGuru.com Articles:

  • Binding Data to Silverlight 4.0 Controls Using ASP.NET MVC Framework 2.0
  • ADO.NET Data Services in the .NET Framework
  • Visual C++ Programming: What's new for MFC library in VC++ 2010?
  • Microsoft Visual Studio LightSwitch and What It Can Do For You

  • Search CodeGuru:
     



    Go Back   CodeGuru Forums > Visual Basic Programming > Visual Basic 6.0 Programming
    FAQ Members List Calendar Search Today's Posts Mark Forums Read

    Visual Basic 6.0 Programming Ask questions about VB 6.0 (or earlier versions) or help others by answering their question.

    Reply
     
    Thread Tools Search this Thread Rate Thread Display Modes
      #1    
    Old September 22nd, 2009, 05:22 PM
    khackbarth khackbarth is offline
    Junior Member
     
    Join Date: Sep 2009
    Posts: 4
    khackbarth is an unknown quantity at this point (<10)
    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
    Reply With Quote
      #2    
    Old September 22nd, 2009, 06:55 PM
    dglienna's Avatar
    dglienna dglienna is offline
    ex MVP - Visual Basic
    Power Poster
     
    Join Date: Jan 2006
    Location: Chicago, IL
    Posts: 11,460
    dglienna has a reputation beyond repute (3000+)dglienna has a reputation beyond repute (3000+)dglienna has a reputation beyond repute (3000+)dglienna has a reputation beyond repute (3000+)dglienna has a reputation beyond repute (3000+)dglienna has a reputation beyond repute (3000+)dglienna has a reputation beyond repute (3000+)dglienna has a reputation beyond repute (3000+)dglienna has a reputation beyond repute (3000+)dglienna has a reputation beyond repute (3000+)dglienna has a reputation beyond repute (3000+)
    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
    101 Samples: VB & C# VS2008 Samples & VS2010 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!
    Reply With Quote
      #3    
    Old September 22nd, 2009, 07:55 PM
    khackbarth khackbarth is offline
    Junior Member
     
    Join Date: Sep 2009
    Posts: 4
    khackbarth is an unknown quantity at this point (<10)
    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.
    Reply With Quote
      #4    
    Old September 22nd, 2009, 07:56 PM
    khackbarth khackbarth is offline
    Junior Member
     
    Join Date: Sep 2009
    Posts: 4
    khackbarth is an unknown quantity at this point (<10)
    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.
    Reply With Quote
      #5    
    Old September 24th, 2009, 08:05 AM
    WizBang WizBang is offline
    Super Moderator
    Power Poster
     
    Join Date: Dec 2001
    Posts: 6,195
    WizBang has much to be proud of (1500+)WizBang has much to be proud of (1500+)WizBang has much to be proud of (1500+)WizBang has much to be proud of (1500+)WizBang has much to be proud of (1500+)WizBang has much to be proud of (1500+)WizBang has much to be proud of (1500+)WizBang has much to be proud of (1500+)WizBang has much to be proud of (1500+)WizBang has much to be proud of (1500+)WizBang has much to be proud of (1500+)
    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?
    Reply With Quote
      #6    
    Old September 24th, 2009, 06:38 PM
    khackbarth khackbarth is offline
    Junior Member
     
    Join Date: Sep 2009
    Posts: 4
    khackbarth is an unknown quantity at this point (<10)
    Re: suggestion with program design - jpeg file interpreter

    Thanks! that should work!
    Reply With Quote
    Reply

    Bookmarks

    Tags
    jpeg, program design, surface area
    Go Back   CodeGuru Forums > Visual Basic Programming > Visual Basic 6.0 Programming


    Thread Tools Search this Thread
    Search this Thread:

    Advanced Search
    Display Modes Rate This Thread
    Rate This Thread:

    Posting Rules
    You may not post new threads
    You may not post replies
    You may not post attachments
    You may not edit your posts

    BB code is On
    Smilies are On
    [IMG] code is On
    HTML code is Off
    Forum Jump


    All times are GMT -5. The time now is 09:04 PM.



    Acceptable Use Policy

    Internet.com
    The Network for Technology Professionals

    Search:

    About Internet.com

    Legal Notices, Licensing, Permissions, Privacy Policy.
    Advertise | Newsletters | E-mail Offers


    Powered by vBulletin® Version 3.7.3
    Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.