This makes the favorite_box color check work much better. Instead of using an absolute number of pixels, which could vary hugely between configurations and devices, it calculates the ratio of yellow pixels against non-yellow pixels in the area.
I did 30 tests with this approach and it worked flawlessly on 29 of them, losing the 100% for a Moltres that covered the entire favorite icon twice in a row. The old approach scored 16/30, which means 14 false-positives, or potentially 14 already favorited pokemons that got unfavorited (is this even a word?...).
This is definitely a much more reliable approach.
For now only the favorite_box was changed. Next step is to do the same on the appraisal box, though that one is much more less likely to fail, so.. yeah.. :grin:
This makes the favorite_box color check work much better. Instead of using an absolute number of pixels, which could vary hugely between configurations and devices, it calculates the ratio of yellow pixels against non-yellow pixels in the area.
I did 30 tests with this approach and it worked flawlessly on 29 of them, losing the 100% for a Moltres that covered the entire favorite icon twice in a row. The old approach scored 16/30, which means 14 false-positives, or potentially 14 already favorited pokemons that got unfavorited (is this even a word?...).
This is definitely a much more reliable approach.
For now only the favorite_box was changed. Next step is to do the same on the appraisal box, though that one is much more less likely to fail, so.. yeah.. :grin: