Skip to content

Commit e0f557c

Browse files
this works
1 parent 6fa179d commit e0f557c

File tree

1 file changed

+7
-6
lines changed
  • internal_filesystem/apps/com.example.camtestnew/assets

1 file changed

+7
-6
lines changed

internal_filesystem/apps/com.example.camtestnew/assets/camtestnew.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
th.disable()
1616

1717
cam = webcam.init("/dev/video0") # Initialize webcam with device path
18-
memview = webcam.capture_frame(cam) # Returns memoryview
18+
#memview = webcam.capture_frame(cam) # Returns memoryview
1919
#time.sleep_ms(1000)
2020
#static_bytes_obj = bytes(memview)
2121

@@ -33,19 +33,20 @@
3333
"cf": lv.COLOR_FORMAT.L8
3434
},
3535
'data_size': width * height,
36-
'data': memview # Will be updated per frame
36+
'data': None # Will be updated per frame
3737
})
3838
image.set_src(image_dsc)
3939

4040
for i in range(600):
4141
#print(f"iteration {i}")
42-
webcam.recapture_frame(cam) #refresh memview
42+
#webcam.recapture_frame(cam) #refresh memview
43+
memview = webcam.capture_frame(cam) # Returns memoryview
4344
#bytes_obj = bytes(memview)
4445
#print(f"got bytes: {len(bytes_obj)}")
4546
#image_dsc.data = static_bytes_obj
46-
#image_dsc.data = bytes_obj
47-
#image.set_src(image_dsc)
48-
image.invalidate()
47+
image_dsc.data = memview
48+
image.set_src(image_dsc)
49+
#image.invalidate()
4950
lv.task_handler()
5051
time.sleep_ms(5) # seems to need more than 0 or 1 ms, otherwise there's almost never a new image...
5152
lv.tick_inc(5)

0 commit comments

Comments
 (0)