Raspberry Pi series (3)-install some modules

Install the camera and take pictures

Install the camera module

Note: The Raspberry Pi must be turned off and power off before plugging or unplugging, otherwise the camera may be burned out

  1. Find the CSI (Camera Serial Interface) interface (next to the Ethernet)
  2. Pull up the CSI interface baffle
  3. Take your camera module and tear off the plastic protective film attached to the lens. Make sure that the yellow part of the PCB (the side with words) is installed perfectly (you can press the yellow part lightly to ensure that the installation is perfect).
  4. Insert the ribbon cable into the CSI interface. Remember, the side with the blue tape should face the Ethernet interface. Similarly, at this time, after confirming that the cable is installed, pull down the baffle.
    Insert picture description here
    Insert picture description here

Enable camera and take photos

#打开设置,找到 Interfacing Options
sudo raspi-config
# 找到 Camera 并启用,重启机器
Take pictures
# 拍照,会生成一张 myPhone.jpg 照片文件,并保存在当前文件夹下
sudo raspistill -o myPhone.jpg

Insert picture description here
raspistill -o image%d.jpg -rot 180 -w 1024 -h 768 -q 8 -t 20000 -tl 5000 -v

-o image%d.jpg  #保存文件为image%d.jpg( d 是从一开始,向后自加);

-rot 180  #镜头翻转180度,因为你连完线后它的那个折痕弯弧致使摄像头画面倒置的, 所以需要我们通过简单的命令就可以解决,不需要硬掰线之列的fight操作。

-w 1024 -h 768   #这个就是照片的宽与高了自行设置,太大可能会模糊失真最关键的是会增大它的存储空间,浪费资源。

-q 8  #就是英文quality质量的意思,堆头就是图像质量,q越大文件占用存储空间越大,自己根据满意的画面质量设置吧,挨个试。数值8是我尝试出来的画面质量还可以而且占用空间仅有大约52k;

-t 20000 -tl 5000  #拍摄时间为20秒,并每间隔5秒拍摄一张以JPG为格式的,以image1.jpg、image2.jpg、image3.jpg......为命名的照片文件;
Video recording

The following command (length 5 seconds, video stream at 30 frames per second, resolution 1920x1080, bit rate 30Mbps) is used to shoot a video in FLV format.
raspivid -o my_video.flv -rot 180 -t 5000 -p 8 -w 1920 -h 1080


Real-time network video surveillance program

Download source code, compile and install mjpg-streamer software

sudo ape-get update
sudo apt-get upgrade
sudo git clone https://github.com/jacksonliam/mjpg-streamer.git
sudo apt-get install cmake libjpeg8-dev
cd mjpg-streamer/mjpg-streamer-experimental
sudo make
sudo make install
export LD_LIBRARY_PATH=.
./mjpg_streamer -o "output_http.so -w ./www" -i "input_raspicam.so"

Then enter the browser to http://ip:8080/stream.htmlsee the video screen. The
script starts start-camera.sh

cd /opt/soft/mjpg-streamer/mjpg-streamer-experimental
export LD_LIBRARY_PATH=.
./mjpg_streamer -o "output_http.so -w ./www" -i "input_raspicam.so"

Grant permissions: chmod +x start-camera.sh
start in the background: ./start-camera.sh >/dev/null 2>&1 &
view the process:ps -ef|grep mjpg


Guess you like

Origin blog.csdn.net/qq122716072/article/details/108272157