← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #670930]: Algorithm: find from within a list of images

 

Question #670930 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/670930

    Status: Open => Answered

Alex proposed the following answer:
This is pretty straight forward, if I understood your question
completely:

1. Generate a list of your images:
image_search_list = ['img1.png', img2.png', img3.png'...]

2. Cycle through this list in a for loop:

for image in image_search_list:
    if exists(image, 0.2):
        click(image)
        break

This will cycle through every image in your list. If it is detected, it
is clicked. The loop is broken and stops searching after one image is
found. You can wrap that in it's own loop with the necessary waits and
clicks to get back to this search. You will likely need to play with the
search time. I defaulted to 0.2.

You can, and likely should make refinements to the process with regions
and patterns. Regions can limit your search area which can make your
searches faster. You made need to refine the image as a pattern to set
your image match percentage (default is a 70% match). Lower the match
percentage can speed up the process but may introduce false positives.
Again, you will need to experiment.

I can answer more questions if you further articulate the question.

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.