You've already forked MicroPythonOS
mirror of
https://github.com/m5stack/MicroPythonOS.git
synced 2026-05-20 11:51:27 -07:00
still works
This commit is contained in:
@@ -15,6 +15,7 @@ import time
|
||||
th.disable()
|
||||
|
||||
cam = webcam.init("/dev/video0") # Initialize webcam with device path
|
||||
memview = None
|
||||
#memview = webcam.capture_frame(cam) # Returns memoryview
|
||||
#time.sleep_ms(1000)
|
||||
#static_bytes_obj = bytes(memview)
|
||||
@@ -33,18 +34,21 @@ image_dsc = lv.image_dsc_t({
|
||||
"cf": lv.COLOR_FORMAT.L8
|
||||
},
|
||||
'data_size': width * height,
|
||||
'data': None # Will be updated per frame
|
||||
'data': memview # Will be updated per frame
|
||||
})
|
||||
image.set_src(image_dsc)
|
||||
|
||||
for i in range(600):
|
||||
#print(f"iteration {i}")
|
||||
#webcam.recapture_frame(cam) #refresh memview
|
||||
memview = webcam.capture_frame(cam) # Returns memoryview
|
||||
#bytes_obj = bytes(memview)
|
||||
memview = webcam.capture_frame(cam) # Returns memoryview
|
||||
|
||||
for i in range(300):
|
||||
print(f"iteration {i}")
|
||||
webcam.recapture_frame(cam) #refresh memview
|
||||
#memview =
|
||||
bytes_obj = bytes(memview)
|
||||
#print(f"got bytes: {len(bytes_obj)}")
|
||||
image_dsc.data = bytes_obj
|
||||
#image_dsc.data = static_bytes_obj
|
||||
image_dsc.data = memview
|
||||
#image_dsc.data = webcam.capture_frame(cam) # Returns memoryview
|
||||
image.set_src(image_dsc)
|
||||
#image.invalidate()
|
||||
lv.task_handler()
|
||||
|
||||
Reference in New Issue
Block a user