OCR function does not recognize number 8

2 ビュー (過去 30 日間)
Niklas Arold
Niklas Arold 2019 年 9 月 4 日
回答済み: Devineni Aslesha 2019 年 9 月 10 日
Hello,
I do have a Problem with the ocr Function of Matlab.
It does a very poor job, particulary in recognizing the number 8.
untitled.bmp
This the i am giving into the ocr function, however, the ocr funktion does return 6 or 9 or 5 more often, than it recognizes an 8.
I added some pictures in the attached zip archive if somebody wants to have a go.
This is the code i am using:
image=rgb2gray(img_rgb(leftedge:rigthedge,upperedge:loweredge);
OcrObjekt=ocr(image,'CaracterSet','0123456789.','Textlayout','Word');
result=strtrim(OcrObjekt.Words{1});
Thank you for your answers!
  2 件のコメント
KALYAN ACHARJYA
KALYAN ACHARJYA 2019 年 9 月 4 日
編集済み: KALYAN ACHARJYA 2019 年 9 月 4 日
May work?
Do some sort of preprocessing on images before applying the OCR.
Niklas Arold
Niklas Arold 2019 年 9 月 6 日
I did try a lot of different techniques for preprocessing, but none of them gave acceptable results.

サインインしてコメントする。

回答 (1 件)

Devineni Aslesha
Devineni Aslesha 2019 年 9 月 10 日
While passing the image data to ocr function, no need to convert the image from RGB to gray as ocr function converts truecolor or grayscale input images to a binary image, before the recognition process using Otsu’s thresholding technique.
Use the below code for reference.
I = imread('Image8.png');
txt = ocr(I,'CharacterSet','0123456789.','Textlayout','Word');
txt.Text
Here, Image8 is the image provided in the question. It is showing the correct result.
Doc Link:

カテゴリ

Help Center および File ExchangeText Analytics Toolbox についてさらに検索

製品


リリース

R2019a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by