0

I have 2 xiaomi smartphones: Xiaomi Redmi 3 (lineageOS, Android 11) and Xiaomi Mi9 lite (MIUI, Android 10). (The goal is to use Redmi 3 on my pet project). I tried to run the same piece of code on both devices, but its work only with Mi9 lite.

import cv2
cam = cv2.VideoCapture(0)
s, img = cam.read()
cv2.imwrite('qqq.jpg', img)

On redmi 3 I've got the error: enter image description here

looks like some premission issue, cause opencv cant get the image from camera. And idk how to solve that, i already got Pydroid permission plugin but that doesnt work.

Unicorn
  • 23
  • 5
  • [tour], [ask], [mre]. remove the screenshot, post the text it contains. -- you don't have image data, so you can't write what you don't have. -- why did you not error-check VideoCapture? `assert cap.isOpened()` and `if not s: break` – Christoph Rackwitz Nov 23 '22 at 08:58
  • I know that, the question is how can i get image from the smartphone camera in that case. I assumed that this is due to the limitation of the application, there are no access rights to the camera. But that was a camera problem, pydroid opencv doesnt support this version of camera API. – Unicorn Nov 23 '22 at 16:30

1 Answers1

0

Looks like pydroid can work properly only with Camera 2 API. enter image description here

But redmi 3 camera has not that technology:

enter image description here

Unicorn
  • 23
  • 5