除了一件事之外,该代码按预期工作。相机的图像大约每15秒更新一次。我想知道是否有办法使其运行更快。我使用的是带有英特尔Atom处理器的Acer开关平板电脑,它没有很多功能,所以我想知道这是否可能成为我的问题的一部分,还是我应该尝试使用OpenCV来获取图片。现在,它不需要录制视频或保存图像,只需要做一个实时流即可。
from kivy.app import App
from kivy.uix.gridlayout import GridLayout
from kivy.uix.label import Label
from kivy.uix.textinput import TextInput
from kivy.uix.scrollview import ScrollView
from kivy.uix.screenmanager import ScreenManager,Screen
from kivy.base import runTouchApp
from kivy.uix.camera import Camera
import time
from kivy.uix.boxlayout import BoxLayout
class MainScreen(Screen):
pass
class OptionsScreen(Screen):
pass
class AlarmScreen(Screen):
pass
class Project_1App(App):
def build(self):
screenManager = ScreenManager()
screenManager.add_widget(MainScreen(name="main"))
screenManager.add_widget(OptionsScreen(name="options"))
screenManager.add_widget(AlarmScreen(name="alarm"))
return screenManager
Project_1App.run()
在这里
<MainScreen>:
GridLayout:
rows:5
cols:1
padding: 10
spacing: 10
Camera:
index:0
resolution: (300,300)
play: True
Button:
text: "Options"
size_hint_y: None
width: 150
height: 50
on_release: root.manager.current = 'options'