The preprocessing step
Software that identifies letters do so by comparing text with a previously recorded data. Classification results can be improved greatly if the input text is clear, if the letters are in a vertical position, and if there are no other elements, such as images that are sent to the classification software. In this section, we'll learn how to adjust text. This stage is called preprocessing.
Thresholding the image
We usually start the preprocessing stage by thresholding the image. This eliminates all the color information. Most OpenCV functions require information to be the written in white and the background to be black. So, let's start with creating a threshold function to match this criterion:
#include <opencv2/opencv.hpp> #include ...
Get OpenCV By Example now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.