From fbee73cb571716a330e722ad1bd079e3d7481be8 Mon Sep 17 00:00:00 2001 From: Thomas Farstrike Date: Wed, 14 May 2025 16:32:36 +0200 Subject: [PATCH] camtest: show color image --- .../apps/com.example.camtest/assets/camtest.py | 12 ++++++------ .../com.example.camtestnew/assets/camtestcolor.py | 2 ++ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/internal_filesystem/apps/com.example.camtest/assets/camtest.py b/internal_filesystem/apps/com.example.camtest/assets/camtest.py index 0fa14cc2..7ece720d 100644 --- a/internal_filesystem/apps/com.example.camtest/assets/camtest.py +++ b/internal_filesystem/apps/com.example.camtest/assets/camtest.py @@ -152,11 +152,11 @@ def build_ui(): "magic": lv.IMAGE_HEADER_MAGIC, "w": width, "h": height, - "stride": width , - #"cf": lv.COLOR_FORMAT.RGB565 - "cf": lv.COLOR_FORMAT.L8 + "stride": width * 2, + "cf": lv.COLOR_FORMAT.RGB565 + #"cf": lv.COLOR_FORMAT.L8 }, - 'data_size': width * height, + 'data_size': width * height * 2, 'data': None # Will be updated per frame }) image.set_src(image_dsc) @@ -176,8 +176,8 @@ def init_cam(): xclk_freq=20000000, powerdown_pin=-1, reset_pin=-1, - #pixel_format=PixelFormat.RGB565, - pixel_format=PixelFormat.GRAYSCALE, + pixel_format=PixelFormat.RGB565, + #pixel_format=PixelFormat.GRAYSCALE, frame_size=FrameSize.R240X240, grab_mode=GrabMode.LATEST ) diff --git a/internal_filesystem/apps/com.example.camtestnew/assets/camtestcolor.py b/internal_filesystem/apps/com.example.camtestnew/assets/camtestcolor.py index c5aeacd2..3ccf6eaa 100644 --- a/internal_filesystem/apps/com.example.camtestnew/assets/camtestcolor.py +++ b/internal_filesystem/apps/com.example.camtestnew/assets/camtestcolor.py @@ -26,6 +26,8 @@ cam = Camera( xclk_freq=20000000, powerdown_pin=-1, reset_pin=-1, + #pixel_format=PixelFormat.RAW, # fails + #pixel_format=PixelFormat.RGB888, fails pixel_format=PixelFormat.RGB565, #pixel_format=PixelFormat.GRAYSCALE, #pixel_format=PixelFormat.YUV420,