KIVY Camera¶

Camera — Kivy 2.3.0 documentation

Camera  相机

Jump to API ⇓

Module: kivy.uix.camera

Added in 1.0.0

The Camera widget is used to capture and display video from a camera. Once the widget is created, the texture inside the widget will be automatically updated. Our CameraBase implementation is used under the hood:
Camera 控件用于从摄像头捕获并显示视频。一旦该控件被创建,控件内部的纹理将自动更新。在内部,我们使用了 CameraBase 的实现:

cam = Camera()

By default, the first camera found on your system is used. To use a different camera, set the index property:
默认情况下,将使用您系统中找到的第一个摄像头。要使用不同的摄像头,请设置索引属性(index property):

cam = Camera(index=1)

You can also select the camera resolution:  您还可以选择摄像头的分辨率: 
resolution   美/ˌrezəˈluːʃ(ə)n(电视、照相机、显微镜等的)清晰度,分辨率;

cam = Camera(resolution=(320, 240))

Warning

The camera texture is not updated as soon as you have created the object. The camera initialization is asynchronous, so there may be a delay before the requested texture is created.

在创建对象之后,摄像头的纹理并不会立即更新。摄像头的初始化是异步的,因此在请求的纹理被创建之前可能会有延迟。

APIHide Description ⇑


class kivy.uix.camera.Camera(**kwargs)

Bases: kivy.uix.image.Image

Camera class. See module documentation for more information.
 

index

Index of the used camera, starting from 0. 使用的相机的索引,从0开始

index is a NumericProperty and defaults to -1 to allow auto selection.

play     播放

Boolean indicating whether the camera is playing or not. You can start/stop the camera by setting this property:
布尔值,指示摄像头是否正在播放。您可以通过设置此属性来启动/停止摄像头:

# start the camera playing at creation
cam = Camera(play=True)

# create the camera, and start later (default)
cam = Camera(play=False)
# and later
cam.play = True

play is a BooleanProperty and defaults to False. play是一个波尔值属性 并且默认是 False

resolution¶    分辨率

Preferred resolution to use when invoking the camera. If you are using [-1, -1], the resolution will be the default one:
当你调用相机时,建议使用的首选分辨率。如果你使用的是[-1, -1],那么分辨率将会是默认的:

# create a camera object with the best image available
cam = Camera()

# create a camera object with an image of 320x240 if possible
cam = Camera(resolution=(320, 240))

Warning

Depending on the implementation, the camera may not respect this property.

resolution is a ListProperty and defaults to [-1, -1].

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

xinzheng新政

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值