1 | initial version |
Just looking at your code i notice you're trying an approach based on contour segmentation. However, if you actually know the object you are looking for, I would suggest using feature matching approaches like SURF, SIFT or ORB.
Information can be found here on these links:
Those can actually detect feature points in new frames that are common to the feature points in the object. You will get way better detection results.