this was spammed by some arab idiot

Asked by Eugene S

content lost.

changed by a spammer.

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
RaiMan
Solved:
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said :
#1

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).

Revision history for this message
Eugene S (shragovich) said :
#2

Hi RaiMan,

Thanks for the answer.
I have just tried that and I'm a bit confused about the results.

You have mentioned that as a result I should get a Match object. However when I tried to run the below code, I've got the path of the found pattern.

The code:
f = Finder("TestBigPic.png")
m = f.find("TestSmallPic.png")
print m

The result:
C:\SikuliX\Tests\images\TestSmallPic.png

where:
testBigPic.png - is the main image that includes a pattern
testSmallPic.png - is the pattern I am looking for in "testBigPic.png"

I was expecting to get a printout of the Match object as something like that:
M[9,986 37x36]@S(0)[0,0 1280x1024] S:1.00 Center:27,1004

As I would get from:
print find("pattern.png")

Have I got it wrong idea or I am doing something incorrectly?

Thanks!
Eugene

Revision history for this message
RaiMan (raimund-hocke) said :
#3

LOL, quick and dirty RaiMan rubbish ;-)
sorry for not being complete.

... but the mentioned docs example should show, what kind of rubbish I wrote down.

Revision history for this message
Eugene S (shragovich) said :
#4

OK, looks like I've got it working as expected.
One more question though..

I assume that the coordinates of the resulting Match object are relative to the left top corner of the image I was searching in. Is that correct?

Thanks!
Eugene

Revision history for this message
Best RaiMan (raimund-hocke) said :
#5

ok.

--- I assume that the coordinates of the resulting Match object are relative to the left top corner of the image I was searching in. Is that correct?

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

Revision history for this message
Eugene S (shragovich) said :
#6

Ok, sorry.
Missed that!

Thanks!

Revision history for this message
Eugene S (shragovich) said :
#7

Thanks RaiMan, that solved my question.