:param img: :param src_points: :param dst_points: :param shape: :param borderMode: cv2.BORDER_CONSTANT :param borderValue: 0 # 填充黑边 :param flags: :return:
(img, src_points, dst_points, shape,
borderMode=cv2.BORDER_CONSTANT, borderValue=0, flags=cv2.INTER_LINEAR)
| 916 | |
| 917 | @staticmethod |
| 918 | def affine_image(img, src_points, dst_points, shape, |
| 919 | borderMode=cv2.BORDER_CONSTANT, borderValue=0, flags=cv2.INTER_LINEAR): |
| 920 | """ |
| 921 | |
| 922 | :param img: |
| 923 | :param src_points: |
| 924 | :param dst_points: |
| 925 | :param shape: |
| 926 | :param borderMode: cv2.BORDER_CONSTANT |
| 927 | :param borderValue: 0 # 填充黑边 |
| 928 | :param flags: |
| 929 | :return: |
| 930 | """ |
| 931 | trans_matrix = kestrel_get_similar_matrix(src_points, dst_points) |
| 932 | trans_matrix = np.concatenate((trans_matrix, [[0, 0, 1]]), axis=0) |
| 933 | return cv2.warpPerspective(img, trans_matrix, shape, |
| 934 | borderMode=borderMode, borderValue=borderValue, flags=flags), trans_matrix |
| 935 | |
| 936 | def _get_crop_region(self, img, aug_type): |
| 937 | head, neck, waist, foot = self.template_split_info |
no test coverage detected