SRL Archive - Bugs

(Official) Uptext thread


Wizzup?

2012-02-01 17:42:42

This is on my to-do list for the Simba Uptext/OCR at the moment:

  • Filter per ``base'' colour. If there are too few or too many of them in a TPA, remove them. (Filter additional noise)
  • Filter different colours next to each other (Shadow filter does this <3)
  • Filter if there simply aren't enough colours of the colour as a whole. (Same after SplitTPA/TPAToATPA)
  • Allow the script to set / customise the initial colour filter. (We can use this to update the colour filter without having to update simba too) (Mostly done)
  • Create a new and better OCR tool. (Easier for everyone to debug the ocr / testing filters) (Work started, going to add more features later)

This thread is for additional suggestions on increasing the accuracy of our filter.
For information on how it currently works, read: http://docs.villavu.com/simba/mmlref/ocr.html#uptext

This thread is also for uptext that isn't currently properly detected by Simba. You can post those here, but they must be made in a specific manner so we can effectively use them. Mainly: The (0, 0) of the screenshot should be the same as the (0, 0) of the RS window / the format must be lossless. (not jpg)

You can use something like this:


SaveScreenshot('a-name.bmp'); // If you have the current unreleased Simba 0.99 you can use .png too

You can them remove any references that may lead to your character from the screenshot, or further edit it with GIMP/Photoshop. And by edit I mean, remove most of the pictures contents - however, keep the 0, 0 of the picture the same… if you get what I mean. That's nice for automatic testing.

So let's build a set of well-created screenshots that we can use to improve on the OCR. Once a screenshot if confirmed to work on a stable Simba, I or some other mod will mark it ``fixed'' (by editing the post) - or something along the lines of that.

E: Example of how we could set our own filter: (It's not a very clear example, but this filter is really all there's to it - for the current colour filter in Simba 983 anyway)


// load0(r_low, r_high, g_low, g_high, b_low, b_high, set_color_to);
// OF_HN = -1, OF_LN = 256 (basically it means, disregard this)
fd[0] := load0(65, OF_HN, OF_LN, 190, OF_LN, 190, ocr_Blue); // blue
fd[1] := load0(65, OF_HN, OF_LN, 190, 65, OF_HN, ocr_Green); // green
fd[2] := load0(OF_LN, 190, 220, 100, 127, 40, ocr_ItemC); // itemC
fd[3] := load0(OF_LN, 190, OF_LN, 190, 65, OF_HN, ocr_Yellow); // yellow
fd[4] := load0(OF_LN, 190, 65, OF_HN, 65, OF_HN, ocr_Red); // red
fd[5] := load0(OF_LN, 190, OF_LN, 65, 65, OF_HN, ocr_Red); // red 2
fd[6] := load0(190 + 10, 130, OF_LN, 65 - 10, 20, OF_HN, ocr_Green); // green 2
fd[7] := load0(190, 140, 210, 150, 200, 160, ocr_ItemC); // item2, temp item_c
fd[8] := load0(65, OF_HN, 65, OF_HN, 65, OF_HN, ocr_Purple); // shadow

Markus

2012-02-02 12:42:54

You're good busy.

mormonman

2012-02-18 01:02:40


Uptext doesn't get detected well with that background.

Coh3n

2012-02-27 17:24:11

This was reported earlier today: http://villavu.com/forum/showthread.php?t=76309

Was wondering if the grey color is working in the newer (unreleased) versions of Simba?

Tickyy

2012-02-28 06:27:23

i also had(still have but found a solution, Just rotate the screen). I think uptext needs some re-work.

WT-Fakawi

2012-02-28 07:13:29

I know what the problem is. It has nothing to do with the colors nor rotation. There is simply one spacial configuration of characters where the Uptext fails. 100% certain.

Bam Bam

2012-02-28 16:37:17

From: WT-Fakawi
I know what the problem is. It has nothing to do with the colors nor rotation. There is simply one spacial configuration of characters where the Uptext fails. 100% certain.


That was very clever of them. You can actually see the differences in spacing between the two screen shots :/

Coh3n

2012-02-28 17:11:08

I thought Wizzup? said the spacing didn't matter?

WT-Fakawi

2012-02-28 17:23:25

I simply need to add SaveScreenShot to my Moss Giant killer and wizz will fix :smile:

Will do now! (If you have a member account and meet requirements for Moss G. run and you will see)

Brandon

2012-03-10 21:02:37

So.. I got tired of waiting on a fix for Zanaris and hard to get areas.. Well this thing works flawlessly.. I dunno how to make it return all text found but it will find any text you ask it to find within that box.. More letters, the better.. And the box by default below is the uptext bounds.. Works in Zanaris, AND the dungeoneering area.. Of course if the issue for the normal uptext is colours.. well I have a massive list of colours in the script that can maybe be added to the filter :S..

Daemonheim.. as show in the picture above.. Results below:

The Function below: Bunyip pouch
The GetUptext Func: ^^ B' n i. ^<W . ^^^^^( .f ! n Z? - .p .

Zanaris as shown in the picture above:
The Function Below: Bunyip pouch
NormalUptext Function: Use B!1n!yip po!1cl.! / 3 more options
Successfully executed.


Not very fast as I don't got a single clue how to speed it up.. maybe a plugin? It's pretty fast though unless it has to loop through all the colours.. in which case your uptext is either too small, or simply not found.

I tried merging all the colours using ACA but it fails in the dungeoneering area only.. all other areas it seems to work pretty fine so far.


Program UptextFinder;

{$DEFINE SMART}
{$I SRL/SRL.Simba}

Function FindTextCustom(TextToSearchFor: TStringArray; Box: TBox; Colour, Tolerance: Integer; PrintResult: Boolean; Font: String): boolean;
var
Data: string;
ListOfFonts, AllFonts: TStringArray;
I, J: Integer;
begin
Result:= False;
AllFonts:= ['BigChars', 'CharsNPC', 'CharsTrade', 'FriendChars', 'LoginChars', 'SmallChars', 'SmallCharsNS', 'StatChars', 'UPChars', 'UpCharsEx', 'XPChars'];

if (LowerCase(Font) = 'all') then
ListOfFonts:= AllFonts
else
begin
if (Not InStrArr(Font, AllFonts, false)) then
begin
SRL_WARN('FindTextCustom', 'Invalid Font!', 0);
exit;
end;
ListOfFonts:= [Font];
end;


For J:= 0 To High(ListOfFonts) do
begin
Data:= GetTextAtExWrap(Box.X1, Box.Y1, Box.X2, Box.Y2, 0, 5, 2, Colour, Tolerance, ListOfFonts[J]);
For I:= 0 To High(TextToSearchFor) do
begin
if (TextToSearchFor[I] <> '') then
Result:= (ExecRegExpr(TextToSearchFor[I], Data));

if Result then
begin
If PrintResult then
writeln(Data);
exit;
end;
end;
end;
end;

Function FindAllText(Uptexts: TStringArray; Box: TBox; Colours: TIntegerArray; Tolerance: Integer; PrintResults: Boolean; Font: String): Boolean;
var
I: Integer;
begin
For I:= 0 To High(Colours) do
begin
Result:= FindTextCustom(UpTexts, Box, Colours[I], Tolerance, PrintResults, Font);
If Result then
exit;
end;
end;

var
ListOfColours: TIntegerArray;
//CTS: Integer;
begin
Smart_Server := 72;
Smart_Members := True;
Smart_Signed := True;
Smart_SuperDetail := False;

SetupSRL;
ClearDebug;
MouseItem(1, 3); //First Inventory Slot..

ListOfColours := [14211799, 6667731, 14672351, 1169359, 2721999, 14212565,
13751822, 14474972, 13816530, 1803484, 2656464, 3249636,
3380704, 2461153, 14803936, 15067364, 13684943, 15198949,
15396073, 15593452, 15659246, 14474460, 6338516, 6207445,
3552820, 8641269, 8181491, 16645627];
//CTS := GetColorToleranceSpeed;
//ColorToleranceSpeed(2);
//SetColorSpeed2Modifiers(1.01, 1.76); //[9360305] - Col, 25 -Tol

FindAllText(['Bunyip'], IntToBox(5, 9, 338, 23), ListOfColours, 60, True, 'UpChars');
writeln('NormalUptext: ' + GetUptext);

//ColorToleranceSpeed(CTS);
//SetColorSpeed2Modifiers(0.2, 0.2);
end.

Wizzup?

2012-03-11 06:56:25

This is high on my todo list. Your function might be of some help. Did you try loading your colours in the uptext filter? You could literally just find the bounds the tolerance adds to the colour and insert them into the filter. (See first post)

E: Also, make sure you don't remove the shadow one.

fre

2012-03-15 05:48:37

This uptext can't be found