elephant
2015-05-20 21:55:56
Can anyone give me an example of a simple OCR search using a font installed on the system such as Arial?
2015-05-20 21:55:56
2015-05-21 21:53:44
var
F: TFont;
T: String;
begin
F.Init();
F.SetName('Arial');
F.SetSize(12); //may or may not be needed..
LoadSystemFont(F, 'Temporary');
T := GetTextAtEx(0, 0, width, height, 0, 10, 4, colour, 5, 'Temporary'); //T now contains the text found..
F.Free();
end;
2015-05-25 19:03:08
From: Brandon
Untested.From: Brandon
Untested..
var
F: TFont;
T: String;
begin
F.Init();
F.SetName('Arial');
F.SetSize(12); //may or may not be needed..
LoadSystemFont(F, 'Temporary');
T := GetTextAtEx(0, 0, width, height, 0, 10, 4, colour, 5, 'Temporary'); //T now contains the text found..
F.Free();
end;
where 0, 0, width, height is the area to search.. 0, 10 is min vertical spacing and max vertical spacing respectively.. 4 is min horizontal spacing (play around with this value).. colour can be 0 (black - 0x000000) to 16777215 (white - 0xFFFFFF)..
Maybe you can use TPAFromText and then findTextTPAInTPA..
Hi thanks for the response, I just had some free time and decided to see if I could get this working however I wasn't able to get it to read the text properly. In microsoft word I made a arial, 12 font sized text and got the colors of it. However, I was unable to get it to debug out anything beside something random like ".I,C.. ( ~.". I used thisprogram ocrtesting;
var
F: TFont;
T: String;
begin
F.Init();
F.SetName('Arial');
F.SetSize(12); //may or may not be needed..
LoadSystemFont(F, 'Temporary');
T := GetTextAtEx(278, 272, 395, 312, 0, 10, 4, 7237230, 44, 'Temporary'); //T now contains the text found..
writeln(T);
F.Free();
end;
[ATTACH=CONFIG]26028[/ATTACH]
It dosn't seem to properly detect the text, I make sure the width/height will surround the text and it seems to find it however, it dosn't seem to read it correctly. Is there anything I might be doing wrong you can see from that?
2015-05-25 19:10:46
2015-05-25 19:47:30
From: Olly
You're not going to have much luck using Simba's OCR, It's very much designed for non-antialiased text (just one solid color). Take your image and zoom in to see what I mean.