downscaling float32 image to uint12 via scikits.img_as_uint()

Tony Yu tsyu80 at gmail.com
Sat Feb 25 11:46:33 EST 2012


Hi Siggi,

It sounds like you may have a float32 image with values outside of the
assumed range of 0--1 (see user
guide<http://scikits-image.org/docs/dev/user_guide/data_types.html>
).

A couple of solutions; unfortunately, both require you to run skimage from
github (there's been a lot of activity since the last release):
* Assuming you have float values outside the range, use
`rescale_intensity`<http://scikits-image.org/docs/dev/api/skimage.exposure.html#rescale-intensity>
to
rescale your image to the correct range. (You can also do this manually
too, of course).
* Use `threshold_otsu`<http://scikits-image.org/docs/dev/api/skimage.filter.html#threshold-otsu>
from
skimage instead of mahotas.

Also, all conversion functions should now (i.e. github master) raise an
error when given a float image outside of the 0--1 range, so this shouldn't
happen in the future.

Best,
-Tony


On Sat, Feb 25, 2012 at 11:15 AM, Sigmund <siggin at gmail.com> wrote:

> Hi!
> its me again...
> I'm using the scikits.img_as_uint() function for downscaling a float32
> gray scale image. The downscaling is needed to use the
> mahotas.thresholding.otsu() function.
> I noticed that the img_as_uint() function is not scaling the intensity.
> It looks like that in areas where the intensity is exceeding the uint16
> space, it shows wrong values. Does it show 0+the exceeding part?
> Is the behavior volitional ?
>
> Siggi
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/scikit-image/attachments/20120225/da50579d/attachment.html>


More information about the scikit-image mailing list