Hi all,
I'm currently trying to use a median filter on my data, an am getting an
error that I can't seem to debug.
I'm taking the difference of two images (both numpy.float64), scaling them
between -1 and 1, and trying to apply a median filter. My image satisfies
the conditions for being between -1 and 1 when I do the following test:
print diff.min()/dmax < -1.0 -> returns False (LHS evals to -1.0)
print diff.max()/dmax > 1.0 -> returns False (LHS evals to 0.663919388648)
The statement causing the error:
filtered = fltr.median(diff/dmax, selem)
where diff is my difference, and dmax is my scaling adjustment, selem is a
disk of radius 2
This gives me the following traceback.
Traceback (most recent call last):
File "/home/clustering.py", line 138, in image_ratio
filtered = fltr.median(diff/dmax/2.+0.5, selem, mask=m.astype(np.bool))
File
"/usr/local/lib/python2.7/dist-packages/skimage/filter/rank/generic.py",
line 369, in median
out=out, mask=mask, shift_x=shift_x, shift_y=shift_y)
File
"/usr/local/lib/python2.7/dist-packages/skimage/filter/rank/generic.py",
line 71, in _apply
out_dtype)
File
"/usr/local/lib/python2.7/dist-packages/skimage/filter/rank/generic.py",
line 34, in _handle_input
image = img_as_ubyte(image)
File "/usr/local/lib/python2.7/dist-packages/skimage/util/dtype.py", line
358, in img_as_ubyte
return convert(image, np.uint8, force_copy)
File "/usr/local/lib/python2.7/dist-packages/skimage/util/dtype.py", line
191, in convert
raise ValueError("Images of type float must be between -1 and 1.")
ValueError: Images of type float must be between -1 and 1.
Has anyone else experienced this problem before? I tried searching in the
groups, but couldn't find anything relevant.
Any help would be greatly appreciated!
Thanks,
Aman