scikits-image/scikits-image — pull request #234 by bdholt1 (2012-07-24 09:55:54+00:00)
Title: [MRG] Fix broadcasting error (revised PR)

This is a second PR to replace #213 after re-forking my repo to scikits-image.

In response to a bug submitted on the mailing list by Damian, this PR corrects the broadcasting error.

The problem stems from the fact that in his image (150,200) n_cellsx = 18
n_cellsx = int(np.floor(150 // 8)) # number of cells in x

but
uniform_filter(temp_mag, size=(cy, cx))[cy / 2::cy, cx / 2::cx]
results in an object of (19, 25) which cannot be broadcast to one of (18,25).

The reason is that there are 19 steps from 4:150:8. This is easily resolved by restricting the upper range to ensure that the view is of the right shape.

This gist will test it
```python
import skimage.color
import skimage.data
import skimage.feature

if __name__=="__main__":

I=skimage.data.imread("motorbikes041.png") # see attached
I2=skimage.color.rgb2gray(I)
print I2.shape, I2.dtype
skimage.feature.hog(I2)
```