樹莓派攝像頭操作命令及流程


第一步:開啟攝像頭模式

在終端輸入  sudo raspi-config  

選擇  Enable canmer

然后finish

然后方向鍵右右然后回車  退出config

第二步:拍照片測試

終端輸入 raspistill -o testcapture.jpg 

攝像頭紅燈開始閃爍,屏幕有五秒預覽畫面,第五秒的圖像進行拍照

附帶的調整圖像命令是

raspistill -otestcapture.jpg -vf   使圖像上下顛倒

raspistill -otestcapture.jpg -hf   使圖像左右顛倒

-o將圖像輸出到了名為tescapture的JPEG文件中   還可以用如下命令改變調整格式

 Raspistill -o testcapture.png -e png    (改變為PNG格式)

 Raspistill -o testcapture.bmp -e bmp   (改變為BMP格式)

 Raspistill -o testcapture.gif -e gif     (改變為GIF格式)

調整圖像長寬的命令如下:、

 Raspistill -w 1920 -h 1080 -ofullhdcapture.jpg

-w   寬度    -h   長度

控制預覽的延時命令如下:

 raspistill-t 10000 -o tensecondcapture.jpg    (單位為毫秒)

 raspistill-t 1 -o instancapture.jpg    (秒拍)

此處缺少知道照片所存儲的位置以及如何讀取

 

錄制視頻

第一步:檢查攝像頭可用與否

Raspivid -o testvideo.h246    格式只能是H.246   

調整窗口大小 raspivid -w 1280 -h 720 -ofullhvideo.h246

調整錄制時間 raspivid -t 60000 -ominutelongvideo.h246

第二步:使用shell腳本編寫定時控制

Mkdir timeplace            #創建文件

Cd timeplace               #進入文件

Nano timeplace.sh          #打開腳本,進入編輯

 

輸入如下:

#!bin/bash                       #注釋使用默認的bash 的shell

#capture time-lapse images using raspistillapplication    #避免我們不知道自己在干嘛

While true

Do

    Flamename=’data+%Y%M%D%H%M%S’.jpg      #調用data   形成文件格式名稱

Raspistill -w 1920 -h 1080 -t 1 -o$filename         #拍照

Echo Image captured                           #向控制台或終端輸出打印信息

Sleep 30  #單位  秒

Done      #關閉循環

 

 

第三步:修改文件權限

Chmod +xtimeplace.sh

第四步:執行命令

./timeplace.sh

第一步:開啟攝像頭模式

在終端輸入  sudo raspi-config  

選擇  Enable canmer

然后finish

然后方向鍵右右然后回車  退出config

第二步:拍照片測試

終端輸入 raspistill -o testcapture.jpg 

攝像頭紅燈開始閃爍,屏幕有五秒預覽畫面,第五秒的圖像進行拍照

附帶的調整圖像命令是

raspistill -otestcapture.jpg -vf   使圖像上下顛倒

raspistill -otestcapture.jpg -hf   使圖像左右顛倒

-o將圖像輸出到了名為tescapture的JPEG文件中   還可以用如下命令改變調整格式

 Raspistill -o testcapture.png -e png    (改變為PNG格式)

 Raspistill -o testcapture.bmp -e bmp   (改變為BMP格式)

 Raspistill -o testcapture.gif -e gif     (改變為GIF格式)

調整圖像長寬的命令如下:、

 Raspistill -w 1920 -h 1080 -ofullhdcapture.jpg

-w   寬度    -h   長度

控制預覽的延時命令如下:

 raspistill-t 10000 -o tensecondcapture.jpg    (單位為毫秒)

 raspistill-t 1 -o instancapture.jpg    (秒拍)

此處缺少知道照片所存儲的位置以及如何讀取

 

錄制視頻

第一步:檢查攝像頭可用與否

Raspivid -o testvideo.h246    格式只能是H.246   

調整窗口大小 raspivid -w 1280 -h 720 -ofullhvideo.h246

調整錄制時間 raspivid -t 60000 -ominutelongvideo.h246

第二步:使用shell腳本編寫定時控制

Mkdir timeplace            #創建文件

Cd timeplace               #進入文件

Nano timeplace.sh          #打開腳本,進入編輯

 

輸入如下:

#!bin/bash                       #注釋使用默認的bash 的shell

#capture time-lapse images using raspistillapplication    #避免我們不知道自己在干嘛

While true

Do

    Flamename=’data+%Y%M%D%H%M%S’.jpg      #調用data   形成文件格式名稱

Raspistill -w 1920 -h 1080 -t 1 -o$filename         #拍照

Echo Image captured                           #向控制台或終端輸出打印信息

Sleep 30  #單位  秒

Done      #關閉循環

 

 

第三步:修改文件權限

Chmod +xtimeplace.sh

第四步:執行命令

./timeplace.sh
————————————————
版權聲明:本文為CSDN博主「qq_39705572」的原創文章,遵循 CC 4.0 BY-SA 版權協議,轉載請附上原文出處鏈接及本聲明。
原文鏈接:https://blog.csdn.net/qq_39705572/article/details/80800254


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM