Function
Add_Padding
(image, top, bottom, left, right, color=(255,255,255))
Source from the content-addressed store, hash-verified
| 16 | from utils.label2tensor import strLabelConverter |
| 17 | |
| 18 | def Add_Padding(image, top, bottom, left, right, color=(255,255,255)): |
| 19 | if(not isinstance(image,np.ndarray)): |
| 20 | image = np.array(image) |
| 21 | padded_image = cv2.copyMakeBorder(image, top, bottom,left, right, cv2.BORDER_CONSTANT, value=color) |
| 22 | return padded_image |
| 23 | |
| 24 | def fixkeyCh(key): |
| 25 | return ''.join(re.findall("[㙟\u4e00-\u9fa50-9a-zA-Z#%().·-]",key)) |
Tested by
no test coverage detected