Re: [Sikuli-driver] [Question #194144]: How to make exists(img, 0.01) return immediately even if it fails --- solution: Settings.WaitScanRate
Question #194144 on Sikuli changed: https://answers.launchpad.net/sikuli/+question/194144 Description changed to: * solution Set Settings.WaitScanRate temporarily to a high value (e.g. 100) Take Care: Using this as a standard might overload your system. For details look comments #8 and #9 - Starting with rc3 of SikuliX, when I do a time-sensitive search on a small region, * If the finder succeeds, exists() returns within the 0.01 duration specified * If the finder fails, the duration is ignored, instead going into crazy resource-hog mode, activating the text recognition module for a minimum of 200 times longer. 1) Is there YET an easy way to completely turn off the experimental text recognition stuff? 2) Is there a fix coming soon, to not hit that code in Vision.cpp when I'm searching for a .PNG and the find fails? Thanks in advance -- 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
Re: [Sikuli-driver] [Question #194144]: How to make exists(img, 0.01) return immediately even if it fails --- solution: Settings.WaitScanRate
Question #194144 on Sikuli changed: https://answers.launchpad.net/sikuli/+question/194144 Summary changed to: How to make exists(img, 0.01) return immediately even if it fails --- solution: Settings.WaitScanRate -- 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
Re: [Sikuli-driver] [Question #194144]: How to make exists(img, 0.01) return immediately even if it fails --- solution: Settings.WaitScanRate
Question #194144 on Sikuli changed: https://answers.launchpad.net/sikuli/+question/194144 Status: Answered => Solved EdEd confirmed that the question is solved: H. I don't think that's a very good work-around. print Settings.WaitScanRate 3.0 Setting that to 100, makes me unable to reproduce the error, even though you describe something totally different above. So, chalk it up to WinXP being different from Win7 emulated, I suppose. I'll retry more specific timing tests tonight or this weekend. (I.e. 1, 2, 3, 10, 20, 50, 100 searches per second.) Very interesting solutions, if it works. (Just hope the extra overhead doesn't crash the applications being watched.) Thank you. -- 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
Re: [Sikuli-driver] [Question #194144]: How to make exists(img, 0.01) return immediately even if it fails --- solution: Settings.WaitScanRate
Question #194144 on Sikuli changed: https://answers.launchpad.net/sikuli/+question/194144 EdEd confirmed that the question is solved: Thanks RaiMan, that solved my question. -- 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
Re: [Sikuli-driver] [Question #194144]: How to make exists(img, 0.01) return immediately even if it fails --- solution: Settings.WaitScanRate
Question #194144 on Sikuli changed: https://answers.launchpad.net/sikuli/+question/194144 RaiMan posted a new comment: --- WinXP being different from Win7 emulated This is the internal logic for the basic search operation: - load the given image from the image path - if the file is not found, take string as text and try to search for that using OCR (with error log message) - start a timer - evaluate max waiting time (standard or given value) - evaluate WaitScanRate: 1 Second / WaitScanRate => minimum time to elapse until next search is started after the start of the last one (standard: 1 / 0.3 = 0. seconds) - make one search trial - if found go back to caller returning match - if not found check max waiting time reached, if yes, return to caller (might give FindFailed exception) - if not found, wait until minimum search elapsed time is reached and start next search This is totally written at the Java level and is definitely the same on Win XP and Win 7, emulated or not. I will post a request bug: when using a wait time that is smaller than the step timing based on the WaitScanRate when using exists, it should return after the given duration, even if the pattern is not found. This makes sense, since exists() is mostly used in decision situations, where you might want the same timing, no matter wether it is found or not and independently from current WaitScanRate. --- Just hope the extra overhead doesn't crash the applications being watched this could easily be fixed for your situation: instead of using exists(image, 0) make the following def: def fastExists(image, wait, reg = SCREEN): wsr = Settings.WaitScanRate Settings.WaitScanRate = 100 m = reg.exists(image, wait) Settings.WaitScanRate = wsr return m and use it if fastExists(image, 0): So the the high scan rate is exclusive for the fastExists and in fact does not matter, since in this case it is searched only once anyway. -- 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
Re: [Sikuli-driver] [Question #194144]: How to make exists(img, 0.01) return immediately even if it fails --- solution: Settings.WaitScanRate
Question #194144 on Sikuli changed: https://answers.launchpad.net/sikuli/+question/194144 Linked to bug: #988206 https://bugs.launchpad.net/bugs/988206 "[request] exists(image, 0) should return immediately even if pattern is not found" -- 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
Re: [Sikuli-driver] [Question #194144]: How to make exists(img, 0.01) return immediately even if it fails --- solution: Settings.WaitScanRate
Question #194144 on Sikuli changed: https://answers.launchpad.net/sikuli/+question/194144 EdEd posted a new comment: By the way, is there any penalty for changing the WSR (perhaps 10 times per second) in that manner? -- 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
Re: [Sikuli-driver] [Question #194144]: How to make exists(img, 0.01) return immediately even if it fails --- solution: Settings.WaitScanRate
Question #194144 on Sikuli changed: https://answers.launchpad.net/sikuli/+question/194144 RaiMan posted a new comment: Since searches is mainly processing of huge integer arrays, a search boosts up cpu-usage to 100 %. Only searches in small regions less than 300x300 pixels have a chance to get in the range of 0.1 seconds on capable machines. So the penalty is 100% cpu-usage all the time, if you use a higher scan rate. But since the average optimized searches last 0.3 to 0.5 seconds, using a higher WSR only makes sense in very special cases (e.g. observing something in rather small region). -- 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
Re: [Sikuli-driver] [Question #194144]: How to make exists(img, 0.01) return immediately even if it fails --- solution: Settings.WaitScanRate
Question #194144 on Sikuli changed: https://answers.launchpad.net/sikuli/+question/194144 Eugene Maslov posted a new comment: Raimund, I still face this problem, and it is reproduced in both 1.0.1 and the last version rc3 Recognizing unrecognizable texts, I need quick response about missing images, searching quickly in very small regions (10x20px in 80x30px), I hope it should not cause hardware performance problems even with high scan rates. Nevertheless, nothing helps to reduce negative response time to less than 0.3 sec, while positive response is returned within 0.02 sec. It extends the whole processes to dozens of seconds. AutoWaitTimeout, ObserveScanRate, WaitScanRate parameters seem to help to reduce to 0.3 sec, but not less. This is the sample: (menu_modify.png is a small screenshot of "Modify" main menu of any program, M.png, o, d.png are just tiny characters cut out from it . I don't know how to attach them to this message. Before start, I open menu_modify.png in any image editor) import time oldsim=Settings.MinSimilarity smallArea=SCREEN.find("menu_modify.png") smallArea.highlight(2) oldtimeout=smallArea.getAutoWaitTimeout() oldrateO=Settings.ObserveScanRate oldrateW=Settings.WaitScanRate for i in "Modus": tofind=i+".png" Settings.MinSimilarity=0.95 smallArea.setAutoWaitTimeout(0.01) Settings.ObserveScanRate=100 Settings.WaitScanRate=100 starttime=time.time() if smallArea.exists(tofind) is not None: print i+" found" else: print i+" not found" print "elapsed for "+i+" : "+ str(time.time()-starttime) Settings.WaitScanRate=oldrateW Settings.ObserveScanRate=oldrateO smallArea.setAutoWaitTimeout(oldtimeout) Settings.MinSimilarity=oldsim This is the printed output: M found elapsed for M : 0.0099046326 o found elapsed for o : 0.0099046326 d found elapsed for d : 0.019809265 u not found elapsed for u : 0.3155722 s not found elapsed for s : 0.3155722 Are there any more parameters, allowing to reduce the time of negative exists() response? -- 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
Re: [Sikuli-driver] [Question #194144]: How to make exists(img, 0.01) return immediately even if it fails --- solution: Settings.WaitScanRate
Question #194144 on Sikuli changed: https://answers.launchpad.net/sikuli/+question/194144 RaiMan posted a new comment: already tried version 1.1.0? should work there. start here: http://sikulix.com this example: img = Pattern("img.png").exact() m = get(Region.NW).find(img) m.exists(img, 0) # in the region where the image was found m1 = m.right(10).right(m.w) m1.exists(img, 0) # in a region to the right, where it should not be gives the following log: (watch the search times at the end of the lines in [ ] ) [debug] Image: from cache: file:/Volumes/HD6/rhocke-plus/SikuliX-2014/StuffContainer/testScripts/testCapture.sikuli/img.png [debug] Region: find: waiting 3,0 secs for P(img.png) S: 0.99 to appear in R[0,0 640x400]@S(0) [debug] Region: checkLastSeen: not there [debug] Region: find: P(img.png) S: 0.99 has appeared at M[98,60 23x23]@S(S(0)[0,0 1920x1200]) S:1,00 C:109,71 [96/96 msec] [debug] Region: exists: waiting 0,0 secs for P(img.png) S: 0.99 to appear in M[98,60 23x23]@S(0) [debug] Region: checkLastSeen: still there [debug] Region: exists: P(img.png) S: 0.99 has appeared at M[98,60 23x23]@S(S(0)[0,0 1920x1200]) S:1,00 C:109,71 [3/3 msec] [debug] Region: exists: waiting 0,0 secs for P(img.png) S: 0.99 to appear in R[131,60 23x23]@S(0) [debug] Region: exists: P(img.png) S: 0.99 has not appeared [4 msec] -- 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
Re: [Sikuli-driver] [Question #194144]: How to make exists(img, 0.01) return immediately even if it fails --- solution: Settings.WaitScanRate
Question #194144 on Sikuli changed: https://answers.launchpad.net/sikuli/+question/194144 RaiMan posted a new comment: One more thing: to get this debug information, use Debug.setDebugLevel(3) -- 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
Re: [Sikuli-driver] [Question #194144]: How to make exists(img, 0.01) return immediately even if it fails --- solution: Settings.WaitScanRate
Question #194144 on Sikuli changed: https://answers.launchpad.net/sikuli/+question/194144 Eugene Maslov posted a new comment: Thank you Raimund, it really works there. -- 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