<jupyter_start><jupyter_text>Import Modules<jupyter_code>import cv2
import numpy as np
from google.colab.patches import cv2_imshow<jupyter_output><empty_output><jupyter_text>Load Image<jupyter_code>#image is loaded using cv2.imread() method,here flag is 0 ,specifies to load image in GRAYSCALE mode.
'''
Syntax:
  cv2.imread(path,flag)
Parameters:
  path: string representing the path of the image to be read.
  flag: specifies the way in which image should be read.
'''
img=cv2.imread("input.jpg",0)
cv2_imshow(img)<jupyter_output><empty_output><jupyter_text>Apply Erosion<jupyter_code># To perform Erosion,cv2.erode() method is used.
'''
Syntax:
  cv2.erode( src, kernel, iterations )
Parameters:
  src: Input image that is to be eroded.
  kernel: the matrix with which input image is convolved
  iterations: It determines how much you want to erode the given image.
'''
kernel=np.ones((5,5),np.uint8)
Eroded=cv2.erode(img,kernel,iterations=1)<jupyter_output><empty_output><jupyter_text>Display the Eroded image<jupyter_code>cv2_imshow(Eroded)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.10325581395348837, 'fraction_numerical': 0.014883720930232559, 'mean_word_length': 6.911764705882353, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, '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': '477508', 'license': 'MIT', 'n_tokens_mistral': 395, 'n_tokens_neox': 387, 'n_words': 100, 'path': 'ImageErosion/Image_Erosion.ipynb', 'repo_name': 'noviicee/Image-Processing-OpenCV', 'size': '1075'}