1

I'm working on improving the efficiency for the detection of humans in image frames. Instead of applying the HOG descriptor on the whole image, I plan to only use the HOG descriptor on extracted regions of interest (regions that have motion using a mask obtained from background subtraction).

When using detectMultiScale(...) from the HOG descriptor provided by OpenCV2, the program returns a segmentation fault (Python 2.7 and cv2.HOGDescriptor_getDefaultPeopleDetector() for the SVM). A lot of the extracted regions from the image are of different aspect ratios. Applying the HOG Descriptor on the whole image works fine but it segfaults on certain regions.

Segmentation fault: 11

Why is this happening? Are there restrictions on the width and height of the input images to the descriptor?

The documentation doesn't say anything about that http://www.swarthmore.edu/NatSci/mzucker1/opencv-2.4.10-docs/modules/gpu/doc/object_detection.html

(rects, weights) = hog.detectMultiScale(region, 
                                        winStride=(4, 4), 
                                        padding=(8, 8), 
                                        scale=1.05)
rects = np.array([[x, y, x + w, y + h] for (x, y, w, h) in rects])
pick = non_max_suppression(rects, probs=None, overlapThresh=0.65)

region is the image slice extracted from the original image. I thought about trying to catch the segmentation fault like one could catch an error (How can I "catch" a seg fault while importing an F2Py module?) but that doesn't seem to work.

Community
  • 1
  • 1
N. Jakins
  • 11
  • 2

0 Answers0