-
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
-
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())
-
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