|
Post by dmidon on Mar 10, 2017 14:32:28 GMT
I have 60 patterns (128x26 pixels) and just want to know which one has the best score on a specific 128x26 region.
I'm setting MinSimilarity to 0.0 and using a loop to perform 60 calls to roi.find().
As the regions have exactly the same size, the comparisons usually are very fast.
The similarity with the right pattern always is high (0.8 ~ 0.9), while with the wrongs are low (0.05 ~ 0.3).
But sometimes roi.find() returns an exception ("could not found the pattern"), even with MinSimilarity = 0.0.
I'm using pcall() to "silent" this exception, but when roi.find() does not returns any match, the execution time is dozens of times superior than the regular case.
There's some alternative to my problem? Maybe a primitive function that just "compare" two regions with the same size?
Or some not-documented setting that avoids the "NoFindException" (as far as I know, there's no findNoFindException at the API guide, right)?
Regards!
|
|
|
Post by AnkuLua on Mar 10, 2017 14:35:58 GMT
Use exists()
if (exists(target)) then getLastMatch():getScore() ... end
|
|
|
Post by dmidon on Mar 10, 2017 17:37:25 GMT
Thanks for the rapid answer, but I got the same behavior with exists(). But I think I found a solution. The regular comparison time was 0.01s, the slow time was 3.01s. Very close of the default wait time... When I set Settings:set("AutoWaitTimeout", 0.0), all the comparison took 0.01-0.02s.
Anyway, thanks a lot!
|
|