OpenCV implements the Histogram-of-Oriented-Gradients (HOG) descriptor computation functionality in the class cv2.HOGDescriptor. The same class can be used for object detection using a linear SVM model. In fact, it already has a pre-trained pedestrian detector model with weights. The model can be obtained through the method cv2.HOGDescriptor.getDefaultPeopleDetector. Objects are detected using the sliding window approach at multiple scales, using the method hog.detectMultiScale. The function returns a list of locations of detected people, and each detection score. To know more visit https://en.wikipedia.org/wiki/Histogram_of_oriented_gradients.
The following output is expected: