I would like to ask for assistance in programming a specialized filter.
Essentially, this filter would look through the input from a video stream (webcam or otherwise), would remove all pixels except for bright red, green, and blue, and then would find the pixel at the center of each group of colored pixels. At this point, it would count the number of pixels in each group, and find the distance of each one from the camera. Then, it would take an image plane, taken from an arbitrary folder, and scale it so that it shares the same orientation as the dots, assuming they are on a level plane, and arranged in a triangular pattern.
The result is that the pattern of three dots is overlaid in the image stream by a secondary image of the user's choice, that will continue to have the same apparent orientation and position regardless of the camera's position, so long as all three markers are visible.
Is this doable? If so, could someone talk me through the steps necessary to achieve it? (I am relatively new to this, so the instruction would have to be fairly specific).
If you can help me, I thank you very much for your time and help.