mirror of
https://github.com/m5stack/MicroPythonOS.git
synced 2026-05-20 11:51:27 -07:00
cleanups
This commit is contained in:
@@ -221,7 +221,7 @@ if not cam:
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"camtest.py: webcam exception: {e}")
|
print(f"camtest.py: webcam exception: {e}")
|
||||||
|
|
||||||
time.sleep_ms(1000)
|
#time.sleep_ms(1000)
|
||||||
memview = webcam.capture_frame(cam) # Returns memoryview
|
memview = webcam.capture_frame(cam) # Returns memoryview
|
||||||
time.sleep_ms(1000)
|
time.sleep_ms(1000)
|
||||||
static_bytes_obj = bytes(memview)
|
static_bytes_obj = bytes(memview)
|
||||||
|
|||||||
@@ -15,15 +15,15 @@ import time
|
|||||||
th.disable()
|
th.disable()
|
||||||
|
|
||||||
cam = webcam.init("/dev/video0") # Initialize webcam with device path
|
cam = webcam.init("/dev/video0") # Initialize webcam with device path
|
||||||
memview = None
|
#memview = None
|
||||||
#memview = webcam.capture_frame(cam) # Returns memoryview
|
memview = webcam.capture_frame(cam) # Returns memoryview
|
||||||
#time.sleep_ms(1000)
|
#time.sleep_ms(1000)
|
||||||
#static_bytes_obj = bytes(memview)
|
#static_bytes_obj = bytes(memview)
|
||||||
|
|
||||||
|
|
||||||
image = lv.image(lv.screen_active())
|
image = lv.image(lv.screen_active())
|
||||||
image.align(lv.ALIGN.LEFT_MID, 0, 0)
|
image.align(lv.ALIGN.LEFT_MID, 0, 0)
|
||||||
image.set_rotation(900)
|
#image.set_rotation(900)
|
||||||
# Create image descriptor once
|
# Create image descriptor once
|
||||||
image_dsc = lv.image_dsc_t({
|
image_dsc = lv.image_dsc_t({
|
||||||
"header": {
|
"header": {
|
||||||
@@ -38,15 +38,15 @@ image_dsc = lv.image_dsc_t({
|
|||||||
})
|
})
|
||||||
image.set_src(image_dsc)
|
image.set_src(image_dsc)
|
||||||
|
|
||||||
memview = webcam.capture_frame(cam) # Returns memoryview
|
#memview = webcam.capture_frame(cam) # Returns memoryview
|
||||||
|
|
||||||
for i in range(300):
|
for i in range(300):
|
||||||
print(f"iteration {i}")
|
print(f"iteration {i}")
|
||||||
webcam.recapture_frame(cam) #refresh memview
|
webcam.recapture_frame(cam) #refresh memview
|
||||||
#memview =
|
#memview =
|
||||||
bytes_obj = bytes(memview)
|
#bytes_obj = bytes(memview)
|
||||||
#print(f"got bytes: {len(bytes_obj)}")
|
#print(f"got bytes: {len(bytes_obj)}")
|
||||||
image_dsc.data = bytes_obj
|
#image_dsc.data = bytes_obj
|
||||||
#image_dsc.data = static_bytes_obj
|
#image_dsc.data = static_bytes_obj
|
||||||
#image_dsc.data = webcam.capture_frame(cam) # Returns memoryview
|
#image_dsc.data = webcam.capture_frame(cam) # Returns memoryview
|
||||||
image.set_src(image_dsc)
|
image.set_src(image_dsc)
|
||||||
|
|||||||
Reference in New Issue
Block a user