[1.1.4] Exception when using grayscale images - fixed 2018-10-06 build #104

Bug #1795987 reported by Dillon
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
SikuliX
Fix Released
Critical
RaiMan

Bug Description

I'm getting the following exception when checking if an image exists. From what I can tell, the image doesn't have any visible transparency but the image is a .png. If I switch the image to a .jpg, it won't throw the exception. This is happening way too often for me to continue using 1.1.4 since I'm using a library of 1,000+ images.

[error] script [ C:\Scripts\Automation\test.sikuli ] stopped with error at line --unknown--
[error] Error caused by: Traceback (most recent call last):
  File "C:\Scripts\Automation\test.sikuli\test.py", line 13, in <module>
    gTest.run(main)
  File "C:\Scripts\Automation\Test_Framework.sikuli\Test_Framework.py", line 982, in run
    if func(vnc, *args) == True:
  File "C:\Scripts\Automation\Test_Framework.sikuli\Test_Framework.py", line 982, in run
    if func(vnc, *args) == True:
  File "C:\Scripts\Automation\test.sikuli\test.py", line 10, in main
    findImage(reg, img.optionYes[gTest.locale.act][gTest.Type], 3, 0, False)
  File "C:\Scripts\Automation\Test_Framework.sikuli\Test_Framework.py", line 408, in findImage
    match = reg.exists(n, 0)
]
        at org.opencv.imgproc.Imgproc.matchTemplate_1(Native Method)
        at org.opencv.imgproc.Imgproc.matchTemplate(Imgproc.java:2612)
        at org.sikuli.script.Finder2.doFindMatch(Finder2.java:353)
        at org.sikuli.script.Finder2.doFind(Finder2.java:327)
        at org.sikuli.script.Finder2.find(Finder2.java:79)
        at org.sikuli.script.Finder.find(Finder.java:244)
        at org.sikuli.script.Region.runFinder(Region.java:2863)
        at org.sikuli.script.Region.doFind(Region.java:2819)
        at org.sikuli.script.Region.access$300(Region.java:21)
        at org.sikuli.script.Region$RepeatableFind.run(Region.java:3077)
        at org.sikuli.script.Region$Repeatable.repeat(Region.java:3030)
        at org.sikuli.script.Region.exists(Region.java:2380)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
org.opencv.core.CvException: CvException [org.opencv.core.CvException: cv::Exception: OpenCV(3.4.2) C:\build\3_4_winpack-bindings-win64-vc14-static\opencv\modules\imgproc\src\templmatch.cpp:1102: error: (-215:Assertion failed) (depth == 0 || depth == 5) && type == _templ.type() && _img.dims() <= 2 in function 'cv::matchTemplate'

Revision history for this message
RaiMan (raimund-hocke) wrote : Re: [1.1.4] Exception when finding .png image (with transparency?)

Could you send me one of the offending .png files?

Might be an image type, that is not correctly converted to OpenCV Mat.

summary: - Exception when finding image with transparency?
+ [1.1.4] Exception when finding .png image (with transparency?)
Revision history for this message
RaiMan (raimund-hocke) wrote :

my mail: sikulix---at---outlook---dot---com

Changed in sikuli:
status: New → In Progress
importance: Undecided → High
assignee: nobody → RaiMan (raimund-hocke)
milestone: none → 1.1.4
Revision history for this message
Dillon (dillonm197) wrote :

Yes, of course. Thank you for your quick response!

Revision history for this message
RaiMan (raimund-hocke) wrote :

The png-image you sent me is a gray image (only 1 color layer) opposed to rgb-png-images which have 3 color layers.

I have to revise the search process, to make this working also.

Revision history for this message
RaiMan (raimund-hocke) wrote :

... and if I convert the .png image to .jpg it also does not work.

So how did you "switch to jpg"?
Could you attach such an image here also?

Revision history for this message
Dillon (dillonm197) wrote :

I should have been more clear about the image conversion. I converted it via image software ImageMagick. Same can be done simply using Microsoft paint. Changing the extension type directly doesn't fix the issue. I attached the jpg variant of the above image.

Revision history for this message
RaiMan (raimund-hocke) wrote :

Ok, thanks
I guess I will have fixed it tomorrow

Revision history for this message
RaiMan (raimund-hocke) wrote : Re: [1.1.4] Exception when using grayscale images - fixed 2018-10-05

fixed - a test would be appreciated.

Changed in sikuli:
status: In Progress → Fix Committed
importance: High → Critical
summary: - [1.1.4] Exception when finding .png image (with transparency?)
+ [1.1.4] Exception when using grayscale images - fixed 2018-10-05
RaiMan (raimund-hocke)
summary: - [1.1.4] Exception when using grayscale images - fixed 2018-10-05
+ [1.1.4] Exception when using grayscale images - fixed 2018-10-05 build
+ #101
Revision history for this message
Dillon (dillonm197) wrote : Re: [1.1.4] Exception when using grayscale images - fixed 2018-10-05 build #101

I haven't ran into any errors so far in my tests today. Looks like it's all fixed.

Revision history for this message
Dillon (dillonm197) wrote :

Spoke too soon. Now getting the following error with the attached image.

[error] Finder2: makeMat: BufferedImage: type not supported: 12 --- please report this problem
[error] RunTimeIDE: *** terminating: 1535602883834.png: (37x37): conversion error --- makes no sense to continue

Revision history for this message
RaiMan (raimund-hocke) wrote :

Thanks for reporting.

Should work now. (build 104 from today)

summary: - [1.1.4] Exception when using grayscale images - fixed 2018-10-05 build
- #101
+ [1.1.4] Exception when using grayscale images - fixed 2018-10-06 build
+ #104
RaiMan (raimund-hocke)
Changed in sikuli:
status: Fix Committed → Fix Released
milestone: 1.1.4 → 2.0.0
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.