Kivy camera on windows shows blank screen

364 views
Skip to first unread message

Fer Romano

unread,
Sep 26, 2022, 7:05:17 PM9/26/22
to Kivy users support
When I run the code below the camera turns on but the image does not appear.
What can it be?

import datetime
from kivy.lang import Builder
from kivy.app import App

kv = """
#:import XCamera kivy_garden.xcamera.XCamera

FloatLayout:
    orientation: 'vertical'
    XCamera:
        id: xcamera
        on_picture_taken: app.picture_taken(*args)
    BoxLayout:
        orientation: 'horizontal'
        size_hint: 1, None
        height: sp(50)
        Button:
            text: 'Set landscape'
            on_release: xcamera.force_landscape()
        Button:
            text: 'Restore orientation'
            on_release: xcamera.restore_orientation()
"""


class CameraApp(App):
    def build(self):
        return Builder.load_string(kv)

    def picture_taken(self, obj, filename):
        print('Picture taken and saved to {}'.format(filename))

if __name__ == '__main__':
    CameraApp().run()

Robert

unread,
Sep 26, 2022, 7:11:56 PM9/26/22
to Kivy users support
Is there a camera connected?
Is there a camera provider installed?

Fer Romano

unread,
Sep 26, 2022, 8:31:15 PM9/26/22
to Kivy users support
Yes, I installed kivy garden and camera.
Turns on the camera light but does not show the image

Fer Romano

unread,
Sep 26, 2022, 8:53:57 PM9/26/22
to Kivy users support
When running xcamera.exe gives the error

File "C:\PycharmProjects\pythonProject\Aula_01\xcamera.exe\__main__.py", line
  4, in <module>
  ModuleNotFoundError: No module named 'kivy_garden.xcamera.main'

But I don't know how to install the module 'kivy_garden.xcamera.main'

Em segunda-feira, 26 de setembro de 2022 às 20:11:56 UTC-3, Robert escreveu:

Robert

unread,
Sep 26, 2022, 9:24:10 PM9/26/22
to Kivy users support
> Is there a camera provider installed?  
For example opencv-python
Since you didn't answer this - perhaps it is not installed?

Kivy Camera documentation says almost nothing about the camera provider.
Here is some documentation from a different camera https://github.com/Android-for-Python/camera4kivy#camera-provider

> When running xcamera.exe gives the error

This question is presumably about packaging with pyinstaller.

Elliot, you around?

Fer Romano

unread,
Sep 27, 2022, 8:37:27 AM9/27/22
to Kivy users support
The provider installed is opencv-python. Now when running xcamera.exe there is no error, but the image does not appear. Only the camera light on

Robert

unread,
Sep 27, 2022, 1:12:43 PM9/27/22
to Kivy users support
Is play True?

Fer Romano

unread,
Sep 27, 2022, 1:26:38 PM9/27/22
to Kivy users support
Sorted out!! Thank you so much!! God bless you a lot
Reply all
Reply to author
Forward
0 new messages