--
You received this message because you are subscribed to a topic in the Google Groups "Kivy users support" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/kivy-users/Gmh2XnaILNM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to kivy-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/a610a7b9-e36f-4cf0-b081-42b2c7a6c553n%40googlegroups.com.
I can see one issue:
Change:
def on_start(self):
Clock.schedule_interval(Float().start_calling, 1.0 / 30.0)
to:
def on_start(self):
Clock.schedule_interval(self.start_calling, 1.0 / 30.0)
--
You received this message because you are subscribed to the Google Groups "Kivy users support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kivy-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/CAH_LR1VGm9AezYJmXeYmTjjsYeE33TaOzOJCxVrJE9bP76jE9Q%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/60cbf23c.1c69fb81.43a7a.25b3SMTPIN_ADDED_MISSING%40gmr-mx.google.com.
On Jun 17, 2021, at 6:27 PM, Gaurav Bhoi <bhoiga...@gmail.com> wrote:
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/CAH_LR1Vku6aq5DP%3DGb1BRUzJJbEzTLmuKVZB8RHbjoef0y7JvA%40mail.gmail.com.
The highlighted lines are the changes. The schedule interval needs to be canceled when the streaming is stopped.
from kivy.app import App
from kivy.uix.floatlayout import FloatLayout
import cv2
from kivy.graphics.texture import Texture
from kivy.clock import Clock
video_capture = cv2.VideoCapture(0)
class Float(FloatLayout):
def start_calling(self, dt):
_, frame = video_capture.read()
self.img_frame = frame
buffer = cv2.flip(frame, 0
).tobytes()
texture = Texture.create(size=(frame.shape[1], frame.shape[0]), colorfmt='bgr')
texture.blit_buffer(buffer, colorfmt='bgr', bufferfmt='ubyte')
self.ids.img.texture = texture
# print(self.ids.img.texture)
def stop_streaming(self):
app = App.get_running_app()
app.schedule.cancel()
video_capture.release()
class StreamingApp(App):
def __init__(self, **kwargs):
super().__init__(**kwargs)
self.schedule = None
def build(self):
return Float()
def on_start(self
):
self.schedule = Clock.schedule_interval(self.root.start_calling, 1.0 / 30.0)
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/B8E80DB0-27ED-4B34-8B24-14D42ED2D70F%40cox.net.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/60cc0e90.1c69fb81.dc049.4d1bSMTPIN_ADDED_MISSING%40gmr-mx.google.com.
I don’t know anything about firebase. I assume you could convert the buffer to JSON and store it.
Why do you want to store the buffer in firebase?
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/CAH_LR1U3UnOLDrqV23uUGP9eeLyYybah9%2BW2_HVS0Q2x5yHU1Q%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/60cd24b7.1c69fb81.ed78c.2bb8SMTPIN_ADDED_MISSING%40gmr-mx.google.com.
The data type of buffer is bytes, so you need to convert the data into a text representation. I used .hex()
In the code below I set it up some it only saves one buffer for my test.
from kivy.app import App
from kivy.uix.floatlayout import FloatLayout
from kivy.graphics.texture import Texture
from kivy.clock import Clock
import cv2
import json
video_capture = cv2.VideoCapture(0)
class Float(FloatLayout):
once = True
def start_calling(self, dt):
_, frame = video_capture.read()
self.img_frame = frame
buffer = cv2.flip(frame, 0).tobytes()
if self.once:
with open('buffer_file.txt', 'w') as f:
json.dump(buffer.hex(), f)
self.once = False
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/CAH_LR1U8ymoNt2hkTExdXGLsSBeO7Ro7Xacj3g2RZCovU9KPbg%40mail.gmail.com.