Frustration with 12 bit images

goettj at gmail.com goettj at gmail.com
Wed Jul 29 14:50:59 EDT 2015


Hi All,
    I am new to python and image processing in general.
    I am having trouble working with 12 bit images to do some very simple 
calculations. Here is some example code:

#!/usr/local/bin/ipython


#import Imaging Library

from PIL import Image


from skimage import io, filters

from skimage import img_as_float

from skimage import exposure


#import pylab for plotting

from pylab import *


Aim = io.imread("A.tiff")

Bim = io.imread("B.tiff")

Cim = io.imread("C.tiff")


Dim = Aim - Cim


Eim = Bim - Cim


#print min and max values of the background subtracted images

print("min %d max %d" % (Aim.min(),Aim.max()))

           print("min %d max %d" % (Bim.min(),Bim.max())) 

print("min %d max %d" % (Dim.min(),Dim.max()))

print("min %d max %d" % (Eim.min(),Eim.max()))


    Input images A,B and C are 12 bit greyscale  TIFFs.
    Output:

min 0 max 4095

           min 0 max 4095 

min 0 max 65533

min 0 max 65533

    The input image data response to min and max make good 12bit sense, but 
it is totally beyond me how I am getting 16bit responses for D and E.
    I want to understand what's happening here so that I don't get bitten 
when I try to do transformations that require me to use floating point 
math. 

thanks,
Johnny
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/scikit-image/attachments/20150729/1ccfc00c/attachment.html>


More information about the scikit-image mailing list