← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #666773]: How to get on the road as a newcomer to Java programming

 

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

RaiMan posted a new comment:
--- Why could it return null? It will always find a number there.
yes ... findAnyList() will always return a List object,
... but in your case all match entries in the list for the numbers not found will be null, only for the one found there will be a valid match entry.

--- difference between findAny and findAnyList
findAny accepts a parameter series of images, whereas findAnyList accepts only one parameter, which is a List of images (where images are either image filename strings or Pattern objects) (the javadocs mentioned in comment #1 might have told you ;-)

--- would it be possible to use .exists() 
yes, of course: (Python script ;-)

numbers = (n0, n1, n2, ..., n9) # nX is a string having the number image filename
reg = <some region> # the search region
found = -1
for number in numbers:
    if not reg.exists(number, 0): continue
    else: found = found + 1 
if found > -1:
    print "found number:", found
else:
    print "no success"

this is a sequential search, which will in the average need 5 searches
to identify the number (max 10 searches).

findAny() internally delegates each search into a separate thread, that
run in parallel. My checks say, that beginning with 4 images to be
searched in parallel, findAny() is faster than sequential exists()

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.