Page 1 of 2 12 LastLast
Results 1 to 25 of 32

Thread: Is Tesseract broken?

  1. #1
    Join Date
    Dec 2011
    Location
    Toronto, Ontario
    Posts
    6,424
    Mentioned
    84 Post(s)
    Quoted
    863 Post(s)

    Default Is Tesseract broken?

    I have a fairly functional Merchanter script which works really other than errors from Tesseract.
    When trying to read the GE buy price (where it says 'You bought X of ITEM for a total price of X*ITEM gp.'), X*ITEM is almost ALWAYS wrong! Usually it returns -1, but if i'm lucky it'll return something like 109, where the buy price was 3159.

    Are the fonts out dated? Im using the FILTER_SMALL_CHARS preset.

  2. #2
    Join Date
    Nov 2011
    Location
    England
    Posts
    3,072
    Mentioned
    296 Post(s)
    Quoted
    1094 Post(s)

    Default

    Quote Originally Posted by Sin View Post
    I have a fairly functional Merchanter script which works really other than errors from Tesseract.
    When trying to read the GE buy price (where it says 'You bought X of ITEM for a total price of X*ITEM gp.'), X*ITEM is almost ALWAYS wrong! Usually it returns -1, but if i'm lucky it'll return something like 109, where the buy price was 3159.

    Are the fonts out dated? Im using the FILTER_SMALL_CHARS preset.
    Tesseract doesn't require any fonts...

    Post a picture of when it fails, il see if i can get you a better result.

  3. #3
    Join Date
    Dec 2011
    Location
    Toronto, Ontario
    Posts
    6,424
    Mentioned
    84 Post(s)
    Quoted
    863 Post(s)

  4. #4
    Join Date
    Nov 2011
    Location
    England
    Posts
    3,072
    Mentioned
    296 Post(s)
    Quoted
    1094 Post(s)

    Default

    Quote Originally Posted by Sin View Post
    Well, For a start you need to use new SRL & Simba (if you aren't) It's alot better with that. Find that here.

    Simba Code:
    {$DEFINE TESSERACT_DEBUG} // Remove this if you dont want the debug
    {$DEFINE SMART}
    {$i srl-6/srl.simba}

    var
      BMP := BitmapFromString(33, 14, 'meJxNVEtrU1EQPo/7fuTmnZDQatKFRVAQQSpCYmi14LIBKwgiCqIiKCql6kJQkhRsig8QBItL10l3yQ9w44/yO/nqITAczp0z881887jNStT8L2erUTnVjaKzvpq0Gwk0/MSlWnB5x1kthDihXK2n59slWEKDJ5xQ4hOCzzRUaysFukDqOXNCCSgaEJ9o1EBwASxdKASEWA1g6YsTgLwQkGLT5lMlFxD8QjsGNeBDY9GYoQ0Be5CyaMSnAS/kCAQ9mrgHU0YBJitWazXS+/tqPEu3d2ncqpgzvPsa9vpoDheira63sgdvnaN5cqMPzUqjVM5O6TO0/+ij9+ZYDCaOlpYXzlLnJp7k4Ux2dpJA2azi/uPQk1pJufdT7r4ElLVUC0s2kc0yZbl02Xn/O9y6LQcTrURzaRIguVDJ4QQhSqnHxjFK5Ju2Rk8G6uEHhDN9z3wgIEQ+9cCC7hwGkM1d7enrfTU0IYiANMgRn+7BieoaRzbdFrO+dgY1DM5djAKHxs5oSr52Mlmi+OkQlOMthJhaFnaicKLsqttHCE44iSA9d/84vrenpAAjKvVoCstiLgAL2wX5/Y9hh/zHc4H7s8/AxITYQKDjGEfDgoWi3n/3C5PguQpVQjjoIRo43X4578MLyUAQCK9SCHQZNUS7cQdrk/l4btthQnR2AlcSH9sUvfoG7q6WSehwJnGiNQyRjxU/qeeSIqv8rTvg4jrmNbfREz/+ogLhlR68wFR8mrnPv7BuGB68mhkYYM5Par1tuGfXNmEpFpbei6/LW7+8eogOOrirw1m0sSmEgDJLNBokpUC/Au90j4qJFgvuULpa1ctmy0qZbyzFwtI11bO7yU1hhqgeZ0kpWSsG1gZKOyH8TVHDTbSrDVgiLyfPE9sNJeytsd2y5Z/MctmZEv8edkQpnK5/5JOlKA==');
      W, H: Integer;
      myFilter: TTesseractFilter;
    begin
      GetBitmapSize(BMP, W, H);
      SetTargetBitmap(BMP);

      // All you need this below...
      myFilter := TTesseractFilter([4, 4, [False, 20, TM_Mean]]);
      Tesseract_GetText(0, 0, W -1, H -1, myFilter); // Dont forget to change the area!
    end;

    Grabs it fine. Output:

    Code:
    -- Tesseract_GetText(): Filtering took: 0 ms, Tesseract Took: 47 ms, Total Time: 47 ms.
    -- Tesseract_GetText(): Text found: 4,121

  5. #5
    Join Date
    Dec 2011
    Location
    Toronto, Ontario
    Posts
    6,424
    Mentioned
    84 Post(s)
    Quoted
    863 Post(s)

    Default

    Quote Originally Posted by Olly View Post
    Well, For a start you need to use new SRL & Simba (if you aren't) It's alot better with that. Find that here.

    Simba Code:
    {$DEFINE TESSERACT_DEBUG} // Remove this if you dont want the debug
    {$DEFINE SMART}
    {$i srl-6/srl.simba}

    var
      BMP := BitmapFromString(33, 14, 'meJxNVEtrU1EQPo/7fuTmnZDQatKFRVAQQSpCYmi14LIBKwgiCqIiKCql6kJQkhRsig8QBItL10l3yQ9w44/yO/nqITAczp0z881887jNStT8L2erUTnVjaKzvpq0Gwk0/MSlWnB5x1kthDihXK2n59slWEKDJ5xQ4hOCzzRUaysFukDqOXNCCSgaEJ9o1EBwASxdKASEWA1g6YsTgLwQkGLT5lMlFxD8QjsGNeBDY9GYoQ0Be5CyaMSnAS/kCAQ9mrgHU0YBJitWazXS+/tqPEu3d2ncqpgzvPsa9vpoDheira63sgdvnaN5cqMPzUqjVM5O6TO0/+ij9+ZYDCaOlpYXzlLnJp7k4Ux2dpJA2azi/uPQk1pJufdT7r4ElLVUC0s2kc0yZbl02Xn/O9y6LQcTrURzaRIguVDJ4QQhSqnHxjFK5Ju2Rk8G6uEHhDN9z3wgIEQ+9cCC7hwGkM1d7enrfTU0IYiANMgRn+7BieoaRzbdFrO+dgY1DM5djAKHxs5oSr52Mlmi+OkQlOMthJhaFnaicKLsqttHCE44iSA9d/84vrenpAAjKvVoCstiLgAL2wX5/Y9hh/zHc4H7s8/AxITYQKDjGEfDgoWi3n/3C5PguQpVQjjoIRo43X4578MLyUAQCK9SCHQZNUS7cQdrk/l4btthQnR2AlcSH9sUvfoG7q6WSehwJnGiNQyRjxU/qeeSIqv8rTvg4jrmNbfREz/+ogLhlR68wFR8mrnPv7BuGB68mhkYYM5Par1tuGfXNmEpFpbei6/LW7+8eogOOrirw1m0sSmEgDJLNBokpUC/Au90j4qJFgvuULpa1ctmy0qZbyzFwtI11bO7yU1hhqgeZ0kpWSsG1gZKOyH8TVHDTbSrDVgiLyfPE9sNJeytsd2y5Z/MctmZEv8edkQpnK5/5JOlKA==');
      W, H: Integer;
      myFilter: TTesseractFilter;
    begin
      GetBitmapSize(BMP, W, H);
      SetTargetBitmap(BMP);

      // All you need this below...
      myFilter := TTesseractFilter([4, 4, [False, 20, TM_Mean]]);
      Tesseract_GetText(0, 0, W -1, H -1, myFilter); // Dont forget to change the area!
    end;

    Grabs it fine. Output:

    Code:
    -- Tesseract_GetText(): Filtering took: 0 ms, Tesseract Took: 47 ms, Total Time: 47 ms.
    -- Tesseract_GetText(): Text found: 4,121
    I'll try it out in the morning, awesome, thanks

  6. #6
    Join Date
    Feb 2011
    Location
    The Future.
    Posts
    5,600
    Mentioned
    396 Post(s)
    Quoted
    1598 Post(s)

    Default

    Quote Originally Posted by Sin View Post
    I'll try it out in the morning, awesome, thanks
    Oh man.. You have no idea how much of a heart-attack that thread title gave me -_-
    Thought the plugin was broken for a sec.. That thing is literally the worst thing to compile of all time (for windows at least)..

    Olly to the rescue!
    Last edited by Brandon; 09-03-2014 at 02:22 AM.
    I am Ggzz..
    Hackintosher

  7. #7
    Join Date
    Nov 2011
    Location
    England
    Posts
    3,072
    Mentioned
    296 Post(s)
    Quoted
    1094 Post(s)

    Default

    You can't really 'break' mr. Tesseract. You just have to feed it a nice image

    I have 90% of a tool made for it, so you can work out the best settings and such.

    e: I would post the unfinished version but its but its broken... wth

    e2: Woo I made it run (apperantly i can't have a TMufasaBitmap as a const...?) It's attached below. If you have the new simba + srl-6 it should run fine for you, you can draw a box on the screen and crop by pressing space, control+v to load from clipboard too.

    It's 100% Lape too.. Pretty impressed with myself heh. Only thing left to do is undo/redo.

    Attached Files Attached Files
    Last edited by Olly; 09-03-2014 at 04:08 AM.

  8. #8
    Join Date
    Feb 2011
    Location
    The Future.
    Posts
    5,600
    Mentioned
    396 Post(s)
    Quoted
    1598 Post(s)

    Default

    Quote Originally Posted by Olly View Post
    apparently i can't have a TMufasaBitmap as a const...?

    Wouldn't that be true of all classes/records/objects? It makes sense.. If it's const, you can't modify the internal state of the object (because it's supposed to be constant/immutable). If that's true for primitives and arrays, it has to be true for everything else too because everything else uses primitives and arrays and alike..

    A const class/record/object would have to guarantee that you don't call any setter functions (functions that maybe setPixel, setWidth, setHeight, etc) as it'd "change" the state of the class/record/object.. yeah?


    Anyway, what does the above tool actually do? I'm too lazy to download it and test it :l
    I am Ggzz..
    Hackintosher

  9. #9
    Join Date
    Nov 2011
    Location
    England
    Posts
    3,072
    Mentioned
    296 Post(s)
    Quoted
    1094 Post(s)

    Default

    Quote Originally Posted by Brandon View Post
    ...
    :s wth..

    Simba Code:
    var
      BMP: TMufasaBitmap;

    procedure Foo(const Bitmap: TMufasaBitmap);
    begin
      Writeln(Bitmap.getWidth());
    end;

    begin
      BMP.Init();
      Foo(BMP);
    end.

    Gives:
    Error: Access violation at line 6

    @nielsie95

  10. #10
    Join Date
    Feb 2011
    Location
    The Future.
    Posts
    5,600
    Mentioned
    396 Post(s)
    Quoted
    1598 Post(s)

    Default

    Quote Originally Posted by Olly View Post
    :s wth..

    Gives:
    Error: Access violation at line 6

    @nielsie95
    Works:

    Simba Code:
    procedure Foo(const Bmp: TMufasaBitmap);
    begin
      Writeln(Bmp.getWidth());
    end;

    var
      BMP: TMufasaBitmap;
    begin
      BMP.Init(getTClient().getMBitmaps());
      BMP.SetSize(100, 100);
      Foo(BMP);

      writeln(Bmp);

      Bmp.Free();
    end.


    Also works:

    Simba Code:
    procedure Foo(const Bmp: TMufasaBitmap);
    begin
      Writeln(Bmp.getWidth());
    end;

    var
      BMP: TMufasaBitmap;
    begin
      BMP.Init();
      Foo(BMP);

      writeln(Bmp);

      Bmp.Free();
    end.


    EDIT: I used the Simba on the post by Wizzup (announcement post).. It access violated.. I compiled Simba myself, it works.. I redownload his Simba, it works.. I cannot replicate this anymore.. I was only able to replicate it the very first time. I restarted Simba many times, it works..
    Last edited by Brandon; 09-03-2014 at 06:11 PM.
    I am Ggzz..
    Hackintosher

  11. #11
    Join Date
    Nov 2011
    Location
    England
    Posts
    3,072
    Mentioned
    296 Post(s)
    Quoted
    1094 Post(s)

    Default

    Quote Originally Posted by Brandon View Post
    Works:
    Huh? Both dont work for me. :s

  12. #12
    Join Date
    Feb 2011
    Location
    The Future.
    Posts
    5,600
    Mentioned
    396 Post(s)
    Quoted
    1598 Post(s)

    Default

    Quote Originally Posted by Olly View Post
    Huh? Both dont work for me. :s
    See my edit..


    For me:

    Code:
    Compiled successfully in 219 ms.
    100
    0xA14AE38
    Successfully executed.
    
    
    Compiled successfully in 203 ms.
    0
    0xA0D2EB0
    Successfully executed.

    EDIT:
    @Olly; Uhh compile it yourself.. it'll work. The 52k kb (un-stripped.. I know) one works.

    The one in Wizzup's release post (build-bot build-646) is broken.. Let him know that it needs recompiling.

    Last edited by Brandon; 09-03-2014 at 06:19 PM.
    I am Ggzz..
    Hackintosher

  13. #13
    Join Date
    Nov 2011
    Location
    England
    Posts
    3,072
    Mentioned
    296 Post(s)
    Quoted
    1094 Post(s)

    Default

    Quote Originally Posted by Brandon View Post
    See my edit..


    For me:

    Code:
    Compiled successfully in 219 ms.
    100
    0xA14AE38
    Successfully executed.
    
    
    Compiled successfully in 203 ms.
    0
    0xA0D2EB0
    Successfully executed.
    I just got the newest master build, and it failed maybe you can try?

    http://l0.lt/builders/master/builds/653

  14. #14
    Join Date
    Feb 2011
    Location
    The Future.
    Posts
    5,600
    Mentioned
    396 Post(s)
    Quoted
    1598 Post(s)

    Default

    Quote Originally Posted by Olly View Post
    I just got the newest master build, and it failed maybe you can try?

    http://l0.lt/builders/master/builds/653

    Access-violation.. Both 646 and 653. Not sure what is wrong with those builds, but building it myself works fine.. I can even send you a copy of the executable or github folder and you'll see it works :l


    For now just stay away from those builds and do it yourself.. Works for me. Build-bot releases keeps giving me access-violation. See the pic in the last post.
    I am Ggzz..
    Hackintosher

  15. #15
    Join Date
    Nov 2011
    Location
    England
    Posts
    3,072
    Mentioned
    296 Post(s)
    Quoted
    1094 Post(s)

    Default

    Quote Originally Posted by Brandon View Post
    Access-violation.. Both 646 and 653. Not sure what is wrong with those builds, but building it myself works fine.. I can even send you a copy of the executable or github folder and you'll see it works :l


    For now just stay away from those builds and do it yourself.. Works for me. Build-bot releases keeps giving me access-violation. See the pic in the last post.
    Just cloned Simba, and built and it fails... :s Something is wrong..

  16. #16
    Join Date
    Feb 2011
    Location
    The Future.
    Posts
    5,600
    Mentioned
    396 Post(s)
    Quoted
    1598 Post(s)

    Default

    Quote Originally Posted by Olly View Post
    Just cloned Simba, and built and it fails... :s Something is wrong..
    I guess it's not build-bot then..

    EDIT: I was tempted.. updated my clone.. access-violation even after compiling it myself.. ={
    Last edited by Brandon; 09-03-2014 at 06:45 PM.
    I am Ggzz..
    Hackintosher

  17. #17
    Join Date
    Nov 2011
    Location
    England
    Posts
    3,072
    Mentioned
    296 Post(s)
    Quoted
    1094 Post(s)

    Default

    Quote Originally Posted by Brandon View Post
    I guess it's not build-bot then..

    In that case I'll make sure not to pull the very latest Simba.. something has to be wrong.

    I uploaded a copy of my git clone here: http://www.mediafire.com/download/jt...3ycp/Simba.zip

    It already contains a compiled executable which I forgot to remove. You can compile that yourself if you like. Let me know if it works for you.
    It doesn't seem to have constref :S I was pretty sure it had it..


    EDIT: I was tempted.. updated my clone.. access-violation even after compiling it myself.. ={
    Yea if your old clone didn't have constref it obviously didnt have the lape update, which means of course it would work!

  18. #18
    Join Date
    Feb 2011
    Location
    The Future.
    Posts
    5,600
    Mentioned
    396 Post(s)
    Quoted
    1598 Post(s)

    Default

    Quote Originally Posted by Olly View Post
    Yea if your old clone didn't have constref it obviously didnt have the lape update, which means of course it would work!
    Yeah.. It doesn't work anymore -_- It's weird. I had constref the same day when I saw slacky's post on it.. Same day I explained what it does..

    Well.. I guess const is just broken now.. I updated my clones :l
    I am Ggzz..
    Hackintosher

  19. #19
    Join Date
    Nov 2011
    Location
    England
    Posts
    3,072
    Mentioned
    296 Post(s)
    Quoted
    1094 Post(s)

    Default

    Quote Originally Posted by Brandon View Post
    Yeah.. It doesn't work anymore -_- It's weird. I had constref the same day when I saw slacky's post on it.. Same day I explained what it does..

    Well.. I guess const is just broken now.. I updated my clones :l
    It seems to be when something is typed as 'type something' eg: This will crash too.

    Simba Code:
    type
      TFoo = type TClient;

    var
      Foo: TFoo;

    procedure Test(const F: TFoo);
    begin
      Writeln(F.getMBitmaps());
    end;

    begin
      Foo.Init();
      Test(Foo);
    end;

    Not much more else we can do, either wait for niels or @Dgby714 to figure out what's up.
    Last edited by Olly; 09-03-2014 at 06:57 PM.

  20. #20
    Join Date
    Sep 2006
    Posts
    6,089
    Mentioned
    77 Post(s)
    Quoted
    43 Post(s)

    Default

    Yes, this is expected behaviour because you're using a constant. Before, you could actually change the value of constants/literals with type methods.

    Simba Code:
    {$assertions on} //Turn off to see that Self is actually not passed.

    procedure NativeInt.TestMe;
    begin
      WriteLn(@Self);
      Self := 123;
    end;

    begin
      1.TestMe;
    end.
    Hup Holland Hup!

  21. #21
    Join Date
    Nov 2011
    Location
    England
    Posts
    3,072
    Mentioned
    296 Post(s)
    Quoted
    1094 Post(s)

    Default

    Quote Originally Posted by nielsie95 View Post
    Yes, this is expected behaviour because you're using a constant. Before, you could actually change the value of constants/literals with type methods.

    Simba Code:
    {$assertions on} //Turn off to see that Self is actually not passed.

    procedure NativeInt.TestMe;
    begin
      WriteLn(@Self);
      Self := 123;
    end;

    begin
      1.TestMe;
    end.
    Maybe put a better error message on your to-do list? I could see other people getting confused with this.

  22. #22
    Join Date
    Sep 2006
    Posts
    6,089
    Mentioned
    77 Post(s)
    Quoted
    43 Post(s)

    Default

    Good point
    Hup Holland Hup!

  23. #23
    Join Date
    Feb 2011
    Location
    The Future.
    Posts
    5,600
    Mentioned
    396 Post(s)
    Quoted
    1598 Post(s)

    Default

    Well.. I'm completely lost now..


    I don't see why the code Olly posted shouldn't work.. It should work even if it is constant because it is an Object..

    This:

    Simba Code:
    procedure NativeInt.TestMe;
    begin
      WriteLn(@Self);
      Self := 123;
    end;


    shouldn't be valid syntax if it has no self pointer. What would be the point of it if you cannot even access the value pointed to by "this/self"?


    It's like this:

    Simba Code:
    Procedure TMufasaBitmap.something;
    begin
      //self is nil/null..
      //cannot access self.getWidth() cannot access "self" so you cannot access "self.anything".
    end;

    In that case, it makes no sense allowing the scripter to override or overload or even compose such a function if self isn't accessible regardless of whether it is const.

    Simba Code:
    procedure Test(const F: TFoo);
    begin
      Writeln(F.getMBitmaps());
    end;

    should be valid syntax since TFoo is an object and should have a self pointer (address of itself even though you can't take the address of a const).. It would be equivalent to:

    Simba Code:
    Function getMBitmaps(const self: ^TFoo): SomeMBitmaps;
    begin
      Result := self^.bmps;
    end;

    And that's perfectly valid..


    It now makes me confused as to why one is allowed and the other isn't. They are equivalent functions and should generate the same assembly.
    Last edited by Brandon; 09-03-2014 at 07:57 PM.
    I am Ggzz..
    Hackintosher

  24. #24
    Join Date
    Sep 2006
    Posts
    6,089
    Mentioned
    77 Post(s)
    Quoted
    43 Post(s)

    Default

    It depends on how you call it whether self will be nil. If you call it with a constant, it will be nil. I agree that it is not ideal, though. It would be better if the compiler gave an error when trying to call the method, instead of implicitly passing nil.

    The difference between your examples is that in the second example, the actual object is not a constant, only the pointer to it is. A referenced pointer is always writable.
    Hup Holland Hup!

  25. #25
    Join Date
    Feb 2011
    Location
    The Future.
    Posts
    5,600
    Mentioned
    396 Post(s)
    Quoted
    1598 Post(s)

    Default

    Quote Originally Posted by nielsie95 View Post
    The difference between your examples is that in the second example, the actual object is not a constant, only the pointer to it is. A referenced pointer is always writable.

    Ohh.. I see.

    So is this the thinking behind it:

    Simba Code:
    procedure test(const F: TFoo); //F itself is constant? as in a copy is made?
    begin
      F.set(X); //F is immutable and cannot be changed?
      F := nil; //valid or not valid.. makes no diff.
    end;

    OR is it:

    Simba Code:
    procedure test(const F: TFoo); //F is a constant reference to a mutable object?
    begin
      F.set(X); //perfectly valid because F is mutable?
      F := nil; //not valid.
    end;

    Because in both cases, I don't understand why a "F.get()" wouldn't work since it doesn't modify anything and only "gets" data.
    Last edited by Brandon; 09-03-2014 at 08:18 PM.
    I am Ggzz..
    Hackintosher

Page 1 of 2 12 LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •