View Full Version : pixel color info in a real time video
September 5, 2003, 21:10:38
I'm trying to draw a line over a real -time video.
I heard that there's "overlay function" to draw objects over a video.
My question is that :
Is it possible to get pixel-color informations from a real time video and draw a line according to that corresponding color.
EX. Let's say that the background is totally white.
If you move your camera to where there are two black dots, the program will draw a line between those two points no matter how you move your camera around them.
September 8, 2003, 07:25:56
This could be done with the overlay , but i think, this is no solution. The graphics of the overlay are drawn directly in the live video frames. Therefore, your point detection algorithm would detect this lines too. The best way to do this job, is to grab the image, find the points and copy the image to a PictureBox control and draw the line in the PictureBox. With Visual Basic, this would be very slow. With C++, this job could be done much faster. You could save some time, if you would search the points around the area, where the last position was. The size of the area is determined by the maximum speed of the points (or camera) movement. If no points have been found in the specified area, your algorithm must search the whole image.
September 8, 2003, 21:34:25
I basically copied the code that inverts a frame from this site and added a loop.
I made a loop around the code so that will make it repeat 100 times.
Of course it worked except it was too slow.
it took like 2-3 secs to process each image.
My computer is not that slow(1.5ghz, 256 RDRAM, 32mb Geforce, 80GB HD)
I tried the videoocx and they have functions like detecting edges which modifies every pixel from a real-time video without lagging.
What's so different from grabbing each image with a loop to videoocx's method?
September 9, 2003, 08:12:28
I assume, that the videoocx is programmed in C++, not in Visual Basic. Thus, the access to each pixel is much faster. In my tests, i found, that C functions for accessing pixels are 40 up to 100 times faster, than Visual Basic functions. This happens, especially if you use MMX assembler.
It is not the grabbing of the image, it is the image processing on the pixels, that is too slow in Visual Basic.
Powered by vBulletin® Version 4.2.3 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.