class StreamView(Screen): output = StringProperty() event = None def onenter(self): app…
Jump to turn (6)
- 1class StreamView(Screen): output = StringProperty() event = None def onenter(sel
- 2the self.capture blocks entire program can this be modyfied to not do this ?
- 3problem is calling self.capture with wrong url blocks entire program before it g
- 4assert group is None, "group argument must be None for now" AssertionError: grou
- 5erm where is the diffrence in this code ?
- 6class VideoStream(threading.Thread): def init(self, url): threading.Thread.init(
- User
class StreamView(Screen):
codeoutput = StringProperty() event = None def on_enter(self): app = App.get_running_app() self.output = app.data #self.capture = cv2.VideoCapture(self.output) # RTSP URL print("print after setting wrong adress") b = Button() b.bind(on_press=lambda instance, button_id="i": gotomainscreen(button_id)) self.add_widget(b) self.image = Image() self.add_widget(self.image) #Clock.schedule_interval(self.update, 1.0 / 30.0) # 30 fps self.event = Clock.schedule_interval(self.update, 1.0 / 30.0) # 30 fps def gotomainscreen(x): app = App.get_running_app() app.root.current = "Main" def update(self, dt): ret, frame = self.capture.read() print("tik tok") if ret: buf = cv2.flip(frame, 0).tostring() # flip & convert to bytes texture = Texture.create(size=(frame.shape[1], frame.shape[0]), colorfmt='bgr') texture.blit_buffer(buf, colorfmt='bgr', bufferfmt='ubyte') self.image.texture = texture def on_leave(self): self.capture.release() self.event.cancel() cv2.destroyAllWindows()