Skip to content
This repository has been archived by the owner on Jun 10, 2018. It is now read-only.

Better define tolerance #25

Open
daluu opened this issue Nov 18, 2011 · 3 comments
Open

Better define tolerance #25

daluu opened this issue Nov 18, 2011 · 3 comments

Comments

@daluu
Copy link

daluu commented Nov 18, 2011

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.

@ghost
Copy link

ghost commented Mar 16, 2012

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.

@daluu
Copy link
Author

daluu commented Mar 16, 2012

Thanks for the description teukkam, that is helpful.

@ghost
Copy link

ghost commented Mar 26, 2012

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 subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants