Thresholding of a color image (Three-channels RGB)

h.benoudjit at gmail.com h.benoudjit at gmail.com
Wed Sep 9 08:15:03 EDT 2015


Hi,

I have a very basic question about *thresholding* in *Scikit-image* (or 
maybe it's actually a *numpy *question).
I'm performing a simple *otsu thresholding *on an image, that I've read 
previously:


img = io.imread('flood.jpg')
print img.shape

# otsu thresholding of the image
cell2 = fig.add_subplot(1, 2, 2)
threshold = threshold_otsu(img)
thresholded_img = img > threshold

Everything is working, however I've a question concerning the thresholding 
on a multi-dimensional of the image read.
I noticed that image has been loaded as *three-channels RGB*; How is the *thresholded 
RGB image *drawn on the screen?

Knowing that the *thresholded_img *object is a *boolean numpy array *still 
having *three dimensions *(the three color axes). I mean, if it had only 
one channel, it would be easy *True=255 *and *False=0; *but in the case of 
a *3-channels image*, is a *logical-AND *performed on the *RGB-image *to 
flatten it to a *single-channel image*?

Thanks.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/scikit-image/attachments/20150909/a547729a/attachment.html>


More information about the scikit-image mailing list