0

I am trying to import the opencv library into sikuliX which uses Jython interpreter.

I have added the path where cv2 module is installed to sys.path.append to tell Jython to look for cv2 folder in the path supplied.

import sys 
sys.path.append("/Users/ongyichong/anaconda3/lib/python3.7/site- 
packages/")
import cv2

I installed opencv using pip install opencv-contrib-lib and the path where cv2 is installed in the path "/Users/ongyichong/anaconda3/lib/python3.7/site-packages/".

enter image description here

This is what my cv2 folder looks like.

The error arises because my init.py file contains a ".cv2 import *". I am not sure how i should go about solving this problem. Is there another way i can import python modules into SikuliX's Jython interpreter ?

calveeen
  • 621
  • 2
  • 10
  • 28

1 Answers1

0

Python (C-Python) modules can only be used in SikuliX (Jython interpreter) when they are completely written in Python language and do not contain any C-based stuff or even reference native libraries.

BTW: especially since SikuliX 1.1.4 the complete OpenCV 3 API is available at the Java level, which is also accessible from the Jython scripting level.

RaiMan
  • 1,088
  • 8
  • 13
  • Hi, I do have a similar question. I would like to import playsound lib into SikuliX, and run with IDE, but it seems IDE cannot find and load the module which is installed locally with pip. Do you have a guide for importing 3rd party libs? – glenlivet1986 Oct 11 '19 at 05:41