: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)
| 612 | |
| 613 | @staticmethod |
| 614 | def affine_image(img, src_points, dst_points, shape, |
| 615 | borderMode=cv2.BORDER_CONSTANT, borderValue=0, flags=cv2.INTER_LINEAR): |
| 616 | """ |
| 617 | |
| 618 | :param img: |
| 619 | :param src_points: |
| 620 | :param dst_points: |
| 621 | :param shape: |
| 622 | :param borderMode: cv2.BORDER_CONSTANT |
| 623 | :param borderValue: 0 # 填充黑边 |
| 624 | :param flags: |
| 625 | :return: |
| 626 | """ |
| 627 | trans_matrix = kestrel_get_similar_matrix(src_points, dst_points) |
| 628 | trans_matrix = np.concatenate((trans_matrix, [[0, 0, 1]]), axis=0) |
| 629 | return cv2.warpPerspective(img, trans_matrix, shape, |
| 630 | borderMode=borderMode, borderValue=borderValue, flags=flags), trans_matrix |
| 631 | |
| 632 | def _get_crop_region(self, img, aug_type): |
| 633 | head, neck, waist, foot = self.template_split_info |
no test coverage detected