Reputation: 27236
I'm working on some object detection code, however my objects don't have a fixed size, so;
skimage.feature.hog(obj)
doesn't give me equal length vectors(since it uses fixed sized cells), and therefore I can't use learning algorithms on them.
So, I tried dynamically assigning HOG feature length:
from __future__ import division
def describe_object(obj, div=8):
width, height = obj.shape
f = skimage.feature.hog(obj, normalise=True,
pixels_per_cell=(height//div, width//div))
return f
But, now it mostly gives 2916
sized vectors, but sometimes it gives longer vectors (like 3402
elements long) too.
I believe this happens when some specific ratio between bin size and object's shape, but don't know why exactly.
Can you help me?
Upvotes: 0
Views: 938
Reputation: 3852
You could scale the images to a fixed size, before calculating the HOG features.
Upvotes: 3