O'Reilly logo

Learn OpenCV 4 by Building Projects - Second Edition by Prateek Joshi, Vinicius G. Mendonca, David Millan Escriva

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Text detection

Let's start by creating a simple program so that we can perform text segmentation using ERFilters. In this program, we will use the trained classifiers from text API samples. You may download this from the OpenCV repository, but they are also available in this book's companion code.

First, we start by including all of the necessary libs and usings:

#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 the Extremal region filtering section that the ERFilter works separately in each image channel. Therefore, we must provide a way to separate each desired channel in a different ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required