Monthly Archives: February 2013

Down the rabbit hole, into the world of OpenCV..

Sprint 13

Up till now, my main points of focus in the FYP have shifted from one to the other in the following progression – design and development of Scope’s User Experience, development on a Visual Studio version of the app that runs a specific task, and testing of ScopeMate (a simplified version of Scope that ran Tesseract with basic pre-processing on-board).

A discussion among the team made us realise that the app requires a further restructuring of its workflow.

Scope Workflow v2.0
Scope Workflow v2.0

With this new workflow in mind, I decided to focus my energy more towards developing the Template Matching algorithm. To do this, I had to get familiar with OpenCV..


OpenCV is a cross-platform library of programming functions mainly aimed at real-time computer vision, developed byIntel, and now supported by Willow Garage and Itseez. It is free for use under the open source BSD license. It focuses mainly on real-time image processing. We are using some of the  OpenCV functions in the pre-processing stage of Scope.

Some examples of the functions of the OpenCV libraries we’re using include – Brightness, Contrast, Gray-scale, Template Matching, and Thresholding.

Template Matching

Template Matching is a technique in digital image processing for finding small parts of an image which match a template image. In Scope, template matching serves the purpose of identifying whether the given card is actually an NUS card by verifying the picture with a template of the NUS logo and comparing it to the picture. As such, this function serves as a check for the app to find out whether the card is an NUS business card or not.

This information will help accelerate the rate of processing and improve the accuracy of the results obtained from the OCR engine.


Being entirely new to OpenCV, it is taking me time to understand the purpose and  working of the various functions in the libraries. Furthermore, I had to apply these functions in the development of an Android application. This has proved to be a challenging yet rewarding learning process at the same time. While there are compilation errors that show up every now and then, working on this part has been fun because not only is it building my understanding of OpenCV, it’s also reinforcing my knowledge of Android development.

Looking forward to developing the template matching function to its entirety by the next week!