OpenCV in a Python script

I'd like to use OpenCV in a KLayout Python script.

I'm on Windows and I'm using KLayout 0.26.8.

I put the OpenCV package (with some others) in the %KLAYOUT%\python directory.

The OpenCV package has been retrieved with a "pip install opencv-contrib-python" command using a Python 3.6 instance.

When I try an import OpenCV from the console line of the macro development window (with a "import cv2" command), I get this error: "No module named 'cv2.cv2' (Class ModuleNotFoundError)".

I tried many approaches for several long hours, re-reading especially the KLayout documentation regarding environment variables, search paths, packages ... without success.

Any idea?

Many thanks for your help.

Sign In or Register to comment.