Cristian Desivo
Cristian Desivo

Reputation: 305

How to use kivy camera with opencv 4.0

I am trying to port my opencv python code to android by using kivy. The code is made with opencv 4.0, however I can't find a way to make the camera from opencv to work with kivy.

from kivy.app import App
from kivy.uix.camera import Camera
import cv2

class MainApp(App):
    def build(self):
        cam = Camera(play=True, resolution=(640, 480))
        return cam

if __name__== "__main__":
    MainApp().run()

This is the code I try to run.

The answers I found ask to use an older version of opencv, however my code won't work in an older version, is there a way to make it work in 4.0?

Upvotes: 2

Views: 1245

Answers (1)

RJ Adriaansen
RJ Adriaansen

Reputation: 9629

Compatibility with OpenCV 4 has been fixed in the github master branch, but is not yet available via pypi. Try reinstalling kivy from github:

pip install https://github.com/kivy/kivy/archive/master.zip

Upvotes: 2

Related Questions