拍照指令

tags: camera

在 Command Line 環境下指令

指令 說明
-t 設定相機的時間(ms)
-o 設定圖檔存放的路徑
-e 設定編碼格式
-w 設定圖檔的寬(pixel)
-h 設定圖檔的高(pixel)
  • 只預覽 2 秒,不存檔

    ​​raspistill -t 2000
    
  • 5 秒後拍照 (預設),檔名為 test.jpg

    ​​raspistill -o test.jpg
    
  • 3 秒後拍照,並編碼為 png 格式,寬高為 640*480

    ​​raspistill -t 3000 -o test.jpg -e png -w 640 -h 480
    

在 Python 環境下指令

import picamera
import time

camera = picamera.PiCamera()
time.sleep(2)    # Camera warm-up time
camera.capture('test.jpg')