#!/usr/bin/env python # coding: utf-8 # # Working on multichannel images # In[1]: # import smilPython import smilPython as sp # functions using matplotlib to display images on jupyter notebooks from smilPlot import * import numpy as np # some paths binDir = "images/Bin/" grayDir = "images/Gray/" # ## Let's begin # # In[2]: # Load a RGB image im1 = sp.Image("http://smil.cmm.mines-paristech.fr/images/arearea.png") smilPlot([im1], title = ["Original Image"]) # Copy the green channel into a UINT8 image im2 = sp.Image() sp.copyChannel(im1, 1, im2) # Split RGB channels into a 3D UINT8 image with 3 slices (one for each channel) im3 = sp.Image() sp.splitChannels(im1, im3) # Perform a 2D dilation on the slices im4 = sp.Image(im3) sp.dilate(im3, im4) # And merge the result into a RGB image im5 = sp.Image(im1) sp.mergeChannels(im4, im5) smilPlot([im2, im3], title = ["Vert Channel", "Three Channel Image"]) smilPlot([im4, im5], title = ["Dilation on sliced image", "Merged Image"]) # In[ ]: