From b483cd5c660341eef5ddc229c823a9c4ad8ee557 Mon Sep 17 00:00:00 2001 From: Thomas Farstrike Date: Wed, 14 May 2025 22:46:23 +0200 Subject: [PATCH] Comments --- .../apps/com.example.camtest/assets/camtest.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/internal_filesystem/apps/com.example.camtest/assets/camtest.py b/internal_filesystem/apps/com.example.camtest/assets/camtest.py index 32c28c4d..334d0608 100644 --- a/internal_filesystem/apps/com.example.camtest/assets/camtest.py +++ b/internal_filesystem/apps/com.example.camtest/assets/camtest.py @@ -1,3 +1,10 @@ +# This code grabs images from the camera in RGB565 format (2 bytes per pixel) +# and sends that to the QR decoder if QR decoding is enabled. +# The QR decoder then converts the RGB565 to grayscale, as that's what quirc operates on. +# It would be slightly more efficient to capture the images from the camera in L8/grayscale format, +# or in YUV format and discarding the U and V planes, but then the image will be gray (not great UX) +# and the performance impact of converting RGB565 to grayscale is probably minimal anyway. + import time appscreen = lv.screen_active() @@ -101,7 +108,7 @@ def try_capture(): if use_webcam: current_cam_buffer = webcam.capture_frame(cam, "rgb565") elif cam.frame_available(): - current_cam_buffer = cam.capture() # Returns memoryview + current_cam_buffer = cam.capture() if current_cam_buffer and len(current_cam_buffer): image_dsc.data = current_cam_buffer #image.invalidate() # does not work so do this: