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

Improve performance of Material Detector #459

Merged
merged 4 commits into from
Jul 17, 2024

Conversation

jw098
Copy link
Collaborator

@jw098 jw098 commented Jul 10, 2024

  • use Waterfill OCR instead of straight OCR. I tested it for number 1->999 for both white and black text.
  • since we only need 1 thread for Waterfill OCR, I also parallelized detection of material value. I tested it on my old laptop, it runs well, and runs faster than before.

);
// filtered.save("DebugDumps/test-one-filter-1.png");
bool is_dark_text_light_background = image_stats(filtered).average.sum() > 500;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'm not sure if this is the best way to check if the text is dark vs light. Happy to hear any suggestions.

Copy link
Collaborator

Choose a reason for hiding this comment

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

500 feels too high. IIRC, I've had issues detecting whites in the past with 500 on my "bad" capture card.

What are the actual values for dark vs. light? Maybe pick the mid-point?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Dark text light background is usually >600. Light text dark background is usually <200.
I've changed it to 400.
Also, I do apply a binary filter first, so that should hopefully help as well.

@Mysticial Mysticial merged commit b56be1e into PokemonAutomation:main Jul 17, 2024
6 checks passed
@jw098 jw098 deleted the material-ocr branch July 24, 2024 04:31
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.

2 participants