← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #255666]: Match a pattern in image file rather than screen

 

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

    Status: Open => Answered

RaiMan proposed the following answer:
Sikuli generally internally creates 2 in memory image "files" (in OpenCV
"language": CvMat objects), that are finally given to matchTemplate().

- the first image is a capture of the given search region (screen or region)
- the second is the image to search

The final outcome is a Match object, that holds the region, the image
occupies on the screen containing the search region in real screen
coordinates (so you can use the Match directly for mouse actions or
other screen related things)

What you are looking for is the class Finder
(http://sikulix-2014.readthedocs.org/en/latest/finder.html#finder)

f = Finder("someImage.png")
m = f.find("someOtherImage.png")

the resulting match (if found) has the coordinates relative to the top
left corner of someImage.png being (0,0).

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