Kivy相机旋转90度

问题描述 投票:0回答:1

我使用了kivy库中的Camera,在Windows上它显示正确,但是当我在Android平台上尝试它时,它似乎旋转了90度。

我尝试过画布旋转Push和PopMatrix的方法

Camera:
        id: camera
        resolution: (640, 480)
        play: False
        canvas.before:
            PushMatrix
            Rotate:
                angle: -90
                origin: self.center
        canvas.after:
            PopMatrix

来自 Kivy 相机显示屏旋转 -90 度 但没有帮助。我的代码使用 python 声明式风格

self.camera = Camera(
            play=True,

        )

        bottom_box = AnchorLayout(
            size_hint=(1, 0.1)
        )

        take_pic_button = MDIconButton(
            icon='circle',
            theme_icon_color="Custom",
            icon_color=(255 / 255, 255 / 255, 255 / 255, 1),
            icon_size='50sp',
            size_hint=(None, None),
            pos_hint={'center_x': 0.5, 'center_y': 0.5},
            ripple_scale=0,
        )

        take_pic_button.bind(
            on_release=self.take_picture
        )

有什么办法可以解决吗?

python android kivy android-camera kivymd
1个回答
0
投票

使用XCamera解决了,使用起来更方便。它提供了更简单的实现。 https://github.com/kivy-garden/xcamera

© www.soinside.com 2019 - 2024. All rights reserved.