Jump to content
Xtreme .Net Talk

Recommended Posts

Posted
Are we talking pure green (i.e. 0,255,0) or shades of green? If we're also looking at shades, then what's your tolerance? What about the areas of white, if it's the interior of the building you're looking at?...
Posted
Are we talking pure green (i.e. 0,255,0) or shades of green? If we're also looking at shades, then what's your tolerance? What about the areas of white, if it's the interior of the building you're looking at?...

 

The image has been produced by scanning a diagram, maximising the contrast, and then using the fill function in MS Paint to fill in all the internal areas in green. So I'm simply interested in the area that MS Paint has filled in. So the answer to your question is simply "whatever green MS Paint has provided."

 

I've found that it doesn't take my computer more than a minute to check each pixel in the diagram, and it's easy to code, so that's what I've now done in fact.

Posted
How are you examining the pixels?

 

Like this

 

 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

       With Me.PictureBox1
           Dim b As New Bitmap(.Image.Width, .Image.Height)
           b = .Image
           Dim s As Integer
           For n As Integer = 1 To .Image.Width
               For m As Integer = 1 To .Image.Height
                   Dim q As Color = b.GetPixel(n - 1, m - 1)
                   If q.G = 0 And q.R > 250 Then s = s + 1 'plan had red infill. Check for no green as well so white is excluded.
               Next
           Next
           MsgBox(s)
       End With

   End Sub

  • Leaders
Posted
You could make this much, much faster by examining the raw image data rather than using the GetPixel method. I'll see if I can find the tutorial I wrote on the topic.
[sIGPIC]e[/sIGPIC]

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...