本文介绍了我如何使用 Kivy (Python) 相机的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!
问题描述
我尝试使用 uix.camera 小部件并从我的网络摄像头中显示一些宽幅图像.我查看了文档并尝试使用这个简单的代码.但它只是给我看一个没有任何视频的白色屏幕(我启用了播放).我做错了什么?也许存在一些有用的文档教程(因为从官方文档中我了解了很多).感谢您的帮助.
I try to use uix.camera widget and show some wideo from my web-camera. I looked into the documentation and try to use this simply code. But it's just show me a white creen withoud any video (I enabled playing). What I'm doing wrong? Maybe some useful docs utorial exist (because from official documentation I understanding a little from many). Thanks for any help.
import kivy
kivy.require('1.9.1')
from kivy.app import App
from kivy.uix.label import Label
from kivy.uix.camera import Camera
class MainApp(App):
def build(self):
return Camera(play=True)
if __name__== "__main__":
MainApp().run()
推荐答案
需要指定分辨率.就我而言,我还需要指定 index=1,即插入我计算机的第二个摄像头.
You need to specify resolution. In my case, I also needed to specify index=1, that is the second camera plugged in my computer.
例子:
import kivy
kivy.require('1.9.1')
from kivy.app import App
from kivy.uix.label import Label
from kivy.uix.camera import Camera
class MainApp(App):
def build(self):
return Camera(play=True, index=1, resolution=(640,480))
if __name__== "__main__":
MainApp().run()
这篇关于我如何使用 Kivy (Python) 相机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!
The End


大气响应式网络建站服务公司织梦模板
高端大气html5设计公司网站源码
织梦dede网页模板下载素材销售下载站平台(带会员中心带筛选)
财税代理公司注册代理记账网站织梦模板(带手机端)
成人高考自考在职研究生教育机构网站源码(带手机端)
高端HTML5响应式企业集团通用类网站织梦模板(自适应手机端)