I need some help with a specific part of a VB .Net project, as follows:
There will be an object moving in an enclosed area, watched by a web cam.
The object will be contrasting with its background, and the program has to find the high contrast object and record its co-ordinates.
I need to record its co-ordinates from moment to moment. I need to do this at the fastest sampling rate possible, and I also need the co-ordinates for its position every tenth of a second, ie 10 points per second.
Outside the enclosed area there may be other contrasting objects, which the program must ignore, so the program has to mask over everything outside the enclosed area, which is defined in the calibration step of the program.
When finding the moving object the program has to ignore the masked area, so as it samples the screen it has to check whether a pixel is the same colour as the mask or not, and ignore it if it is.
Currently it is having trouble with this, unless it is set to use only a small number of samples (eg by stepping over most pixels). With larger numbers of samples it fails to draw the mask and gives a red cross error.
Also, when it does draw the mask, I am not sure whether it is actually sampling the screen, as intended, which will include the mask, or whether it is sampling the video image under the mask, and I'm not sure if it is trying to do the paint event multiple times, making it too slow to take a lot of samples.