← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #184410]: Multi-Part Pattern: Sikuli + Regex = Sikex (searching simultanouesly for more than one image)

 

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

Josh posted a new comment:
I will elaborate some on some of my design decisions there may be some
confusion:


> The fact, that some images should be processed in a specific order in some common context is more a workflow aspect, 
> than an image attribute. You encode it with the images, from where you have to translate it back to a (ok: standardized)
> workflow. So why not write down the workflow directly (ok: should be supported by some functions/classes)

I think we may have come to the same conclusion and there may be some
confusion behind what details I am storing inside the PNG and what the
naming convention is used for.

--- Naming Convention

I wanted the image naming to have some "magic" where the image name
itself would designate if it's a single image or if there is other parts
to be subsequently matched.

There are a few different situations that can happen:
-- Single 
resourceName.png

-- Series - AND - All images must be matched to create a single region
resourceName-0.png
resourceName-1.png
...

-- Single image sequence - OR - Try and find resource 0 OR resource 1
resourseName[0].png
resourceName[1].png

Sequence-Series - OR + AND - Try and find all images in the series, if one fails try the next sequence
resourceName[0]-0.png
resourceName[0]-1.png
resourceName[0]-2.png - If this one doesn't match, proceed to next series

resourceName[1]-0.png
resourceName[1]-1.png

--- PNG attributes

There are three different contexts:
1) previous - Perform operations on Region context returned by previous match
2) current - Perform operations on Pattern of current find operation
3) next - Perform operations on the Region context for the next find operation

--- Image Seq/Series + PNG attributes

Combing these two ideas gives us the power to create a Region context
for which the next image is matched instead of searching the entire
screen.  Say for example image-0.png is matched successfully, then we
contain a .below() region transform in image-0.png.  When image-1.png is
matched it will use the transformed region from image-0.png as the
context in which it should be matched. (Eg. Matching the edges of a
window)

--

I don't think it is possible to store region transform details as a
naming convention, for my own solution I am keeping the naming dead
simple so it is easy to identify resources from directory listings.

--

Here is the code for my imageRegion class which performs all the operations dicussed:
http://pastebin.com/VwABPs1C

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