Your project is a tricky task to do. For performance reasons you really should consider implementing the video detection code in C++.
You must work with some graphics library and preprocess the image like with edge or line detection.
A possible way to go is with OpenCV as described int this
article which handles some aspects of content based image retrieval.
Dig in the
sample code of OpenCV for further possible scenarios like hull, edges and so on...