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

Better define tolerance #7

Open
paulie-g opened this issue Sep 15, 2017 · 3 comments
Open

Better define tolerance #7

paulie-g opened this issue Sep 15, 2017 · 3 comments

Comments

@paulie-g
Copy link
Owner

Issue by daluu
Friday Nov 18, 2011 at 23:31 GMT
Originally opened as autopilot-rs#25


I dont' think tolerance is really defined in the tutorial or the API doc. What are the valid ranges for tolerance values? 0.0 to 1.0? Or greater than 1 as well?

Based on testing, I'm assuming 0.0, the default, is must be exact match? And towards 1.0 means higher tolerance for partial or even no matches. At 1.0, for a test needle, testing with find bitmap against screen capture, it returns coordinates of (1,1) when the needle is not even present.

So would be helpful to clarify for users who are not well skilled in image recognition tools.

@paulie-g
Copy link
Owner Author

Comment by teukkam
Friday Mar 16, 2012 at 10:33 GMT


I was wondering about the same. Based on your finding, tolerance seems to indicate the amount of deviation from the colour that is still accepted as a match. Thus 1.0 would mean that 100% deviation is still OK, meaning that anything will pass.

@paulie-g
Copy link
Owner Author

Comment by daluu
Friday Mar 16, 2012 at 23:55 GMT


Thanks for the description teukkam, that is helpful.

@paulie-g
Copy link
Owner Author

Comment by teukkam
Monday Mar 26, 2012 at 10:01 GMT


If you want the gory details, you can see in utils.c how it's calculated. The colours' Euclidean distance in the colourspace is calculated as a square root of the sums of each colour component delta (red, green and blue) which is compared against tolerance * 442, which means that at a tolerance of 1 or higher, anything will match even if the colour deltas exceed 256 which is the maximum.

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

No branches or pull requests

1 participant