<jupyter_start><jupyter_text>mmdsoilDetect fractures in soil.  DescriptionThe input-image is a gray-scale image of soil that has some thin fractures. These fractures are detected by the application of the top-hat and area open operators.<jupyter_code>import numpy as np
from PIL import Image
import ia870 as ia
import matplotlib.pyplot as plt
print(ia.__version__)<jupyter_output>ia870 Python Morphology Toolbox version 0.8 25th Aug 2014 - in progress - migrating to Python 3<jupyter_text>ReadingThe gray-scale image of the ruler is read.<jupyter_code>a_pil = Image.open('../data/soil.tif').convert('L')
a = np.array (a_pil)

(fig, axes) = plt.subplots(nrows=1, ncols=1,figsize=(10, 5))
axes.set_title('a')
axes.imshow(a, cmap='gray')
axes.axis('off')<jupyter_output><empty_output><jupyter_text>Fractures enhancementThe fracture lines are enhanced by the close top-hat operator.<jupyter_code>b = ia.iacloseth(a,ia.iasebox(2))

(fig, axes) = plt.subplots(nrows=1, ncols=1,figsize=(10, 5))
axes.set_title('b')
axes.imshow(b, cmap='gray')
axes.axis('off')<jupyter_output><empty_output><jupyter_text>Gray-scale area openSmall connected bright regions are removed by the gray-scale area open operator. Note the connectivity used ( mmsebox : 8-connected).<jupyter_code>c = ia.iaareaopen(b,80,ia.iasebox())

(fig, axes) = plt.subplots(nrows=1, ncols=1,figsize=(10, 5))
axes.set_title('c')
axes.imshow(c, cmap = 'gray')
axes.axis('off')<jupyter_output><empty_output><jupyter_text>ThresholdingThe fracture lines are detected. This threshold is very robust.<jupyter_code>d = ia.iathreshad(c,15)

(fig, axes) = plt.subplots(nrows=1, ncols=1,figsize=(10, 5))
axes.set_title('d')
axes.imshow(d, cmap='gray')
axes.axis('off')<jupyter_output><empty_output><jupyter_text>Final displayOverlay of the fracture lines over the original image.<jupyter_code>(fig, axes) = plt.subplots(nrows=1, ncols=1,figsize=(10, 5))
axes.set_title('a')
axes.imshow(ia.iagshow(a, d).transpose (1, 2, 0))
axes.axis('off')<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.14058618976651763, 'fraction_numerical': 0.024341778440139097, 'mean_word_length': 7.120967741935484, 'pattern_counts': {'":': 0, '<': 24, '<?xml version=': 0, '>': 24, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '6', 'dir': 'jupyter-structured-clean-dedup', 'id': '91776', 'license': 'BSD-2-Clause', 'n_tokens_mistral': 811, 'n_tokens_neox': 751, 'n_words': 170, 'path': 'notebooks/dsoil.ipynb', 'repo_name': 'rdenadai/ia870p3', 'size': '2013'}