SMIL  1.0.4
multichannel_operations.py
1 from smilPython import *
2 
3 # Load a RGB image
4 im1 = Image("https://smil.cmm.minesparis.psl.eu/images/arearea.png")
5 im1.show()
6 
7 # Copy the green channel into a UINT8 image
8 im2 = Image()
9 copyChannel(im1, 1, im2)
10 im2.show()
11 
12 # Split RGB channels into a 3D UINT8 image with 3 slices (one for each channel)
13 im3 = Image()
14 splitChannels(im1, im3)
15 im3.show()
16 
17 # Perform a 2D dilation on the slices
18 im4 = Image(im3)
19 dilate(im3, im4)
20 im4.show()
21 
22 # And merge the result into a RGB image
23 im5 = Image(im1)
24 mergeChannels(im4, im5)
25 im5.show()
RES_T copyChannel(const Image< MCT1 > &imIn, const UINT &chanNum, Image< T2 > &imOut)
copyChannel() - Copy a channel of multichannel image into a single channel image
Definition: DImageArith.hpp:1827
RES_T splitChannels(const Image< MCT1 > &imIn, Image< T2 > &im3DOut)
splitChannels() - Split channels of multichannel image to a 3D image with each channel on a Z slice
Definition: DImageArith.hpp:1892
RES_T mergeChannels(const Image< T1 > &imIn, Image< MCT2 > &imOut)
mergeChannels() - Merge slices of a 3D image into a multichannel image
Definition: DImageArith.hpp:1925
RES_T dilate(const Image< T > &imIn, Image< T > &imOut, const StrElt &se=DEFAULT_SE, const T borderVal=ImDtTypes< T >::min())
dilate() - Morphological grayscale dilation
Definition: DMorphoBase.hpp:65