Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding getUpText() and isUpText() #237

Merged
merged 3 commits into from Feb 28, 2016
Merged

Adding getUpText() and isUpText() #237

merged 3 commits into from Feb 28, 2016

Conversation

KeepBotting
Copy link
Contributor

Adds some OCR functions to SRL-6 using SimpleOCR. These functions will read UpText, similar to the existing functions that read mouse-over text.

Discussion thread on Villavu: https://villavu.com/forum/showthread.php?t=115737
Video: https://www.youtube.com/watch?v=VB-3e8vBRhU

filter: TCompareRules := [-1, 85, true, 55];
begin
ocr.clientID := exportImageTarget();
exit(replaceRegExpr('[^a-zA-Z\d\s]', ocr.recognize(box, filter), '', true));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you choose to remove everything that's not a character or a decimal from the result of GetUpText. Would not the raw output be better?

@slackydev
Copy link
Member

Looks good, would be nice if you could answer my one question tho.
Gonna give it some test-runs.

Update:
Tolerance could perhaps be tweaked a small amount, the shadow tolerance in particular, could be increased, didn't change much, but in worse cases it seemed to help, as the shadow is rather gray when facing very bright background. filter: TCompareRules := [-1, 85, true, 60];

I also noted that the space width is ~5pixels, rather than 4 which is default.

begin
  ocr.Init(FontPath + 'UpCharsEx');
  ocr.FontData.SpaceWidth := 5;
end; 

@MerlijnWajer
Copy link
Member

Agree, isn't a '-' etc also quite useful?

@KeepBotting
Copy link
Contributor Author

@warpie I decided it would be a good idea to sanitize the output if OCR ever bugged out and gave crazy output. I was experimenting with rs_GetUpText() and it kept giving me crazy output full of symbols and garbage characters so I guess I got kind of paranoid :P

You're right though, there's no real reason to do it. I'll also update the shadow tolerance and add the space width.

@MerlijnWajer Yeah, it is. Along with '/' as well. I see now that stripping the output was probably a bad idea. I'll change it.

Edit: Pushed. Thanks for the feedback :)

slackydev added a commit that referenced this pull request Feb 28, 2016
Adding getUpText() and isUpText()
@slackydev slackydev merged commit b5eb3b3 into SRL:master Feb 28, 2016
@slackydev
Copy link
Member

Merged :)

@TheTS
Copy link
Member

TheTS commented Feb 28, 2016

Nice work! Good to keep this ticking over.

Sent from phone. Excuse brevity.

-------- Original Message --------
From: Jarl Holta notifications@github.com
Sent: Monday, February 29, 2016 01:47 AM
To: SRL/SRL-6 SRL-6@noreply.github.com
Subject: Re: [SRL-6] Adding getUpText() and isUpText() (#237)

Merged :)


Reply to this email directly or view it on GitHubhttps://github.com//pull/237#issuecomment-189864110.

@KeepBotting
Copy link
Contributor Author

Thanks @warpie and @TheTS

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants