from IPython.display import Image
Image(filename='Figs_ipandcg_2014/2014_Session_3.png')
The Python Imaging Library (PIL) provide us with additional 2D image processing algorithms. PIL consists of several modules. To become acquainted with its capabilities go throuout tutorial; additional exercises you can find here (subsections 2010 Sessions 1-3).
Import functionality of PIL as Image.
import Image
Load image from file into variable 'im'.
im = Image.open('images_2014/FluorescentCells.jpg')
If you receive error message:
AttributeError: 'NoneType' object has no attribute 'bands'
you have to load data manually. Add this line:
im.load()
im.load()
print im.format, im.size, im.mode
im.show()
Split RGB imiage into 3 separate bands.
r,g,b = im.split()
Based on 2010 IPandCG tutorial - Part 1 and PIL handbook do following operations:
Perform various filtration types of the im variable. Apply filtration for several parameter values for each filtration. Note the results for values bigger than 1 and smaller than 1. Read additional information about image filtering and edge detection (slides by prof. Paweł Strumiłło and prof. Michał Strzelecki).
ImageEnhance Module (see 2010 IPandCG tutorial - Part 2)
ImageFilter Module
Compese your own averaging filter based on slides. Use 3 x 3 mask. Propose two versions of filter:
Load image "blood1.bmp". Perform image thresholding e.g. with thresh equal to 126. This is not optimal threshold value. Try to find better one. Theoretical background of thresholding you can find here (by prof. Paweł Strumiłło, prof. Michał Strzelecki).
Browse capabilities of morphological opearation of ndimage library. Theory on mathematical morphology is provided in lecture. On thresholded, binary image perform some operations:
Write your own function that perform
Compare with 2010 IPandCG tutorial - Part 3.