godot-python icon indicating copy to clipboard operation
godot-python copied to clipboard

Using CV2 with Python in Godot

Open KimV2 opened this issue 3 years ago • 3 comments

Hello,

I've been able to find and get Python with CV2 to recognize gestures. I would like to use the code within Godot and I've used your Python video to get Python to work within Godot. I've gotten a number of functions and classes to be imported into Godot from other files. What I have NOT been able to do is import libraries such as numpy and cv2 (opencv-python). Is this possible? If so, please provide the syntax. If the syntax is within a small demo that would be of great help.

Thanks

KimV2 avatar Aug 03 '22 17:08 KimV2

Hello,

I contributed a writeup of how to do this, it's part of the FAQ: https://github.com/touilleMan/godot-python#faq It's the second question there.

Hopefully I've explained it well! Let me know.

dranorter avatar Aug 04 '22 03:08 dranorter

Im on windows10 and none of the above ways worked for me. Ive tried to import the opencv packages using the command line method but the pip is always trying to reference the system wide python install and ignores the python.exe in the godot project. Ive tried also running the script that had the packages in list and called pip to install them all but the same happens. requirements are satisfied because the packages are installed system wide and not in the folder itself.

TheBricktop avatar Sep 01 '22 19:09 TheBricktop

Try to git bash into the folder instead and reference python not from 'python -m ...' but from './python -m ...'. That will use the python.exe in the resource of Godot rather than on the system.

mojoyup avatar May 24 '23 21:05 mojoyup