Skip to content

Commit b483cd5

Browse files
Comments
1 parent 1f7bb80 commit b483cd5

File tree

1 file changed

+8
-1
lines changed
  • internal_filesystem/apps/com.example.camtest/assets

1 file changed

+8
-1
lines changed

internal_filesystem/apps/com.example.camtest/assets/camtest.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
# This code grabs images from the camera in RGB565 format (2 bytes per pixel)
2+
# and sends that to the QR decoder if QR decoding is enabled.
3+
# The QR decoder then converts the RGB565 to grayscale, as that's what quirc operates on.
4+
# It would be slightly more efficient to capture the images from the camera in L8/grayscale format,
5+
# or in YUV format and discarding the U and V planes, but then the image will be gray (not great UX)
6+
# and the performance impact of converting RGB565 to grayscale is probably minimal anyway.
7+
18
import time
29

310
appscreen = lv.screen_active()
@@ -101,7 +108,7 @@ def try_capture():
101108
if use_webcam:
102109
current_cam_buffer = webcam.capture_frame(cam, "rgb565")
103110
elif cam.frame_available():
104-
current_cam_buffer = cam.capture() # Returns memoryview
111+
current_cam_buffer = cam.capture()
105112
if current_cam_buffer and len(current_cam_buffer):
106113
image_dsc.data = current_cam_buffer
107114
#image.invalidate() # does not work so do this:

0 commit comments

Comments
 (0)