← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #232881]: Finder - how to match multiple sub-images within a captured image

 

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

    Status: Open => Answered

RaiMan proposed the following answer:
This is principally not possible with the current implementation: you
can only use one level of find operations  with a Finder() and you
cannot restrict the Finders find operation to a subregion of the given
image.

With this sequence of primary and secondary find operations on a real
screen, with every find, there will be made a new screenshot and
internally a new Finder(screenshot) for the respective area/subarea.

This does not happen in your Finder based solution with
current_match.find( field1 ) (which should be current_match.exists( field1 ), to make the if work ;-)

current_match is a region in the image, relative to its top left corner,
but with current_match.find( field1 ) it is used as coordinates relative
to the screen (the match currently does not "know", that it was made
from a Finder(image).find() operation).

So if you want to solve this with a captured image, then you have to use
Finder().findAll() for all objects and compare their coordinates, to
find out, wether one match lies inside of another match (version 1.0.0
has the respective functions like region.contains(another_region) )

I think your approach is very interesting and Sikuli should have the possibility, to use a stored image the same way it uses a screen.
I put it on the request list: use image as a virtual screen

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.