我正在尝试使用覆盆子pi相机模块和PiCamera python库构建静态照片相机。当我指定传感器可以管理的完全重新设置时,实时预览会被裁剪,我希望实时预览显示与按下按钮时我将捕获的帧完全相同,因此我可以正确地构图。
任何人都知道该怎么做?
import time
import picamera
import RPi.GPIO as GPIO
from sys import exit
GPIO.setmode(GPIO.BCM)
GPIO.setup(17, GPIO.IN, pull_up_down=GPIO.PUD_UP)
sequence = 1
event_name = "New Camera"
def capturetime():
global sequence
camera.capture('%s - %03d.jpg' % (event_name, sequence))
print("Snapped!")
sequence += 1
with picamera.PiCamera(sensor_mode=0) as camera:
camera.resolution = (2592, 1944)
camera.start_preview()
print("¡Presiona la bubinga!")
while True:
input_state = GPIO.input(17)
if input_state == False:
capturetime()