|
11 | 11 |
|
12 | 12 | import time |
13 | 13 |
|
14 | | -th.disable() |
| 14 | +#th.disable() |
15 | 15 |
|
16 | 16 |
|
17 | 17 | from camera import Camera, GrabMode, PixelFormat, FrameSize, GainCeiling |
|
26 | 26 | xclk_freq=20000000, |
27 | 27 | powerdown_pin=-1, |
28 | 28 | reset_pin=-1, |
29 | | - #pixel_format=PixelFormat.RGB565, |
| 29 | + pixel_format=PixelFormat.RGB565, |
30 | 30 | #pixel_format=PixelFormat.GRAYSCALE, |
31 | 31 | #pixel_format=PixelFormat.YUV420, |
32 | | - pixel_format=PixelFormat.YUV422, # works |
| 32 | + #pixel_format=PixelFormat.YUV422, # works |
33 | 33 | frame_size=FrameSize.R240X240, |
34 | 34 | grab_mode=GrabMode.LATEST |
35 | 35 | ) |
|
38 | 38 |
|
39 | 39 | image = lv.image(lv.screen_active()) |
40 | 40 | image.align(lv.ALIGN.LEFT_MID, 0, 0) |
41 | | -image.set_rotation(900) |
| 41 | +#image.set_rotation(900) |
42 | 42 |
|
43 | 43 | # Create image descriptor once |
44 | 44 | image_dsc = lv.image_dsc_t({ |
45 | 45 | "header": { |
46 | 46 | "magic": lv.IMAGE_HEADER_MAGIC, |
47 | 47 | "w": width, |
48 | 48 | "h": height, |
49 | | - "stride": width, |
50 | | - "cf": lv.COLOR_FORMAT.I422 |
| 49 | + "stride": width *2, |
| 50 | + #"cf": lv.COLOR_FORMAT.L8 # works |
| 51 | + "cf": lv.COLOR_FORMAT.RGB565 # works |
| 52 | + #"cf": lv.COLOR_FORMAT.I422 #doesnt show anything |
| 53 | + #"cf": lv.COLOR_FORMAT.I420 #doesnt show anything |
| 54 | + #"cf": lv.COLOR_FORMAT.I420 |
| 55 | + #"cf": lv.COLOR_FORMAT.YUY2 |
| 56 | + #"cf": lv.COLOR_FORMAT.UYVY |
| 57 | + #"cf": lv.COLOR_FORMAT.NV12 |
51 | 58 | }, |
52 | | - 'data_size': width * height, |
| 59 | + 'data_size': width * height * 2 , |
| 60 | + #'data_size': 86400, |
53 | 61 | 'data': None # Will be updated per frame |
54 | 62 | }) |
55 | 63 | image.set_src(image_dsc) |
|
61 | 69 | image_dsc.data = cam.capture() # Returns memoryview |
62 | 70 | image.set_src(image_dsc) |
63 | 71 | #image.invalidate() |
64 | | - lv.task_handler() |
| 72 | + #lv.task_handler() |
65 | 73 | time.sleep_ms(5) # seems to need more than 0 or 1 ms, otherwise there's almost never a new image... |
66 | | - lv.tick_inc(5) |
| 74 | + #lv.tick_inc(5) |
67 | 75 |
|
68 | 76 |
|
69 | 77 | print("cleanup") |
70 | 78 | cam.deinit() |
71 | 79 |
|
72 | 80 |
|
73 | | -th.enable() |
| 81 | +#th.enable() |
0 commit comments