问题
I use Tesseract OCR to to extract meter reading... tesseract needs to recognize right white background and black numbers.. I tried to threshold image
src := cvLoadImage(filename,CV_LOAD_IMAGE_GRAYSCALE);
dst := cvCreateImage(cvGetSize(src), IPL_DEPTH_8U, 1);
cvThreshold(src, dst, 50, 250, CV_THRESH_BINARY);
but i didn't get the right result.. what should I do? I use deplhi6 with Delphi-OpenCV https://github.com/Laex/Delphi-OpenCV
回答1:
You can treat this image as follows:
for jy:= 0 to bm.Height do
for ix := 0 to bm.Width do
begin
cor:=bm.Canvas.Pixels[ix,jy];
R:=GetRValue(Cor);
G:=GetGValue(Cor);
B:=GetBValue(Cor);
if g>38 then
bm.Canvas.Pixels[ix,jy]:=clWhite
else
bm.Canvas.Pixels[ix,jy]:=clBlack;
end;
Hope this helps.
来源:https://stackoverflow.com/questions/47450223/how-to-prepare-image-to-recognize-by-tesseract-ocr