title: Pedestrian detection with HOG descriptor and SVM understanding the python code
body: <p>I am trying to understand the code in python of pedestrian detection with HOG and SVM to accelerate it with an FPGA. </p>
  
  <p>Below the code working fine copied from a website</p>
  
  <pre class="lang-py prettyprint-override"><code>hog = cv2.HOGDescriptor()                              
  hog.setSVMDetector(cv2.HOGDescriptor_getDefaultPeopleDetector())
  
  def detector(image):
     rects, weights = hog.detectMultiScale(image, winStride=(4, 4), padding=(8, 8),scale=1.05)                                 
     for (x, y, w, h) in rects:
         cv2.rectangle(image, (x, y), (x + w, y + h), (0, 0, 255), 2)       
         cv2.rectangle(image, (x, y), (x + w, y + h), (0, 0, 255), 2)        
     rects = np.array([[x, y, x + w, y + h] for (x, y, w, h) in rects])      
     result = non_max_suppression(rects, probs=None, overlapThresh=0.7)
     return result
  
  frame = cv2.imread("/.../pedestrian2.jpg")
  result = detector(frame.copy())
  for (xA, yA, xB, yB) in result:     # draw the final bounding boxes after non-maxima supression
      cv2.rectangle(frame, (xA, yA), (xB, yB), (0, 255, 0), 2)
  img = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)      
  img_out = PIL.Image.fromarray(img)
  img_out
  </code></pre>
  
  <p>Following the tutorial 
  <a href="https://www.learnopencv.com/handwritten-digits-classification-an-opencv-c-python-tutorial/" rel="nofollow noreferrer">https://www.learnopencv.com/handwritten-digits-classification-an-opencv-c-python-tutorial/</a>
  I understand that the main function is <code>hog.compute(im,descriptor)</code> which compute the HOG features of an image, but where is this function on the first code? Is it inside of one of the functions?</p>