Just curious, is there any way to find images with a certain similarity with regard to pixels?
I know you can search with a tolerance as far as colour goes, which is fine – but I have situations where two images are quite similar, aside from a handful of pixels which are different. Is there a way to find an image with an argument like “match to the image if 75% of the pixels are the same”.
If that can’t be done, any idea for strategies to verify results which may vary slightly from run to run. (read: slightly randomized, yet similar, images)
There’s not currently a way to specify this sort of partial match, but there may still be a way of dealing with this, depending on exactly how your image is changing.
If there is a particular portion of the image where the variability is known to occur, you can use a third-party tool like GraphicConverter to create an alpha mask that will remove the masked pixels from the match. The following steps work in GraphicConverter:
- Open the tiff image
- Select Effect > Add Alpha/Mask Channel
- Select Effect > Show Alpha/Mask Channel
- Set the foreground color to white
- Using the drawing tool of your choice, fill the area where the variability occurs with white pixels. This has the effect of giving them an opacity of 0 (i.e., making them transparent).
- Select Effect > Hide Alpha/Mask Channel. The “masked” pixels will show the background color.
- Save the image.
- You many need to restart Eggplant in order for it to pick up the change.
Now when Eggplant looks for the image, it will exclude the masked pixels from the search. Taking this a step further, you could try something like having 4 versions of the image, each with a different quadrant masked out and then do a WaitForAny command with these 4 images as arguments.
If the variation can occur anywhere across the entire area of the image, then there’s probably no easy way of dealing with it in the current Eggplant release.
We are always re-evaluating our search algorithms and looking at new ways of making Eggplant more robust, so we appreciate your question/suggestion. It would be really helpful to us if you could send us a few examples of the image that you are try to find so that we can see what type of variation occurs, how extensive it is, and how a search algorithm would need to be designed to accomodate this variation. It’s also possible that if we can see the image in question, we will be able to suggest another approach using existing Eggplant functionality. If you are willing to provide us with this information, please send the images to firstname.lastname@example.org.
This method will certainly work with some of our issues, I’m sure.
And we’ll look into gathering some images to send along to show the kind of variation we’re dealing with.