-
-
Save nomissbowling/1e4a04ae045b1a0603b3519033c051a8 to your computer and use it in GitHub Desktop.
M5StickVで撮影したVGAの画像をLCDに縮小表示しつつファイル保存する。(Maixpyファームウェアv0.6.2)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Untitled - By: mongonta - 金 4月 23 2021 | |
from Maix import GPIO | |
from fpioa_manager import * | |
from board import board_info | |
import os, lcd, image, time, sensor | |
##################################################################### | |
# Settings for M5StickV. Maix series should fix the following lines. | |
lcd.init(type=3) | |
fm.register(board_info.BUTTON_A, fm.fpioa.GPIO1, force=True) | |
fm.register(board_info.BUTTON_B, fm.fpioa.GPIO2, force=True) | |
button_a = GPIO(GPIO.GPIO1, GPIO.IN, GPIO.PULL_UP) | |
button_b = GPIO(GPIO.GPIO2, GPIO.IN, GPIO.PULL_UP) | |
##################################################################### | |
lcd.rotation(2) | |
sensor.reset() | |
sensor.set_pixformat(sensor.RGB565) | |
sensor.set_framesize(sensor.VGA) | |
sensor.skip_frames(time = 2000) | |
clock = time.clock() | |
def record_image(img_sav): | |
print("save") | |
img_sav.save("/sd/test10.jpg", quality=10) | |
time.sleep(0.5) | |
img_sav.save("/sd/test50.jpg", quality=50) | |
time.sleep(0.5) | |
img_sav.save("/sd/test95.jpg", quality=90) | |
time.sleep(0.5) | |
print("saved") | |
while(True): | |
clock.tick() | |
img = sensor.snapshot() | |
fps = clock.fps() | |
img.draw_string(320, 240, ("%2.1ffps" %(fps)), color=(255, 0, 0), scale=2) | |
img_lcd = img.resize(lcd.width(), lcd.height()) | |
lcd.display(img_lcd) | |
if button_a.value() == 0: | |
record_image(img) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment