| CodeGuru Home | VC++ / MFC / C++ | .NET / C# | Visual Basic | Newsletters | VB Forums | Developer.com |
|
|||||||
| Visual Basic 6.0 Programming Ask questions about VB 6.0 (or earlier versions) or help others by answering their question. |
![]() |
|
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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
|
||||
|
||||
|
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!
|
|
#3
|
|||
|
|||
|
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
|
|||
|
|||
|
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
|
|||
|
|||
|
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
|
|||
|
|||
|
Re: suggestion with program design - jpeg file interpreter
Thanks! that should work!
|
![]() |
| Bookmarks |
| Tags |
| jpeg, program design, surface area |
|
||||||
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|