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

Request: Good Affix Roll Marker #64

Closed
LostPoE opened this issue Nov 3, 2023 · 8 comments
Closed

Request: Good Affix Roll Marker #64

LostPoE opened this issue Nov 3, 2023 · 8 comments
Labels
enhancement New feature or request

Comments

@LostPoE
Copy link

LostPoE commented Nov 3, 2023

An additional highlight marker if an Affix roll is good.
For exaple, the # mana Affix can roll from 3 – 9 . If the Affix roll is >7 then add another identifier.
So with the existing Diablo4Companion format you could add another dot marker if the roll is good.
Just an idea.

Thanks

@josdemmers
Copy link
Owner

Thanks for the suggestion. With the current implementation, using images to detect affixes this is not possible.

However, it is likely that I change this to OCR in the future. Everything will be converted to text then.
That should make it possible to compare the affix roll as well.

I have currently no idea if OCR will be fast enough for the overlay. So no promises yet I'll implement this.

@mutschler
Copy link

mutschler commented Nov 6, 2023

maybe consider using tesseract for OCR.
Since you already mask out the areas which are interesting it should be pretty fast and supports more than 100 Languages already

From a quick test using the example image from readme with tesseract on a rather old system it took 0.04 to 0.3 seconds to run the text recognition on the whole image:

PROTECTING
ADVENTURER'S TUNIC.

Legendary Chest Armor
379 Item Power

663 Armor

©  17 Willpower  [13 - 19]

‘©  15 Intelligence  [13 - 19]

‘© 22.0% Fire Resistance [13.0 - 22.0]%

© 1.8% Damage Reduction [1.2 - 3.0]%

  When hit while not Healthy, a
‘magical bubble is summoned around
you for 4.5 [3.0 - 5.0] seconds. While
standing in the bubble players are
Immune. Can only occur once every
90 seconds.

Requires Level 21
Account Bound

Results might could be further improved by not feeding the whole item at once and splitting it up in different chunks. There are problems detection the Diablo Style "O" (used in item name only i think) and a few other characters (like affix markers etc) but that could simply be ignored / cutoff

@josdemmers
Copy link
Owner

Sounds promising, and yes was planning to use tesseract. Still looking for a C# implementation though.
Used this one in the past for another project: https://github.com/CptWesley/TesserNet
But that comes only with an English language model. Suggestions for a C# implementation are welcome.

0.04 to 0.3

Does it really vary that much? 0.3 sec would be way too slow to be useful.
Applying OCR is only the first step. Would also need to clean up the result and find an affix matching the text. Costs some time as well.

Version 2.0 of the app is already designed with OCR in mind. Each affix and aspect has it's own region in the app. That should help getting the processing time down to a minimum.

I'll get to implementing OCR eventually, but not anytime soon.

@Jeremy-JJ
Copy link

Jeremy-JJ commented Dec 8, 2023

Someone wrote something in python. For the sake eliminating a C# implement, you could work from here:
https://github.com/mxtsdev/d4-item-tooltip-ocr

This is also written in C# (might be able to borrow some code):
https://github.com/Riketta/VersaLootFilterD4

This library may even be of use, particularly the trained dataset:
https://github.com/SanctuaryTeam/diablo4trading-ocr

@josdemmers
Copy link
Owner

Thanks for the examples. But I think I have already found an OCR lib I'm going to use:
https://github.com/charlesw/tesseract, it's free and open source.

The one from the VersaLootFilterD4 uses IronOCR, it's too expensive to use (https://ironsoftware.com/csharp/ocr/licensing/).

The complete Diablo4Companion project is in C#, so I'm not planning to switch to another language. But it can always be interesting to look at implementations in other languages.

Regarding the trained dataset that is probably just the default from tesseract?
They are available on the official repo including all other languages:
https://github.com/tesseract-ocr/tessdata/

@Jeremy-JJ
Copy link

Thanks for the examples. But I think I have already found an OCR lib I'm going to use: https://github.com/charlesw/tesseract, it's free and open source.

The one from the VersaLootFilterD4 uses IronOCR, it's too expensive to use (https://ironsoftware.com/csharp/ocr/licensing/).

The complete Diablo4Companion project is in C#, so I'm not planning to switch to another language. But it can always be interesting to look at implementations in other languages.

Regarding the trained dataset that is probably just the default from tesseract? They are available on the official repo including all other languages: https://github.com/tesseract-ocr/tessdata/

Jos,

I wasn't aware Versa was using Iron, but Tesseract does work quite well and is utilized by the Sanctuary Team for diablo.trade.

It does make occasional mistakes, however, which is why I presumed training was required to minimize error or allow for detection of OCR error, i.e. with a model knowing a given affix has to be within a particular numerical range and so forth.

With respect to implementation, I'm not sure if they trained their model to do so or have it hardcoded in. Judging from what I've seen of other OCR implementations for such an application, particularly loot filters, they trained their own models specifically for D4.

Beyond this, I look forward to your implementation of OCR and the changes to come to the UI, especially for setting min values. At present, I've been bouncing between your application and Aeon0's D4LF, which has some extra features for marking your loot as trash or favorite, but has no UI and requires a few YAML edits, which can be somewhat inconvenient or render the application unusable for the average person.

All the best,
Jeremy

@josdemmers
Copy link
Owner

First step is done, v3 is now available for download. Detection now works with OCR.
Haven't looked into affix rolls yet. That is for later.

@josdemmers josdemmers added the enhancement New feature or request label May 22, 2024
@josdemmers
Copy link
Owner

This will be added with the v4 release when season 6 starts.
https://github.com/josdemmers/Diablo4Companion/wiki/How-to-use-the-affix-value-filter

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

No branches or pull requests

4 participants