1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

RasPi4 Camera で定点観測

Posted at

カメラ位置の変更

リモートロケーションからの定点観測の映像をもう少し安定させたいと考えていたが、そのソリューションが見つかったかも。窓に貼り付ける!!
raspi4camra.jpeg
ガラスに近いから汚れもほとんど気にならない。今は特に外気が冷たいので、結露に対しては、まあ対策にならないと思うが、ハウジングして外に出してケーブルを這わせて・・・などなど考えていたがとりあえずこれが一番手軽なので早速トライ。

_結果は・・・

2022-02-03-1510.png
予想以上にクリア!

ちょっとスクリプト

①イメージをキャプチャ
②WEBサーバにあげたいので適度に圧縮(1MB以下に)
③FTPサーバにイメージをポスト

Raspiは長くあげっぱましにしておくと①でエラーなるケースがあり、一旦そうなるともうだめです。
なので、その場合はRELOADするようにしました。

# !/bin/sh
# camera.sh
path=/home/hoge/image/
fn=$(date +%Y-%m-%d-%H%M)
dn=$(date +%Y-%m-%d)
FILE=${fn}.jpg
SERVER=ubuntu
USER=anonymous
PASS="nopasswd"
# Capture Image
#
raspistill -t 1000 -q 75 -o ${path}${FILE}
#
# Reload system if raspistill return ERR
if [ $? -ne 0 ]; then
    /usr/local/bin/reload.sh
    exit 1
fi
#
# compress image for HTTP upload
#
jpegoptim --size 900k --overwrite ${path}${FILE}
#
# Upload to FTP server
#
echo user $USER $PASS
pftp -n <<END
open $SERVER
user $USER $PASS
lcd $path
cd image
mkdir $dn
cd $dn
binary
put $FILE
END

後はCRONで10分ごとに撮影をキック

~$ crontab -l
*/10 5-18 * * * /home/hoge/camera.sh 

夜は何も映らないので5時から18時の間。明け方と夕方が特に素敵なので、このあたりは日の出日の入りの時間で自動調整するような工夫ができたらいいな、と思いつつ。今日はここまで。

次は自動的にWORDPRESSに連続写真としてPOSTできればいいなと思っています。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?