File tree Expand file tree Collapse file tree 1 file changed +11
-7
lines changed
internal_filesystem/apps/com.example.camtestnew/assets Expand file tree Collapse file tree 1 file changed +11
-7
lines changed Original file line number Diff line number Diff line change 1515th .disable ()
1616
1717cam = webcam .init ("/dev/video0" ) # Initialize webcam with device path
18+ memview = None
1819#memview = webcam.capture_frame(cam) # Returns memoryview
1920#time.sleep_ms(1000)
2021#static_bytes_obj = bytes(memview)
3334 "cf" : lv .COLOR_FORMAT .L8
3435 },
3536 'data_size' : width * height ,
36- 'data' : None # Will be updated per frame
37+ 'data' : memview # Will be updated per frame
3738})
3839image .set_src (image_dsc )
3940
40- for i in range (600 ):
41- #print(f"iteration {i}")
42- #webcam.recapture_frame(cam) #refresh memview
43- memview = webcam .capture_frame (cam ) # Returns memoryview
44- #bytes_obj = bytes(memview)
41+ memview = webcam .capture_frame (cam ) # Returns memoryview
42+
43+ for i in range (300 ):
44+ print (f"iteration { i } " )
45+ webcam .recapture_frame (cam ) #refresh memview
46+ #memview =
47+ bytes_obj = bytes (memview )
4548 #print(f"got bytes: {len(bytes_obj)}")
49+ image_dsc .data = bytes_obj
4650 #image_dsc.data = static_bytes_obj
47- image_dsc .data = memview
51+ # image_dsc.data = webcam.capture_frame(cam) # Returns memoryview
4852 image .set_src (image_dsc )
4953 #image.invalidate()
5054 lv .task_handler ()
You can’t perform that action at this time.
0 commit comments