camera
The camera module is used for taking pictures.
Note
This module is only applicable to the CoreS3 Controller
Micropython Example
capture display
1# SPDX-FileCopyrightText: 2024 M5Stack Technology CO LTD 2# 3# SPDX-License-Identifier: MIT 4import os, sys, io 5import M5 6from M5 import * 7import camera 8 9 10img = None 11 12 13def setup(): 14 global img 15 M5.begin() 16 Widgets.fillScreen(0x222222) 17 camera.init(pixformat=camera.RGB565, framesize=camera.QVGA) 18 19 20def loop(): 21 global img 22 M5.update() 23 img = camera.snapshot() 24 M5.Lcd.show(img, 0, 0, 320, 240) 25 26 27if __name__ == "__main__": 28 try: 29 setup() 30 while True: 31 loop() 32 except (Exception, KeyboardInterrupt) as e: 33 try: 34 from utility import print_error_msg 35 36 print_error_msg(e) 37 except ImportError: 38 print("please update to latest firmware")
UIFlow2.0 Example
capture display
Functions
- camera.init(pixformat, framesize)
Initializes the camera sensor.
The
pixformat
supports:camera.RGB565
The
framesize
supports:camera.QQVGA
: 160x120camera.QCIF
: 176x144camera.HQVGA
: 240x176camera.FRAME_240X240
: 240x240camera.QVGA
: 320x240
UIFlow2.0
- camera.snapshot() image.Iamge
Capture a single frame.
Returns An
image.Image
object.UIFlow2.0
- camera.set_hmirror(enable)
Turns horizontal mirror mode on (True) or off (False). Defaults to on.
UIFlow2.0
- camera.set_vflip(enable)
Turns vertical flip mode on (True) or off (False). Defaults to off.
UIFlow2.0
- camera.get_hmirror()
Returns if horizontal mirror mode is enabled.
UIFlow2.0
- camera.get_vflip()
Returns if vertical flip mode is enabled.
UIFlow2.0