(img, x_shift, y_shift)
| 53 | |
| 54 | |
| 55 | def translate_img(img, x_shift, y_shift): |
| 56 | |
| 57 | (height, width) = img.shape[:2] |
| 58 | matrix = np.float32([[1, 0, x_shift], [0, 1, y_shift]]) |
| 59 | trans_img = cv2.warpAffine(img, matrix, (width, height)) |
| 60 | return trans_img |
| 61 | |
| 62 | |
| 63 | def get_largest_two_component_2D(img, print_info=False, threshold=None): |