1234567891011121314151617 |
- '''Created Aug 21, 2021 deeejas'''
- import cv2
- def im_clean(img_path, dst_path):
- # read image
- img = cv2.imread(img_path)
- img = img[270:600, 740:1060]
- scale_percent = 220 # percent of original size
- width = int(img.shape[1] * scale_percent / 100)
- height = int(img.sthape[0] * scale_percent / 100)
- dim = (width, height)
- # resize image
- img = cv2.resize(img, dim, interpolation=cv2.INTER_AREA)
- # improve quality
- dst = cv2.detailEnhance(img, 10, 1)
- cv2.imwrite(dst_path, dst)
|