How to run OpenCV in Kivy Launcher?
Question:
I am building a Kivy app that requires the OpenCV module, but the Kivy Launcher keeps crashing when I run it.
I have downloaded OpenCV from PyPi (https://pypi.python.org/pypi/opencv-python#downloads) and placed it into my kivy project directory. My project directory currently contains the main.py file, the android.txt file, and the opencv download. In the main.py file I write “import cv2” at the top of the code. However, my app keeps crashing in the Kivy launcher.
What is the correct way to install python extensions for use in Kivy Launcher?
BTW- I am brand new to Kivy and Android app development, so any help is much appreciated
Answers:
I have downloaded OpenCV from PyPi
(https://pypi.python.org/pypi/opencv-python#downloads) and placed it
into my kivy project directory
This is not how things work. OpenCV should be compiled specifically for Android. I guess you use buildozer to build apk? In this case you should modify requirements
line inside buildozer.spec
file to add opencv
, for example:
requirements = kivy, opencv
Compiling python modules for Android provided by python-for-android project.
I am building a Kivy app that requires the OpenCV module, but the Kivy Launcher keeps crashing when I run it.
I have downloaded OpenCV from PyPi (https://pypi.python.org/pypi/opencv-python#downloads) and placed it into my kivy project directory. My project directory currently contains the main.py file, the android.txt file, and the opencv download. In the main.py file I write “import cv2” at the top of the code. However, my app keeps crashing in the Kivy launcher.
What is the correct way to install python extensions for use in Kivy Launcher?
BTW- I am brand new to Kivy and Android app development, so any help is much appreciated
I have downloaded OpenCV from PyPi
(https://pypi.python.org/pypi/opencv-python#downloads) and placed it
into my kivy project directory
This is not how things work. OpenCV should be compiled specifically for Android. I guess you use buildozer to build apk? In this case you should modify requirements
line inside buildozer.spec
file to add opencv
, for example:
requirements = kivy, opencv
Compiling python modules for Android provided by python-for-android project.