Custom camera provider

10 views
Skip to first unread message

Timm

unread,
Jan 17, 2018, 1:35:38 PM1/17/18
to Kivy users support
I tried to define a custom camera provider by inheriting a class from kivy.core.camera.CameraBase. I tried different ways to register the new provider. But I had no success. Is there any way to extend the available camera providers from my application?

Timm

unread,
Jan 17, 2018, 2:44:41 PM1/17/18
to Kivy users support
Am Mittwoch, 17. Januar 2018 19:35:38 UTC+1 schrieb Timm:
I tried to define a custom camera provider by inheriting a class from kivy.core.camera.CameraBase. I tried different ways to register the new provider. But I had no success. Is there any way to extend the available camera providers from my application?

I found a possible solution: First I make an empty list of possible camera providers. After that I overwrite the kivy,core.camera.Camera with my own instance.

import os
os.environ['KIVY_CAMERA'] = ""
from kivy.lang import Builder
from kivy.app import App
from kivy.core.camera import Camera as CameraContainer
from kivy.core.camera import CameraBase
from kivy.uix.camera import Camera

class CameraTest(CameraBase):
'''
Implementation of CameraBase using OpenCV
'''
_update_ev = None

def __init__(self, **kwargs):
self._device = None
super(CameraTest, self).__init__(**kwargs)

def init_camera(self):
pass

def _update(self, dt):
pass

CameraContainer = CameraTest()


if __name__ == '__main__':
class Example(App):

def build(self):



cam = Camera()

return cam

Example().run()

Reply all
Reply to author
Forward
0 new messages