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
116
'''
Display image
'''
cv2.imshow("Stream", source)
'''
Generally, waitKey () should be used after imshow () to leave time for image drawing, otherwise the window will
appear unresponsive and the image cannot be displayed
'''
cv2.waitKey(1)
●When running the program, we first run RPiCam.py in the Raspberry Pi and PC.py in the PC to see the
real-time picture of the Raspberry Pi in the PC.
26 Use OpenCV to Process Video Frames on The
PC
● Due to the limited computing power of the Raspberry Pi, our OpenCV in the Raspberry Pi can only
guarantee a relatively high frame rate when implementing simple functions such as color recognition and visual
line inspection. If we need more complex machine vision functions , We need to send the video frames that
need to be analyzed to the device equipped with advanced GPU to process, and finally send the processed
results to the robot where the Raspberry Pi is located to perform the corresponding operation, and the machine
vision of the Raspberry Pi robot The ability is stronger, thus achieving more advanced functions.
●We can refer to the content of 26 to send video frames to the host computer, or refer to the content of 15
to let the Raspberry Pi put the video stream on a page, and the host computer obtains the video stream from
the page to analyze the video frame.
●The content of this chapter is based on 26. First, we open PC.py as follows:
'''
First import the required libraries
'''
import cv2
import zmq
import base64
import numpy as np
'''
Here we instantiate the zmq object used to receive the frame
Note that the port number needs to be consistent with the sender's
'''
context = zmq.Context()