CS585 A2
Lang Gao
Seunghun Oh

This assignment tasked students with creating a basic template matching system in OpenCV.
The system had to be able to track objects given templates, and show what objects were being tracked.


The method used involved acquiring a template of the object that was to be searched for, and using
OpenCV's built in template matching functions, pick the template out of individual frames in a video feed.
To do this we had to create functions to take the input video frame and templates given and compare them, and a function to differentiate skin tone from other objects to pick up on hand gestures and forms.

We tested our system by seeing if it could pick up on the template objects in various enviornments
that had different levels of light and different colors for the surrounding objects and background.
We performed five sets of tests on different backgrounds and if other objects were in the frame or not.
The system was quite accurate when there were few other objects and the background did not resemble the template
but once more similar objects appeared in each frame the accuracy dropped considerably.

Part 1

Original Image
Original Image
Original Image
Original Image
Original Image


Tracking an object using template matching was not best, as it was easy to confuse it with other objects
which had roughly the same shape or color, though this may be due to the ununique appearance of the template
or the small size of the template image.


For part 2 we were unable to figure out a good way to determine which of the hand templates the
hand in the frame fit to decide on which fruit image to display to the user. We had planned on using the skin
color identifier on both the templates and the frame, and then comparing them pixel by pixel to see which
template best matched the frame, but our templates were all slightly different sizes, and we did not
realize this flaw until the end, so we did not have ample time to fix this issue.

Based on this experiment, template matching seems to be an adequate identification technique
provided that one can ensure that there are not many other objects in the same frame, and that the
background has significant enough contrast to the template object to not interfere in identification.
with other things in the frame, the dectection became unreliable, sometimes remaining accurate, other
times locking on to a different object.


Sources : stackoverflow.com, docs.opencv.com

Collaborators : Seunghun Oh