def _pad_image(self, image, joint):
height, width, _ = image.shape
shape = np.array((width, height))
residual = (self.image_size - shape).clip(0, self.image_size)
left, top = residual/2
right, bottom = residual - residual/2
padded_image = cv2.copyMakeBorder(
image, top, bottom, left, right, cv2.BORDER_CONSTANT, value=0)
moved_joint = joint + (left, top, 0)
return padded_image, moved_joint
评论列表
文章目录