masked part is not ignored

Asked by BOCHENG YIN on 2018-11-07

I try to test if the mask() function will block the masked region in sikulix 1.1.4.
What I do is to put a picture in powerpoint and place a black box blocking its center area. Then create a mask pattern with a snapshot of its current look. Then I move the black box away from the picture. Now the center of the image is exposed. After that, I run the code to ask if sikulix can find the element in the center of the image. and sikulix still can. Why?? Would its center suppose to be ignored?

code:
reg=Pattern("1541610697055.png").mask()

r1 = find(reg).highlight(1,"green")
if exists(reg):
    print("the pattern found1")
else: print("pattern not found")
if r1.exists("1541610784910.png"):
    print("snipping tool found1")
    click(r2)
else: print("snipping tool not found1")

Message:
[log] highlight M[213,358 282x294]On(0) S 10000 for 1.0 secs color: green

the pattern found1
snipping tool found1

[log] CLICK on L(358,503)@S(0)[0,0 1440x900] (527 msec)

Thanks!

Question information

Language:
English Edit question
Status:
Open
For:
Sikuli Edit question
Assignee:
No assignee Edit question
Last query:
2018-11-08
Last reply:
2018-11-08
masuo (masuo-ohara) said : #1

Please upload related images somewhere internet site.

BOCHENG YIN (borishappy2009) said : #2

my sikulix code:
https://drive.google.com/open?id=1Z9I4zJt15Bs-BpLPILRHCU_jzs6EqgrB
the test image:
https://drive.google.com/open?id=1A2q6jH6ky6M5NQ8_Lb_MXp4HM8cNGtC1

Open the test image PPT file. Don't put it full screen.
Then test the sikulix code to see if you can repeat the strange result. Thanks!

masuo (masuo-ohara) said : #3
BOCHENG YIN (borishappy2009) said : #4

Hi, Masuo,
I am confused! I do read the tutorial you pushed before I posted the question.
The masked image is the same in total size with the image when the black mask is taken off.
What do you mean about the size?
Do you mean the masked part must be on the edge as a frame? Can it be in the center?
Thanks!

masuo (masuo-ohara) said : #5

reg=Pattern("1541610697055.png").mask()
r1 = find(reg).highlight(1,"green")
r1 is a match object, not "1541610697055.png".

If you want to search "1541610784910.png" in "1541610697055.png", use Finder().
https://sikulix-2014.readthedocs.io/en/latest/finder.html

BOCHENG YIN (borishappy2009) said : #6

Thanks!

On Thu, Nov 8, 2018 at 3:57 PM masuo <email address hidden>
wrote:

> Your question #676000 on Sikuli changed:
> https://answers.launchpad.net/sikuli/+question/676000
>
> Status: Open => Answered
>
> masuo proposed the following answer:
> reg=Pattern("1541610697055.png").mask()
> r1 = find(reg).highlight(1,"green")
> r1 is a match object, not "1541610697055.png".
>
> If you want to search "1541610784910.png" in "1541610697055.png", use
> Finder().
> https://sikulix-2014.readthedocs.io/en/latest/finder.html
>
> --
> If this answers your question, please go to the following page to let us
> know that it is solved:
> https://answers.launchpad.net/sikuli/+question/676000/+confirm?answer_id=4
>
> If you still need help, you can reply to this email or go to the
> following page to enter your feedback:
> https://answers.launchpad.net/sikuli/+question/676000
>
> You received this question notification because you asked the question.
>

Can you help with this problem?

Provide an answer of your own, or ask BOCHENG YIN for more information if necessary.

To post a message you must log in.