error in skimage.feature.hog
Damian Eads
dre25 at cam.ac.uk
Tue Jul 10 09:31:33 EDT 2012
Hi,
I'm very impressed with the progress made on scikits since its
inception in 2009. I checked out the latest skimage from Git and tried
running the HoG code on a non-square image, but it returns an error.
Moreover, if I don't convert from RGB to gray, I get a shape mismatch
error. In the latter case, a more user-friendly error message would
be more informative. Alternatively, you can either convert it to
grayscale or compute a gradient image for each channel and for each
pixel use the largest.
Here is how to reproduce the error:
In [1]: import skimage.color
In [2]: import skimage.data
** Message: pygobject_register_sinkfunc is deprecated (GstObject)
In [3]: import skimage.feature
In [4]: I=skimage.data.imread("motorbikes041.png") # see attached
In [5]: I2=skimage.color.rgb2gray(I)
In [6]: print I2.shape, I2.dtype
(150, 200) float64
In [7]: skimage.feature.hog(I2)
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
/data/repo/scikits-image/skimage/<ipython console> in <module>()
/usr/local/lib/python2.6/dist-packages/scikits_image-0.7dev-py2.6-linux-i686.egg/skimage/feature/hog.pyc
in hog(image, orientations, pixels_per_cell, cells_per_block,
visualise, normalise)
121
122 orientation_histogram[:, :, i] = uniform_filter(temp_mag,
--> 123 size=(cy, cx))[cy / 2::cy, cx / 2::cx]
124
125 # now for each cell, compute the histogram
ValueError: shape mismatch: objects cannot be broadcast to a single shape
--------------
However, if I select a square subarray, it works fine.
In [8]: x=skimage.feature.hog(I2[:128,:128])
Thanks,
Damian
--
Damian Eads, PhD
Research Associate, Machine Intelligence Laboratory
Engineering Department, University of Cambridge
Trumpington Street, Cambridge, CB2 1PZ, ENGLAND
Web: http://mi.eng.cam.ac.uk/~dre25
-------------- next part --------------
A non-text attachment was scrubbed...
Name: motorbikes041.png
Type: image/png
Size: 59756 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/scikit-image/attachments/20120710/ff700405/attachment.png>
More information about the scikit-image
mailing list