本文介紹了我如何使用 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) 相機的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!
【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!