Long matching time with a little discrepancy of images.

How to reduce matching time if I added a little discrepancy in a image?
The time parameter “1” in following statement didn’t have effect if I add,for example 3% discrepancy,in image matching.

Sample code:
ImageFound (1, “SomeImage”)

Adding discrepancy is always going to slow down the search – it makes eggPlant look at many more possible matches. The discrepancy search is a tool that should be used very sparingly because of this and because it can lead to false positives.

Adding the time parameter to the ImageFound function tells eggPlant to spend at least that long looking for the image, not to spend no more than that. EggPlant looks for the image until it finds it or until it hits the ImageSearchTime. You can shorten the amount of time eggPlant spends looking, but that’s just going to mean that it’s going to give up without finding the image more often.

Hi Matt,for your answers,I have two more questions.

1.What is the difference between image Discrepancy and Tolerance?Below is explanation from Eggplant reference.
Tolerance:The acceptable difference between color values in an image and a match in the Viewer window

Discrepancy:The percentage or absolute number of pixels that may differ between an image and a match in the Viewer window
My understanding is that Tolerance was aimed at color value of images,but Discrepancy was aimed at pixels of images,am I right?If there is 1% discrepancy in a image,a mismatching failure still be reported even if I increased image’s Tolerance.

2.I have to figure out the behavior of ImageFound() Function
Refer to Eggplant Reference:
Example: Put ImageFound (10, “SomeImage”)
Put ImageFound (“SomeImage”)
Parameters: One or more image references; can also take a maximum wait time as the first parameter.
Returns: True or False.
Behavior: Searches for the given images in the Viewer window; returns true if an image is found, and false if no image is not found. (A maximum wait time parameter allows time for an image to be found before false is returned.)
Note: A maximum time of 0 causes EggPlant to perform an immediate search, without refreshing the Viewer window or repositioning the mouse in a further attempt to find the image. This is the fastest way to search for an image that may not be present.
I think the time parameter is the maximum wait time not minimum time.
And the default value of ImageSearchTime is 1.8 seconds.So if I want to shorten image searching time,what value is acceptable?

Yes, Tolerance deals with color variations and applies to each of the RGB channels for each pixel. Discrepancy is the percentage of pixels that can fall outside of the tolerance. So let’s say you have a relatively small image containing 1000 pixels and let’s further suppose that the contents of the screen are such that there are quite a few places where given the image’s tolerance it almost matches. Now let’s suppose that you’ve set a Discrepancy of 3%. For each image that almost matches with the tolerance, instead of just moving on to the next position on the screen, eggPlant has to stop and look at each pixel and figure out how many of them fall outside of the image tolerance. If it’s more than 30, then it moves on to look at the next area of the screen; less, it’s a match. In practice, it’s almost never the case that setting the discrepancy does anything to improve the reliability of a script.

The time parameter on the imageFound function is the minimum time that eggPlant will look for an image before failing. I say it’s the minimum because once that time has elapsed, eggPlant may still be in the middle of searching the screen and it generally does one more full screen refresh and search before giving up. You can make a couple of tweaks to some settings to make eggPlant find images a fraction of a second sooner, but only if those images are there. Since eggPlant stops searching as soon as it finds a match, shortening the search time is only going to cause your scripts to fail more often because you won’t be giving the SUT time to respond.