run ../../common.ipynb
Populating the interactive namespace from numpy and matplotlib
# import filters from scikit-image
from skimage import filter
image = imread('../mp.tif')
optimal_threshold = filter.threshold_otsu(image)
mask = image < optimal_threshold
gimshow(mask);
Show only regions above threshold
image[image<optimal_threshold] = 0
imsave('mp_otsu_above.png', 255-image) #invert image also
from IPython.display import Image
Image('mp_otsu_above.png') # inlucde whole image in notebook
Now with laplace -> then otsu
image = imread('../mp.tif')
laplace = ndimage.laplace(image)
optimal_threshold_laplace = filter.threshold_otsu(laplace)
image[image < optimal_threshold_laplace] = 0
imsave('mp_otsu_laplace_above.png', 255-image) #invert image
Image('mp_otsu_laplace_above.png')