This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import numpy as np | |
| import cv2 | |
| from scipy import ndarray | |
| import skimage as sk | |
| from skimage import transform | |
| from skimage import util | |
| import random | |
| def random_noise(image_array: ndarray): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ''' | |
| Augment IAM dataset: | |
| reduce_line_thickness, --> Reduce the line thickness | |
| random_noise, --> Introduce random noise on image | |
| blur_filter, --> Blur the image | |
| random_stretch --> Random stretch to image | |
| ''' | |
| def reduce_line_thickness(image: ndarray): | |
| kernel = np.ones((4,4), np.uint8) | |
| return cv2.dilate(image, kernel, iterations=1) |