Detecting text in natural scenes
In this recipe, you will learn how to detect text in natural images using a pre-trained convolutional neural network model. Detecting text in natural environments is important in applications like reading traffic sign messages, understanding ad messages, and reading banners.
Getting ready
Before you proceed with this recipe, you will need to install the OpenCV 3.x Python API package and the matplotlib package. OpenCV must be built with contrib modules, because the advanced text recognition functionality isn't a part of the main OpenCV repository.
Note
The modified .prototxt
file with the model description for this recipe can be found at opencv_contrib/modules/text/samples/textbox.prototxt
.
The model weights can be downloaded from https://www.dropbox.com/s/g8pjzv2de9gty8g/TextBoxes_icdar13.caffemodel?dl=0.
How to do it...
In order to complete this recipe, you need to perform the following steps:
- Import the module:
import cv2
- Load the text image:
img = cv2.imread(...