chaquo / chaquopy

Chaquopy: the Python SDK for Android
https://chaquo.com/chaquopy/
MIT License
748 stars 127 forks source link

opencv package with 4.9.0.80 version problem #1148

Closed YenYunn closed 1 month ago

YenYunn commented 1 month ago

Hello, I'm attempting to use Chaquopy on Android with the following setup in my build.gradle: pip { install "numpy" install "opencv-python==4.9.0.80" }

However, when I specify the version of OpenCV, I encounter the following error:

com.chaquo.python.PyException: ImportError: OpenCV loader: missing configuration file: ['config.py']. Check OpenCV installation.

If I don't specify a version and simply use install "opencv-python", the program crashes when executing cv2.dnn.NMSBoxes with this error:

OpenCV(4.5.1) Error: Assertion failed (channels() == CV_MAT_CN(dtype)) in copyTo, file /home/smith/git/chaquo/python/server/pypi/packages/opencv-python/build/4.5.1.48/cp38-cp38-android_21_x86_64/src/opencv/modules/core/src/copy.cpp, line 254 2024-05-02 16:52:14.068 9913-9913 libc++abi com.example.myapp E terminating with uncaught exception of type cv::Exception: OpenCV(4.5.1) /home/smith/git/chaquo/python/server/pypi/packages/opencv-python/build/4.5.1.48/cp38-cp38-android_21_x86_64/src/opencv/modules/core/src/copy.cpp:254: error: (-215:Assertion failed) channels() == CV_MAT_CN(dtype) in function 'copyTo'

Could you help me resolve these issues?

mhsmith commented 1 month ago

OpenCV 4.5.1.48 is currently the newest version in the repository. So when you asked for version 4.9.0.80, your app shouldn't even have been able to build. To be notified when we add a newer version, please subscribe to #620.

However, searching for this assertion message on Google indicates that it may be caused by a bug in your own code, in which case upgrading the version wouldn't help. I don't know enough about OpenCV to be more specific, so I suggest you try searching for the message yourself.