Results 1 to 3 of 3

Thread: Picture Box To Bitmap Webcam HELP!

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2009
    Posts
    5

    Exclamation Picture Box To Bitmap Webcam HELP!

    Hello All i am revalo and i am only 11yrs old

    I NEED HELP ! So my questions are:

    1) I was making a tracking tracking application so that i can program my own
    sixth sense! (By Pranav Mistry) (An yes i know Vb very much not advanced but yes a good one!) so my question is that when i execute this code:
    Code:
        
    Function GetCamImage() As System.Drawing.Bitmap
            Dim bm As System.Drawing.Bitmap = Nothing
            bm = New System.Drawing.Bitmap(PictureBox1.Image)
            Return bm
        End Function
    it said on line no. 2 and says "Object Refrence Not Set To an Istance of an object". And Also this is the code for form1:
    Code:
    Public Class Form1
        Dim go = 0
        Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            WebCam1.StartCam()
        End Sub
        Function GetColorXY(ByVal color As System.Drawing.Color, ByVal image As Image) As Point
            Dim result As Point
            Dim bm As New Bitmap(image)
            For y As Integer = 0 To bm.Height - 1
                For x As Integer = 0 To bm.Width - 1
                    Dim red As Byte, green As Byte, blue As Byte
                    red = bm.GetPixel(x, y).R
                    green = bm.GetPixel(x, y).G
                    blue = bm.GetPixel(x, y).B
                    Dim brightness As Single = (299 * red + 587 * green + 114 * blue) / 1000
                    If color = Drawing.Color.Red Then
                        If (red > 220) AndAlso (green < 170) AndAlso (blue < 170) Then
                            result = New Point(x, y)
                        End If
                    End If
                    If color = Drawing.Color.Green Then
                        If (green > 220) AndAlso (red < 170) AndAlso (blue < 170) Then
                            result = New Point(x, y)
                        End If
                    End If
                    If color = Drawing.Color.Blue Then
                        If (blue > 220) AndAlso (green < 170) AndAlso (red < 170) Then
                            result = New Point(x, y)
                        End If
                    End If
    
                Next
            Next
            Return result
        End Function
        Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
            If go = 1 Then
                txtRed.Text = GetColorXY(Color.Red, WebCam1.GetCamImage()).X & "," & GetColorXY(Color.Red, WebCam1.GetCamImage()).Y
            Else
                go += 1
            End If
        End Sub
    End Class
    Please i NEED HELP!!!!!!!!!!!
    I HAVE BEEN SEARCHING FOR THIS FOR AGES!

  2. #2

    Thread Starter
    New Member
    Join Date
    Jul 2009
    Posts
    5

    Re: Picture Box To Bitmap Webcam HELP!

    I need fast reply please!

  3. #3

    Thread Starter
    New Member
    Join Date
    Jul 2009
    Posts
    5

    Re: Picture Box To Bitmap Webcam HELP!

    quiet Sad! No Reply!

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