πŸ€– LateAI
Home β€Ί Tutorials β€Ί Text Detection
πŸ”€

Text Detection

Intermediate Β· Half a day
πŸ“Ά Intermediate ⏱ Half a day πŸ’° Free (software only) 🏷 CV Zone

πŸ“Œ Overview

Use OpenCV's built-in EAST text detector to box the text regions in a frame in real time. EAST is an efficient deep-learning text detection model integrated directly into OpenCV's DNN module, so there is nothing to train yourself.

Once the text boxes are found you can hand them to OCR (Tesseract or PaddleOCR, for example) to extract the content, giving you the full 'locate first, recognise second' pipeline used as a front end for document and licence plate recognition.

🧰 What you need

πŸ”§ Step by step

1

Prepare the model

Download the EAST model from OpenCV or GitHub

The model is a .pb file that OpenCV's DNN module loads directly

2

Load the network

Load the model with cv2.dnn.readNet

The output layers are fixed at two layers such as 'feature_fusion/Conv_7/Sigmoid'

3

Pre-process the input

Scale the image proportionally to the model input size (320x320, for example)

Record the scale factor and map the detections back to the original coordinates

4

Forward pass

Build the input with blobFromImage and run net.forward

The output holds a confidence and box geometry for every point

5

Decode the boxes

Decode the box coordinates and confidences from the output

Merge overlapping boxes with non-maximum suppression

6

Draw and hook up OCR

Draw the text boxes on the original image

Optional: crop the regions and feed them to OCR for the content

πŸ’‘ Tips

View original β†— ← Back to LateAI home