Villavu / Simba

Simba is a program used to repeat certain (complicated) tasks. Typically these tasks involve using the mouse and keyboard. Simba is programmable, which means you can design your own logic and steps that Simba will follow, based upon certain input such as colors on the screen.
http://villavu.github.io/Simba/
GNU General Public License v3.0
220 stars 76 forks source link

[OCR broken] TFont.Create doesn't exist, even though it's in documentation #409

Closed Turbine1991 closed 5 years ago

Turbine1991 commented 7 years ago

Wiki: http://docs.villavu.com/simba/scriptref/ocr.html

Additionally, after making my font bitmaps - using the alternative OCR method. It doesn't load it correctly and just shows the top and bottom lines mostly.

slackydev commented 7 years ago

It's myFontVar.Init() in Simba when using Lape (this goes for just about every class constructor). All the properties, like myFontVar.name := .... are replaced with get/set functions. Eg, myFontVar.SetName('Arial');

Turbine1991 commented 7 years ago

Cheers, this worked. However I'm still unable to get the OCR methods working. FindBitmap works, but OCR doesn't seem to. (I've been unable to get non-Runescape OCR working in SCAR either for over a decade)

For example, this is some text using the Windows provided font "Lucida Sans Typewriter" at size 20 of colour black #000000 - In paint, canvas area, Windows 10: http://img4.imagetitan.com/img.php?image=16_find_simple.png

program new;

var
  Font: TFont;
  output: String;

begin
  Font.Init();
  Font.SetName('Lucida Sans Typewriter');
  Font.SetSize(20); // Equivelant to 12px CSS? (px -> pt)
  Font.SetPixelsPerInch(96);
  Font.SetColor(000000);
  Font.SetStyle([]);
  LoadSystemFont(Font, 'Font1');

  DisplayDebugImgWindow(500, 150);
  DrawBitmapDebugImg(BitmapFromText('TEST 1234.987', 'Font1'));

  output := GetTextAtEx(164, 203, 371, 227, 0, 0, 0, 000000, 100, 'Font1');
  writeln(output);

  Font.Free();
end.

I'll get some silly output such as "I E S I 1 2 J 4 . 9 B 7", I've tried tuning all of the values but I don't seem to be getting anything accurate - by a long-shot.

In comparison, Capture2Text has 100% success rate, even without specifying a font - for any text I've tried it on. For an alternative method, I haven't found a way to return console output from say - the CLI capture tool in Simba.

slackydev commented 7 years ago

The issue stems from Simba's OCR not handling antialiasing, but instead requires near pixel perfect matches. SRL-6 includes tesseract. Use it.

JohnPeel commented 5 years ago

What @slackydev said is true. Simba cannot handle fonts with anti-aliasing.

Closing as this wasn't supported to begin with.