downscaling float32 image to uint12 via scikits.img_as_uint()
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
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-intensit...> 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@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
participants (2)
-
Sigmund -
Tony Yu