Hello,
I'm looking for a way to refresh camera miniature images from snapshots. I have this piece of code, but after first refresh (not the one in the reloadMiniatures thread) i get blackness.
I have tried other solutions but showing 6x mjpeg streams was to heavy (and I don't really need high framerate). Had some success with AsyncImage and saving images to file, but it wasn't very efficient and I had this loading_image to get rid of.
from kivy.uix.image import Image
import time
import threading
import urllib
from kivy.core.image import Image as CoreImage
from io import BytesIO
class TestApp(App):
def reloadMiniatures(self):
while True:
time.sleep(3)
self.image.texture = CoreImage(data, ext='jpg').texture
def build(self):
self.image = Image()
self.image.texture = CoreImage(data, ext='jpg').texture
miniatures = threading.Thread(target=self.reloadMiniatures)
miniatures.daemon = True
miniatures.start()
return self.image
TestApp().run()