HoG Detect MultiScale Detect

asked 2016-03-30 05:49:56 -0600

Taseer gravatar image

updated 2016-03-30 05:52:44 -0600

I am working on License Plate Detection using HoG. I am now in the testing phase. When I use

hog.detectmultiscale()

to localize the number plate, I get just a single rectangle false positive localization. Below is the code:

hog = cv2.HOGDescriptor((64,64), (16,16), (8,8), (8,8), 9)
svm = cv2.SVM()
svm.load('trained.xml')
img = cv2.imread('6.png', cv2.IMREAD_COLOR)
h = hog.compute(img) 
p = svm.predict(h)
print p
model = pickle.load(open("svm.pickle"))
hog.setSVMDetector(np.array(model)) 
rects, weights= hog.detectMultiScale(img, 1.5, (7,7),(10,10), 1,1)  

for (x, y, w, h) in rects:
   cv2.rectangle(img, (x, y), (x + w, y + h), (0, 255, 0), 2)
   print x,y,w,h

cv2.imshow('person', img)
cv2.waitKey(0) 
cv2.destroyAllWindows()

image description

Also I get the same points for every image I test.

edit retag flag offensive close merge delete

Comments

1

Well your command rects, weights= hog.detectMultiScale(img, 1.5, (7,7),(10,10), 1,1) is quite strange. It would mean that it can only find objects in the range 7x7 to 10x10 pixels. Which are completely wrong dimensions since a license plate is always longer then it is in height. How did you define those dimensions?

StevenPuttemans gravatar imageStevenPuttemans ( 2016-03-30 07:14:04 -0600 )edit

I changed the dimensions. But still no difference.

Taseer gravatar imageTaseer ( 2016-03-30 11:07:19 -0600 )edit

Can you update your code?

StevenPuttemans gravatar imageStevenPuttemans ( 2016-03-30 11:35:03 -0600 )edit

Just changed the dimensions, such as winstride, padding and scaling. Code still the same as above.

Taseer gravatar imageTaseer ( 2016-03-30 12:00:59 -0600 )edit