← Back to team overview

sikuli-driver team mailing list archive

[Question #256421]: Find/Exists fails with precision, while succeeds without

 

New question #256421 on Sikuli:
https://answers.launchpad.net/sikuli/+question/256421

Hi

Since the application I try to automate renders itself in two forms at my home computer versus at my working computer, I had to find something like:

self.fimgContactList = ("first.png", "alternativepict.png")

Then I use index in the class for the currently running image

  def get_CurImg(self, fimgX):        #Ze sady obrázků vybere tu pro náš monitor
    return fimgX[self.fimgIndex]

In order to "Calibrate" at tthe beginning, I try to find at which computer we are, i.e. which set of the images we will use, i.e. what the index will be set to (e.g. 0 or 1)

def __Kalibruj(self, fimgKalibracni):
    #for s in range(100, 60, -10):    #Pattern().similar(s) 
    for i in range(len(fimgKalibracni)):
      if exists((fimgKalibracni[i]) ,0):
        self.fimgIndex = i
        return
    return

The main problém I have and I spent literaly hours with it, that the above version works.

however if I want to be more "robust" in calibration and uncomment
    for s in range(100, 60, -10): 

and make the find/exists for patern   .similar() instead of  raw image filename
           if exists((Pattern(fimgKalibracni[i])).similar(s/100) ,0):

then the tests fail, fail, fail, even if I manually specify 0.7 value

It seems that converting   any .jpg  to Pattern(.jpg).similar(0.7)   creates some bug.

I am almost crazy about that. have no explanation. Because I am aware of both versions of calibrating pictures may match at 0.7 oprecision and algorithm rather wants to iterate from 0.95 stepdown -0.10  to be able to dfind a precision where one image matches and the second one does not.

I have strong feeling that the environment behaves differently when specified .similar() via IDE versus via text.
Also the IDE behaves oddly since when I specify it by text, it stays as text, which I welcome, until CTRL+C CTRL+V which makes it integrated into the Picture icon loosing ability to edit in text. It is annoying but cosmetical.

However the problem find/exists does not physically find the match even at .similar(0.5) while finding the match at default 0.7 is more than weird.

Please help me, do I miss something ?

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