Opencv takes continuous frames,scales them down for faster image processing.The faces in each frame are ellipses drawn and the ellipse center points calculated.
For 0 faces ,the destination should be the image center pixel having values(x,y) so no movement happens.For 1 face opencv determines the destination as the ellipse center for the face.For two faces,it determines the midpoint of the two ellipses and for 3 or greater faces it determines the centroid of the total ellipse centers.
The coordinates are sent to an arduino via serial and the movement in the two axis for the servos are done by using the generalised bresenham line algorithm.
Details
The project is still midway.been on it for a week.Maybe this can be used with skype for linux?Just thinking :)
Due to unavailability of small size servo screw fasteners around Kenya,i 3D printed my own with a layer height of 0.01 mm and they turned out very fine.Will release the .stl files for anybody in areas of the world lacking these washers.Now to continue with the project...
Just had my pan tilt bracket delivered now to assemble.Just left with knowing how to work with the linux termios structure,implimenting the bresenham algorithm and correcting any bugs.
Thanks for the question,Well the thing is that you would have to train opencv to know what to track....so no....as long as you can give it data to train itself on but the training could take long i have read since it involves neural nets.
Would it be difficult to set this up so you could track an object you select. I need something that will keep a camera aimed at an object as it slowly moves.