dumitru-daniel.popa

How To Detect Pedestrians with NXP Vision Toolbox

Discussion created by dumitru-daniel.popa Employee on Jun 20, 2018

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);
If the input image if RGB transform if to grayscale.
inImgUMatGray = nxpvt.apexcv.rgb2gray(inImgUMat);
nxpvt.imshow(inImgUMatGray);
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);

Outcomes