Tutorial
Table Of Contents
- 1. Premise
- 2. Raspberry Pi System Installation and Developmen
- 3 Log In to The Raspberry Pi and Install The App
- 4 Assembly and Precautions
- 5 Controlling Robot via WEB App
- 6 Common Problems and Solutions(Q&A)
- 7 Set The Program to Start Automatically
- 8 Remote Operation of Raspberry Pi Via MobaXterm
- 9 How to Control WS2812 RGB LED
- 10 How to Control The Servo
- 11 How to Control DC Motor
- 12 Ultrasonic Module
- 13 Line Tracking
- 14 Make A Police Light or Breathing Light
- 15 Real-Time Video Transmission
- 16 Automatic Obstacle Avoidance
- 17 Why OpenCV Uses Multi-threading to Process Vide
- 18 OpenCV Learn to Use OpenCV
- 19 Using OpenCV to Realize Color Recognition and T
- 20 Machine Line Tracking Based on OpenCV
- 21 Create A WiFi Hotspot on The Raspberry Pi
- 22 Install GUI Dependent Item under Window
- 23 How to Use GUI
- 24 Control The WS2812 LED via GUI
- 25 Real-time Video Transmission Based on OpenCV
- 26 Use OpenCV to Process Video Frames on The PC
- 27 Enable UART
- 28 Control Your AWR with An Android Device
- Conclusion
82
●This chapter does not introduce the OpenCV part first, only introduces how to see the real-time picture
of the Raspberry Pi camera on other devices.
●First download flask-video-streaming this project in the Raspberry Pi. You can download it from Clone
on GitHub or download it on your computer and then pass it to the Raspberry Pi. The download command
using the Raspberry Pi console is as follows:
sudo git clone https://github.com/miguelgrinberg/flask-video-streaming.git
● After downloading or transmitting flask-video-streaming in the Raspberry Pi, run the app.py in
flask-video-streaming:
cd flask-video-streaming
sudo python3 app.py
●Not to use sudo python3 flask-video-streaming / app.py to run, there will be an error that * .jpeg is not
found.
●Open the browser on the device on the same local area network as the Raspberry Pi (we use Google
Chrome to test), and enter the IP address of the Raspberry Pi plus the video streaming port number: 5000 in
the address bar, as shown in the following example:
192.168.3.157:5000
● Now you can see the page created by the Raspberry Pi on the browser of your computer or mobile
phone. Note that the default screen is not from the screen of the Raspberry Pi camera, but three digital pictures
cyclically playing 1, 2, 3
● If your page can log in and is playing a picture of 1 \ 2 \ 3 numbers in a loop, it means that the
flask-related programs are running normally. Next, you can make some modifications to app.py so that it can
display the Raspberry Pi on the page in real time. Camera screen.
sudo nano app.py
●Here we use nano that comes with Raspbian to open app.py for editing in the console. Since it is just
some operations for commenting and deleting comments, there is no need to use other IDEs for editing.
●After opening the IDE, we comment out the code:
if os.environ.get('CAMERA'):
Camera = import_module('camera_' + os.environ['CAMERA']).Camera
else:
from camera import Camera
●You can comment out these lines of code by filling in # at the beginning of the code line, or you can write
a ''' at the beginning and end of the entire code to comment out a certain code. The relevant code after the
change is as follows:
# if os.environ.get('CAMERA'):
# Camera = import_module('camera_' + os.environ['CAMERA']).Camera
# else:
# from camera import Camera
or
'''
if os.environ.get('CAMERA'):
Camera = import_module('camera_' + os.environ['CAMERA']).Camera
else:
from camera import Camera