How To Detect Pedestrians with NXP Vision Toolbox

cancel
Showing results for 
Search instead for 
Did you mean: 

How To Detect Pedestrians with NXP Vision Toolbox

559 Views
dumitru-daniel_
NXP Employee
NXP Employee

Pedestrian detection

The following livescript uses MATLAB functionalities to simulate the pedestrian detection application. The pedestrian detection algorithm is implemented using Histogram of Oriented Gradients (HOG) and a linear Support Vector Machine (SVM).
Create a People Detector object with general Classification Model.
detector = vision.PeopleDetector('ClassificationModel', 'UprightPeople_96x48', 'ClassificationThreshold', 2.5);
Read the input image which can be RGB or grayscale.
inImgUMat = nxpvt.imread('data/img_sdk.png');
if isempty(inImgUMat)
    fprintf('Failed to open input image: %s.', inImgPath);
    return;
end
nxpvt.imshow(inImgUMat);
pastedImage_3.png
If the input image if RGB transform if to grayscale.
inImgUMatGray = nxpvt.apexcv.rgb2gray(inImgUMat);
nxpvt.imshow(inImgUMatGray);
pastedImage_4.png
Run the pedestrian detector on the grayscale image.
bboxes = step(detector, inImgUMatGray.getData());
Add the resulted information on the original image.
outImgUMat = nxpvt.cv.rectangle(inImgUMat, bboxes, [255, 0 ,0], 5);
nxpvt.imshow(outImgUMat);
pastedImage_5.png
Labels (1)
0 Replies