
This project shows text extraction from the input image. It is used for road sign texts translations. First, the image is preprocessed using OpenCv functions and than the text from road sign is detected and extracted.
Input
The process
- Image preprocessing
[c language=”c++”]
Imgproc.cvtColor(img, img, Imgproc.COLOR_BGR2GRAY);
Imgproc.GaussianBlur(img, img, new Size(5,5), 0);
Imgproc.Sobel(img, img, CvType.CV_8U, 1, 0, 3, 1, 0);
Imgproc.threshold(img, img, 0, 255, Imgproc.THRESH_OTSU+THRESH_BINARY);
[/c] - Contour detection
[c language=”c++”]
List<MatOfPoint> contours;
Imgproc.findContours(img, contours, new Mat(), Imgproc.RETR_EXTERNAL, Imgproc.CHAIN_APPROX_NONE);
[/c] - Deleting contours on edges, small contours, wrong ratio contours and wrong histogram contours
- Preprocessing before extraction
- Extraction
[c language=”c++”]
TessBaseAPI baseApi = new TessBaseAPI();
baseApi.init(TESSBASE_PATH, DEFAULT_LANGUAGE);
baseApi.setImage(bm);
String resultParcial;
[/c] - Translation
Sample




