← Back to team overview

sikuli-driver team mailing list archive

Re: [Bug 1857799] Image Size

 

Image is 694 Bytes
So instead of Mac Mail I have used Gmail in Browser and attached ruler
image below

Image is captured within Sikuli using a function that I wrote years ago :-
def
Screen_Shot_Set_and_Copy(screenshotsDir,Screen_Shot_File,Need_a_Copy,x,y,w,h):
    print "Screen_Shot_Set_and_Copy",x,y,w,h
    SETRECT(x,y,w,h)
    Screen_Shot_and_Copy(screenshotsDir,Screen_Shot_File,Need_a_Copy)

def Screen_Shot_and_Copy(screenshotsDir,Screen_Shot_File,Need_a_Copy):
    import shutil
    import os
    some_region = SCREEN # for whole screen
    someRegion = App.focusedWindow() # for the frontmost windo
    img = capture(some_region)
    my_file = Screen_Shot_File
    print "Sub_Take_Screen_Shot_and_Copy() "+screenshotsDir + my_file +
".png"
    localtime = time.localtime(time.time())
    timestring = time.strftime ('%m%d%H%M%S')
    my_file = my_file + ".png"
    shutil.move(img, os.path.join(screenshotsDir, my_file))
    if Need_a_Copy == 1:
        my_copy = my_file + " copy " + timestring + ".png"
        shutil.copy(os.path.join(screenshotsDir, my_file),
os.path.join(screenshotsDir, my_copy))
        print "Sub_Take_Screen_Shot_and_Copy() ",screenshotsDir, my_copy


There is another bug but my guess it is not repeatable with simple script.
It involves Combo boxes
Its not real code so i am not concerned
I am going through my Images and popping up a combo box asking if an image
is on the screen if exists fails ( indicating I need to replace it )
Simple answer Yes / No if answer is yes print image name so I can get a
list of what to deal with
So it loops through
        Opens Combo on screen
        I click the Yes or No
        then it should close the combo
It doesn't always close the combo - leaves an inactive combo on screen
cannot do anything with them they appear dead - so I have been dragging the
dead combo of to the side to carry on

No chance of getting a small bit of code to do this.


On Sun, Dec 29, 2019 at 3:35 PM RaiMan <sikulix@xxxxxxxxxxx> wrote:

> I cannot find the mentioned image Ruler.png as attachement in this mail.
>
> apparently, the image is larger than the restricted area.
> Did you capture it with the Mac tools?
>
> If yes: you have to use SikuliX’s resize feature for Retina images (I am
> sure I mentioned that already before)
>
> Raimund aka RaiMan
>
> BTW: you should really start to use the ImagePath feature instead of using
> absolute image filenames.
>
> > On 29. Dec 2019, at 15:03, Jeff_Vallis <vallis.pj@xxxxxxxxx> wrote:
> >
> > image
> >
> >
> >
> > in the IDE
> > v_Image =
> "/Users/Jeff/Documents/Sikuli_Live/SikuliScripts/Vikings/Code/Data/Images_Mac/Ruler.png"
> # Location of the above ruler
> >
> > setRect(733,836,39,47)
> > highlight(1)
> > if exists(v_Image):
> >    print "^ " * 40
> >    print "Found"
> > print "Done"
> > exit(0)
> >
> > result
> >
> >
> > [log] highlight R[733,836 39x47]@S(0) for 1.0 secs
> > [error] script [ sikulitemp-6882804543996897290 ] stopped with error in
> line 4
> > [error] Error caused by: Traceback (most recent call last):
> >  File
> "/var/folders/8k/9ksc02xj1kq3jm3xs_wx2tz80000gn/T/Sikulix_408720900/SikulixIDETempTab1577627846866/sikulitemp-6882804543996897290.py",
> line 4, in <module>
> >    if exists(v_Image):
> > … more]
>
> > org.opencv.core.CvException: CvException [org.opencv.core.CvException:
> cv::Exception: OpenCV(3.4.2)
> /Users/raimundhocke/SikuliX/OpenCV/opencv-3.4.2/modules/imgproc/src/templmatch.cpp:1107:
> error: (-215:Assertion failed) _img.size().height <= _templ.size().height
> && _img.size().width <= _templ.size().width in function 'matchTemplate'
> > ]
> >
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1857799
>
> Title:
>   Image Size
>
> Status in Sikuli:
>   New
>
> Bug description:
>   2.0.1-2019-11-22_16:54/Mac10.15.2/Java13(64)13.0.1+9
>
>   setRect Smaller than size of image in exists
>   e.g.
>     highlight R[733,836 39x47]@S(0) for 1.0 secs
>     image size is over  50x50 - bigger than the 39x47 above
>
>         at java.base/java.lang.reflect.Method.invoke(Method.java:567)
>   org.opencv.core.CvException: CvException [org.opencv.core.CvException:
> cv::Exception: OpenCV(3.4.2)
> /Users/raimundhocke/SikuliX/OpenCV/opencv-3.4.2/modules/imgproc/src/templmatch.cpp:1107:
> error: (-215:Assertion failed) _img.size().height <= _templ.size().height
> && _img.size().width <= _templ.size().width in function 'matchTemplate'
>   ]
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/sikuli/+bug/1857799/+subscriptions
>


** Attachment added: "Ruler.png"
   https://bugs.launchpad.net/bugs/1857799/+attachment/5316512/+files/Ruler.png

-- 
You received this bug notification because you are a member of Sikuli
Drivers, which is subscribed to Sikuli.
https://bugs.launchpad.net/bugs/1857799

Title:
  Image Size

Status in Sikuli:
  New

Bug description:
  2.0.1-2019-11-22_16:54/Mac10.15.2/Java13(64)13.0.1+9

  setRect Smaller than size of image in exists
  e.g.
    highlight R[733,836 39x47]@S(0) for 1.0 secs
    image size is over  50x50 - bigger than the 39x47 above 

  	at java.base/java.lang.reflect.Method.invoke(Method.java:567)
  org.opencv.core.CvException: CvException [org.opencv.core.CvException: cv::Exception: OpenCV(3.4.2) /Users/raimundhocke/SikuliX/OpenCV/opencv-3.4.2/modules/imgproc/src/templmatch.cpp:1107: error: (-215:Assertion failed) _img.size().height <= _templ.size().height && _img.size().width <= _templ.size().width in function 'matchTemplate'
  ]

To manage notifications about this bug go to:
https://bugs.launchpad.net/sikuli/+bug/1857799/+subscriptions


References