使Tesseract识别数字

时间:2018-06-06 18:14:14

标签: java opencv xamarin.android ocr tesseract

二值化后:

Imgproc.CvtColor(mat, mat, Imgproc.ColorBgr2gray);

Imgproc.GaussianBlur(mat, mat, new OpenCV.Core.Size(5, 5), 2);

Threshold(mat, mat, 100, 255, Imgproc.ThreshBinary);
Imgproc.Dilate(mat, mat, Imgproc.GetStructuringElement(Imgproc.MorphRect, new OpenCV.Core.Size(15, 15)));
Imgproc.Erode(mat, mat, Imgproc.GetStructuringElement(Imgproc.MorphRect, new OpenCV.Core.Size(11, 11)));

...找到轮廓,检测ROI并将其移至新Mat,调整为300DPI Tesseract似乎无法识别任何数字。

提高质量后的图像如下所示:

enter image description here

Tesseract有这样的设置:

tessBaseApi.SetPageSegMode(TessBaseAPI.OemTesseractCubeCombined);
tessBaseApi.SetVariable(TessBaseAPI.VarCharWhitelist, "0123456789");

任何让它识别数字的解决方案?

0 个答案:

没有答案