OpenCV Pedestrian Detection Application Solution Based on MYIR's T527 Development Board

2025-06-17

107
In this article, we will introduce the testing of OpenCV pedestrian detection solution based on MYIR's MYD-LT527 Development Board (based on Allwinner T527 processor).
MYD-LT527 Development Board Top-view
MYD-LT527 Development Board Bottom-view
1. Software Environment Installation
1.1 Install OpenCV
sudo apt-get install libopencv-dev python3-opencv
1.2 Install pip
sudo apt-get install python3-pip
2. Introduction to Pedestrian Detection
The key steps in building the pedestrian detector using HOG and SVM include:
Prepare Training Dataset: the training dataset should contain large number of positive samples (pedestrian images) and negative samples (non-pedestrian images).
Compute HOG Feature: for each image, compute HOG feature. HOG feature is a one-dimensional vector where each element represents the gradient intensity at a specific location and direction in the image.
Train SVM Classifier: using the HOG feature as input, train the SVM classifier which will learn to distinguish between pedestrians and non-pedestrians.
Evaluate the Model: evaluate the trained model using the test dataset. Calculate metrics such as accuracy, recall and F1 score of the model.
3. Code Implementation
import cv2
import time
def detect(image,scale):
imagex=image.copy( ) # Make a copy of the function internally so that each function runs on a different image;
hog = cv2.HOGDescriptor( ) # Initialization direction gradient histogram description;
#Set up the SVM as a pre-trained pedestrian detector;
hog.setSVMDetector(cv2.HOGDescriptor_getDefaultPeopleDetector( ));
# Invoke the function detectMultiScale to detect the corresponding border of the pedestrian;
time_start=time.time( );# Record start time;
# Access (rectangular boxes corresponding to pedestrians, corresponding weights);
(rects, weights) = hog.detectMultiScale(imagex,scale=scale);
time_end = time.time( ) # Record end time;
# Draw each rectangular box;
for(x, y, w, h) in rects:
cv2.rectangle(imagex, (x, y), (x+w, y+h), (0, 0, 255), 2)
print("sacle size:", scale, ",time:", time_end-time_start)
name=str(scale)
cv2.imshow(name; imagex) # Show original effect
image = cv2.imread("back.jpg")
detect(image,1.01)
detect(image,1.05)
detect(image,1.3)
cv2.waitKey(0)
cv2.destroyAllWindows( )
4. Practical Operations
2025-06-23
RZ/G2L-Based MYD-YG2LX System Startup Time Optimization Application Notes
This article introduces a debugging case for optimizing system boot time based on the MYD-YG2LX development board.
2025-06-23
How to Implement an Environmental Monitoring System on the STM32MP257 Board
This article introduces how to use MYIR's MYD-LD25X development board (MYIR's STM35MP257-based development board) to implement a simple environmental monitoring system.
2024-09-23
Ethernet Driver Porting Guide Based on MYIR's NXP i.MX.93 Development Board
Ethernet Driver Porting Guide Based on MYIR's NXP i.MX.93 Development Board MYD-LMX9X
2024-08-16
QT Development Guide for NXP i.MX 93 Development Board by MYIR
1. OverviewQt is a cross-platform graphical application development framework that is applied to devices and platforms of different sizes, while providing different license versions for users to choos
2024-06-16
Application Notes | Setting up OTA Functionality on MYIR's NXP i.MX 93 Development Board
1. OverviewOver-the-Air Technology (OTA) is a technology that enables remote management of mobile terminal equipment and SIM card data via the air interface of mobile communication. In this article, O
2024-06-13
Ubuntu System Porting Guide for Renesas RZ/G2L-based Remi Pi
1. OverviewLinux system platform has a variety of open source system building frameworks, which facilitate the developer in building and customizing embedded systems. Currently, some of the more commo
2024-05-22
Boosting the Power Industry: Notes on Porting the IEC61850 Protocol to the MYD-YF13X
Part 1: OverviewIEC 61850 is an international standard for communication systems in Substation Automation Systems (SAS) and management of Decentralized Energy Resources (DER). Through the implementati
2024-02-04
Next-Generation AM62x CPU for Embedded Solutions
Combining MYIR's MYC-YM62X CPU Module and MYD-YM62X Development Board, here we share with you TI's new generation CPU - AM62x used for embedded solutions.
2023-12-07
Developing AIGC using DNN through MYIR's Renesas RZ/G2L based Board
This evaluation report is provided by developer "ALSET" from MYIR’s forum. This article will introduce how to develop AIGC image using Deep Neural Networks (DNN) through MYIR’s Renesas RZ/G2