(self, img)
| 44 | self.pad_color = pad_color |
| 45 | |
| 46 | def get_transform(self, img): |
| 47 | shape = img.shape[:2] # shape = [height, width] |
| 48 | ratio = min(float(self.height) / shape[0], float(self.width) / shape[1]) |
| 49 | new_shape = (round(shape[1] * ratio), round(shape[0] * ratio)) # new_shape = [width, height] |
| 50 | dw = (self.width - new_shape[0]) / 2.0 # width padding |
| 51 | dh = (self.height - new_shape[1]) / 2.0 # height padding |
| 52 | top, bottom = round(dh - 0.1), round(dh + 0.1) |
| 53 | left, right = round(dw - 0.1), round(dw + 0.1) |
| 54 | dst_constant = (top, bottom, left, right) |
| 55 | padding = (dw, dh) |
| 56 | return LetterBoxTransform(new_shape, dst_constant, ratio, padding, color=self.pad_color) |
| 57 | |
| 58 | |
| 59 | class CenterAffine(Augmentation): |
nothing calls this directly
no test coverage detected