0
votes

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 ?

1

1 Answers

0
votes

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.