定向梯度直方图HOG描述符的最小图像尺寸是多少?

问题描述

我正在使用SVM-HOG管道在python中使用OpenCV进行行人检测。

我有很多不同大小的图像,有些较小(例如21×32),有些较大(例如127×264)。

我首先将HOG描述符定义为hog = cv2.HOGDescriptor() 当我通过调用h = hog.compute(image)计算HOG特征时,我发现当图像小于64 * 128时,描述符将无法计算特征,而只是终止程序。

原始纸张使用64 * 128尺寸的图像,但是我认为它也可以使用纵横比为1:2的图像(如果我错了,请纠正我)。

我的问题是,HOG描述符可以在其上计算特征的最小尺寸是64 * 128吗?因为我试图在将尺寸调整为32 * 64的图像上计算HOG功能,但无法使用。

谢谢。

enter image description here

for entries in os.listdir(dir_path):
    if entries.endswith(".jpg"):
        img = cv2.imread(os.path.join(test_path,entries))
        rects,scores = hog.detectMultiScale(img,winStride=(4,4),padding=(8,8),scale=1.05)
        sc = [score[0] for score in scores]
        for i in range(len(rects)):
            r = rects[i]
            rects[i][2] = r[0]+r[2]
            rects[i][3] = r[1]+r[3]
        pick =[]
        pick = non_max_suppression(rects,probs = sc,overlapThresh = 0.3)
        for (x,y,w,h) in pick:
            cv2.rectangle(img,(x,y),(w,h),(0,255,0),1)    
        cv2.imshow("A",img)

enter image description here

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)