Hello,
I have an application developed in Python-Kivy for Android, using buildozer. This application uses Opencv to activate the smartphone's camera, and capture frames from the camera to analyze. The application is generated normally, but when it starts on the smartphone, it crashes. This occurs in the following opencv statement:
gray = cv2.cvtColor (frame, cv2.COLOR_BGR2GRAY)
where the following error is issued in logcat:
cv2.error: OpenCV (4.0.1) ... error: (-215: Assertion failed)! _src.empty () in function 'cvtColor'
I think the problem is in the frame captured by the camera, and the lines of code that start the camera and capture the frame are as follows:
video_capture = cv2.VideoCapture (0)
while (True):
ret, frame = video_capture.read ()
gray = cv2.cvtColor (frame, cv2.COLOR_BGR2GRAY) <== Error issued here
The code was generated by buildozer using Python 3.7. Opencv 4.0.1 for arm64-V8a, Android 9.
Does anyone have any solution for this error? Is There some special initialization in the statement video_capture = cv2.VideoCapture (0) so that it can starts the camera correctly when in Android environment?
Thank you very much