File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed
internal_filesystem/apps/com.example.camtestnew/assets Expand file tree Collapse file tree 1 file changed +7
-6
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 = 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
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})
3838image .set_src (image_dsc )
3939
4040for 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 )
You can’t perform that action at this time.
0 commit comments