-
Book Overview & Buying
-
Table Of Contents
OpenCV By Example
By :
Enough of theory. It's time to see how the text module works in practice. Let's study how to use it to perform text detection, extraction, and identification.
Let's start with creating a simple program to perform text segmentation using ERFilters. In this program, we will use the trained classifiers from text API samples. You can download them from the OpenCV repository, but they are also available in the book's companion code.
First, we start with including all the necessary libs and using:
#include "opencv2/highgui.hpp" #include "opencv2/imgproc.hpp" #include "opencv2/text.hpp" #include <vector> #include <iostream> using namespace std; using namespace cv; using namespace cv::text;
Recall from our previous section that the ERFilter works separately in each image channel. So, we must provide a way to separate each desired channel in a different single cv::Mat channel. This is done by the separateChannels...