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
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
Chrome to
test), and enter the IP address of the Raspberry Pi plus the video streaming port
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
●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
flask-video-streaming
Camera
this project in the Raspberry Pi. You can download it from Clone
(we use Google
number: 5000
in
Need help?
Do you have a question about the AWR Adeept Wheeled Robot and is the answer not in the manual?