<jupyter_start><jupyter_text>Distance Transform<jupyter_code>import numpy as np
import ia870 as mm
from PIL import Image
a = mm.iaframe( np.ones((5,9),bool),WT=4,HT=2)
f4 = mm.iadist(a)
f8 = mm.iadist(a, mm.iasebox())
fe = mm.iadist(a, mm.iasebox(),'EUCLIDEAN')
print('a:\n',   a)
print('f4:\n', f4)
print('f8:\n', f8)
print('fe:\n', fe)
f_pil = Image.open('data/gear.tif')
f_pil
f = np.array(f_pil)
fn = mm.ianeg( mm.iagradm(f>0))
Image.fromarray(fn.astype(np.uint8)*255)<jupyter_output><empty_output><jupyter_text>City-block distance<jupyter_code>d4 = mm.iadist(fn)
Image.fromarray((d4 * 255 / d4.max()).astype(np.uint8))<jupyter_output><empty_output><jupyter_text>Chessboard distance<jupyter_code>d8 = mm.iadist(f, mm.iasebox())
Image.fromarray((d8 * 255 / d8.max()).astype(np.uint8))<jupyter_output><empty_output><jupyter_text>Euclidean distance<jupyter_code>de = mm.iadist(f, mm.iasebox(),'EUCLIDEAN')
Image.fromarray((de * 255 / de.max()).astype(np.uint8))<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.19556451612903225, 'fraction_numerical': 0.036290322580645164, 'mean_word_length': 7.487179487179487, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 18, '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': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '96826', 'license': 'BSD-2-Clause', 'n_tokens_mistral': 478, 'n_tokens_neox': 456, 'n_words': 58, 'path': 'ddist.ipynb', 'repo_name': 'robertoalotufo/ia870p3', 'size': '992'}