Results 1 to 3 of 3

Thread: video comparison

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2006
    Posts
    366

    video comparison

    So I have a video of a tennis ball bouncing up and down (for project). The tennis ball is always the same color. I want to write a simple program that watches one spot and waits until it is the tennis ball color, starts a timer, waits for the spot to be tennis ball color again, stores the timer value, and keeps doing this until the ball stops/the user stops it. I can handle the timers but i was wondering what method of pixel color recognition i should use, this is my first graphics program so some help would be very nice.

    i thought possibly easier than video recognition, possibly just watch a screen pixel and then make sure the video is full size???

    thanks

  2. #2
    PowerPoster 2.0 Negative0's Avatar
    Join Date
    Jun 2000
    Location
    Southeastern MI
    Posts
    4,367

    Re: video comparison

    What are you using to play the video?

    I am not 100% that this will work with a video, but you could give it a try. Just modify the first point in the copyfromscreen call to be the value on the screen you are looking for:

    Code:
            Dim b As New Bitmap(1, 1)
            Dim g As Graphics = Graphics.FromImage(b)
            g.CopyFromScreen(New Point(0, 0), New Point(0, 0), New Size(1, 1))
            g.Dispose()
    
            MessageBox.Show(b.GetPixel(0, 0).ToString())

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2006
    Posts
    366

    Re: video comparison

    Using VLC player.

    I have added your code to the program, the user inputs the coordinates into two text boxes, one for y and one for x.

    is it here and here that i should change the 0,0 to the coordinates? (the bold parts)

    g.CopyFromScreen(New Point(0, 0), New Point(0, 0), New Size(1, 1))
    MessageBox.Show(b.GetPixel(0, 0).ToString())

    But hold on, is your code just recalling the color of the pixel?

    If i want it to pop up the message box when the pixel is white, how should i adjust it?

    thanks
    Last edited by youngnoviceinneedofh; Apr 8th, 2009 at 08:49 AM.

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