Linked Questions

Popular Questions

Taking into account slight differences in color

Asked by At

I'm trying to make a simple EV training bot for pokemon black where it checks to see if a lillipup is on the screen via color.

The issue is, sometimes when a lillipup appears, it's ever so slightly different in color (obviously, not a shiny). It can be 1-3 higher or lower in any of the RGB channels which makes it almost impossible to predict.

I've tried doing a simple distance check between them (as if they were 3d coordinates) but it doesn't seem to work no matter how low I make the threshold (it still is triggering when the threshold is 1 and lillipups color is no where on the screen).

Code(Color is the 'default' lillipup color I'm comparing against):

        color = img.getpixel((x,y))


Am I doing something wrong here or should I be doing this a different way?

Related Questions