Can't seem to find anything on Linux (CentOS 7)

Asked by Paul Chambre on 2018-10-26

I have a POC test app that I've been running under IntelliJ on MacOS. I'm using Java 8. It connects to my application, exercises some features, and verifies the results by matching partial screen shots.

Now I'm trying to set this up to run against a CentOS 7 VM running under VirtualBox on the same Macbook. I have IntelliJ and my application installed on the VM and am running the whole thing with a single maximized screen.

I have built the OpenCV Java 3.43 so and added that to my Java library path.

The very first check is for the existence of a Help button. This check doesn't find the Help button. I tried taking a fresh screen shot on the Linux machine and using that png instead, but that didn't help. I then tried adding a click() for the Help button with similarity(.2), but that still doesn't find it.

Is there something else I need to do to configure openCV, or to make it work correctly on a VirtualBox VM?

Thanks,
Paul

Question information

Language:
English Edit question
Status:
Answered
For:
Sikuli Edit question
Assignee:
No assignee Edit question
Last query:
2018-10-29
Last reply:
2018-10-30
Paul Chambre (pchambredh) said : #1

In case this helps, here is what I got from cmake:

-- OpenCV modules:
-- To be built: calib3d core dnn features2d flann highgui imgcodecs imgproc java java_bindings_generator ml objdetect photo python_bindings_generator shape stitching superres ts video videoio videostab
-- Disabled: js world
-- Disabled by dependency: -
-- Unavailable: cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev python2 python3 viz
-- Applications: tests perf_tests apps
-- Documentation: NO
-- Non-free algorithms: NO
--
-- GUI:
-- GTK+: NO
-- VTK support: NO
--
-- Media I/O:
-- ZLib: /lib64/libz.so (ver 1.2.7)
-- JPEG: libjpeg-turbo (ver 1.5.3-62)
-- WEBP: build (ver encoder: 0x020e)
-- PNG: build (ver 1.6.34)
-- TIFF: build (ver 42 - 4.0.9)
-- JPEG 2000: build (ver 1.900.1)
-- OpenEXR: build (ver 1.7.1)
-- HDR: YES
-- SUNRASTER: YES
-- PXM: YES
--
-- Video I/O:
-- DC1394: NO
-- FFMPEG: NO
-- avcodec: NO
-- avformat: NO
-- avutil: NO
-- swscale: NO
-- avresample: NO
-- GStreamer: NO
-- libv4l/libv4l2: NO
-- v4l/v4l2: linux/videodev2.h
--
-- Parallel framework: pthreads
--
-- Trace: YES (with Intel ITT)
--
-- Other third-party libraries:
-- Intel IPP: 2017.0.3 [2017.0.3]
-- at: /home/iris/Downloads/opencv-3.4.3/build/3rdparty/ippicv/ippicv_lnx
-- Intel IPP IW: sources (2017.0.3)
-- at: /home/iris/Downloads/opencv-3.4.3/build/3rdparty/ippicv/ippiw_lnx
-- Lapack: NO
-- Eigen: NO
-- Custom HAL: NO
-- Protobuf: build (3.5.1)
--
-- OpenCL: YES (no extra features)
-- Include path: /home/iris/Downloads/opencv-3.4.3/3rdparty/include/opencl/1.2
-- Link libraries: Dynamic load
--
-- Python (for build): /usr/bin/python2.7
--
-- Java:
-- ant: /bin/ant (ver 1.9.2)
-- JNI: /usr/lib/jvm/java/include /usr/lib/jvm/java/include/linux /usr/lib/jvm/java/include
-- Java wrappers: YES
-- Java tests: YES
--
-- Matlab: NO
--
-- Install to: /usr/local
-- -----------------------------------------------------------------

Paul Chambre (pchambredh) said : #2

I also tried the test app for openCV Java from here: https://opencv-java-tutorials.readthedocs.io/en/latest/02-first-java-application-with-opencv.html

This test app worked as expected. I had to add the openCV jar to my project, and add a link to the specific version .so.

RaiMan (raimund-hocke) said : #3

--- comments #1 and #2
your openCV apparently works

Sorry, I have overseen that:
--- I have built the OpenCV Java 3.43 so and added that to my Java library path.

There should nothing else than sikulixapi.jar be on the java classpath, since the Java stuff for OpenCV and Tess4J/Tesseract is bundeled with SikuliX.
Only the libs must be found on the library path:
hence in your case in the library path a libopencv_java.so must link to your libopencv_java343.so (wherever it may be)

Paul Chambre (pchambredh) said : #4

I do have a link to the opencv343 so. Without the link, the app fails immediately on startup complaining about no usable opencv in the library path.

I have other jars for my application in the classpath, but nothing from opencv. Just the SikuliX API 1.1.4 jar. Same as on my host OSX system.

I also tried updating CentOS itself, and the VirtualBox extensions. This temporarily broke my app, when it changed Java to OpenJDK 1.8.0.191. Now that I've updated the links and all the IntelliJ settings, it runs again, and is still in the same state of not finding anything.

Are there debug settings I can enable to get a better idea of what's happening while it's trying to find a pattern? I did step into it a bit, and saw it getting the screen, with the correct resolution, and validating the pattern, but I'm not sure where the real magic is happening here.

Thanks

RaiMan (raimund-hocke) said : #5

-Dsikuli.Debug=3

as Java command setting

Paul Chambre (pchambredh) said : #6

Thanks.

Here's what I get back from the two systems (working OSX, and find failed CentOS7). The CentOS7 screen shot was taken locally on that system to ensure it's a match as rendered there. Opening up the PNG file matches the application screen, and I have even tried runs where I had both the app and the PNG open to see if the .exists() would find the PNG version. It did not.

(Part of paths obfuscated out with XXXX. The paths are valid in the environments and do resolve to the correct pngs. )

//OSX

[4343 debug] Region: exists: waiting 3.0 secs for /Users/ XXXX /GUITestImages/HelpButton.png to appear in S(0)[0,0 1920x1080]
[4406 debug] Finder2: makeMat: INT_RGB (1920x1080)
[4451 debug] Finder2: makeMat: TYPE_4BYTE_ABGR (90x32)
[4455 debug] Finder2: doFind: start (stdDev: 155.4827 mean: 604.577083)
[4695 debug] Finder2: doFind: in original: %99.1999 (?70) 240 msec
[4696 debug] Finder2: doFind: end 241 msec
[4700 debug] Region: exists: /Users/ XXXX /GUITestImages/HelpButton.png has appeared (M[1499,107 90x32]@S(S(0)[0,0 1920x1080]) S:0.99 C:1544,123 [354 msec])

//CentOS7

[4264 debug] Region: exists: waiting 3.0 secs for /home/ XXXX /GUITestImages/HelpButton.png to appear in S(0)[0,0 1920x1080]
[4424 debug] Finder2: makeMat: INT_RGB (1920x1080)
[4466 debug] Finder2: makeMat: TYPE_4BYTE_ABGR (90x31)
[4468 debug] Finder2: doFind: start (stdDev: 169.0728 mean: 602.560215)
[5293 debug] Finder2: doFind: in original: %0.0000 (?70) 825 msec
[5293 debug] Finder2: doFind: end 825 msec
[5415 debug] Finder2: makeMat: INT_RGB (1920x1080)
[5440 debug] Finder2: doFind: start (stdDev: 169.0728 mean: 602.560215)
[5666 debug] Finder2: doFind: in original: %0.0000 (?70) 226 msec
[5666 debug] Finder2: doFind: end 226 msec
[5782 debug] Finder2: makeMat: INT_RGB (1920x1080)
[5805 debug] Finder2: doFind: start (stdDev: 169.0728 mean: 602.560215)
[6018 debug] Finder2: doFind: in original: %0.0000 (?70) 212 msec
[6018 debug] Finder2: doFind: end 212 msec
[6129 debug] Finder2: makeMat: INT_RGB (1920x1080)
[6150 debug] Finder2: doFind: start (stdDev: 169.0728 mean: 602.560215)
[6672 debug] Finder2: doFind: in original: %0.0000 (?70) 522 msec
[6673 debug] Finder2: doFind: end 523 msec
[6787 debug] Finder2: makeMat: INT_RGB (1920x1080)
[6809 debug] Finder2: doFind: start (stdDev: 169.0728 mean: 602.560215)
[7095 debug] Finder2: doFind: in original: %0.0000 (?70) 285 msec
[7095 debug] Finder2: doFind: end 285 msec
[7223 debug] Finder2: makeMat: INT_RGB (1920x1080)
[7234 debug] Finder2: doFind: start (stdDev: 169.0728 mean: 602.560215)
[7481 debug] Finder2: doFind: in original: %0.0000 (?70) 247 msec
[7481 debug] Finder2: doFind: end 247 msec
[7491 debug] Region: exists: /home/ XXXX /GUITestImages/HelpButton.png did not appear [3220 msec]

RaiMan (raimund-hocke) said : #7

I am sorry, but I cannot help you.

In my macOS 10.13 setup (non-Retina iMac) with VirtualBox running Ubuntu 18 with Java 10 and 11 I do not have any problems.

The tests generated outside on Mac are running inside the Box and working inside the Box with the IDE works also.

Paul Chambre (pchambredh) said : #8

Well.. that helps some, in that it's either a Java 8 issue (unlikely) or a CentOS issue... more likely. Or maybe something weird with my VirtualBox setup.

For now I'm switching over to trying this on a Windows VM instead. I did try yesterday to get Ubuntu set up in gcloud, but that turned into a real pain to get the vnc desktop working.

RaiMan (raimund-hocke) said : #9

I wish you all the best.

due to vacation I will only by available again after Nov 20th.

Can you help with this problem?

Provide an answer of your own, or ask Paul Chambre for more information if necessary.

To post a message you must log in.