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

Description changed to:
Hello,

I have searched the forums and while I have read posts that seem to
apply to the problem I am having, I can not nail down a workable
solution.  I am using Sikuli 1.0.1, and I am coding in Java on a Windows
7 machine.  I am also fairly new to coding in Java and using Sikuli.

My problem is this:

I have an array of 10 small images (10x15 pixles in size) that I iterate
through looking for a match using r.exists (the region is 12x17 pixels)
and when a match NOT found there seems to be a delay of ~300 ms before
the next check is made.

Here is the code:

int i =0;
for(Pattern p : pNumberArray){
    if(r.exists(p.similar(.9f), 0) != null){
        System.out.println(library.getTime() + " Image Found        : " + p);
    return i;
    }
    System.out.println(library.getTime() + " Image not found        : " + p);
    i++;
}

Here is the result when I run the above code.

12:19:01:032 Image not found 
12:19:01:365 Image not found 
12:19:01:698 Image not found
12:19:02:031 Image not found
12:19:02:364 Image not found 
12:19:02:697 Image not found

I was hoping using a 0 for (r.exists(p/similar(.9f), 0) would fix the
300ms delay problem but it does not.

I then read up on 'Settings.AutoWaitTimeout'
(https://answers.launchpad.net/sikuli/+question/251337) but ruled it out
as not applicable in my case.  As I understand it, using the 0 in
(r.exists(p/similar(.9f), 0) forces a one time check of the image and
immediately returns the match if found or NULL if not
(https://answers.launchpad.net/sikuli/+question/251337), so there should
be NO delay in a response whether an image is found or not.

Searching forum posts turned me on to 'Settings.ScanRate'
(https://answers.launchpad.net/sikuli/+question/194144) so I tried
setting 'Settings.WaitScanRate = 100;' so that it would search for a
match for no more than .01 seconds and return the result, but changing
that setting had no effect.  I also tried a variety of values including,
500, 1, .1f, and .01f but the results when running the code above was
always the same with ~300 ms delay.

So all that being said, that leads to my questions:
1) I assumed that setting the timeout to 0 when using exists on a region 
(r.exists(p/similar(.9f), 0) would result in NO delay in a response whether an 
image is found or not.  That is not the case.  Why is there a ~300 when the 
timeout is set to 0?

2) I assumed that setting 'Settings.WaitScanRate = 100;' would force a
search result at the end of .01 seconds.  It does not.  Am I missing
something about how this works?

3) One post I read mentioned that there used to be an issue setting the
values of Settings fields wouldn't work because the variables used a
'protected' modifier, but I can change the value and see the results of
modifying the value between 'Settings.MoveMouseDelay = 1;' and
'Settings.MoveMouseDelay = 0;' so that leads me to believe that I can
change the value of Settings fields.  Is the 'Settings.WaitScanRate'
indeed a protected variable and one that I cannot change?

4) I can't imagine it taking ~300ms to match a 10x15 pixel image in a
12x17 pixel search region.  That 300ms isn't the amount of time it takes
to actually search for a match in the region is it?

I spent hours and hours and hours reading forum posts and experimenting
with different code combinations but I can't get rid of the ~300ms delay
when an image is NOT found.

Thanks in advance for any wise words of wisdom!

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

_______________________________________________
Mailing list: https://launchpad.net/~sikuli-driver
Post to     : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp

Reply via email to