(image, label)
| 42 | return image.crop(random_region), label.crop(random_region), edge.crop(random_region) |
| 43 | |
| 44 | def randomCrop_noEdge(image, label): |
| 45 | border = 30 |
| 46 | image_width = image.size[0] |
| 47 | image_height = image.size[1] |
| 48 | crop_win_width = np.random.randint(image_width - border, image_width) |
| 49 | crop_win_height = np.random.randint(image_height - border, image_height) |
| 50 | random_region = ( |
| 51 | (image_width - crop_win_width) >> 1, (image_height - crop_win_height) >> 1, (image_width + crop_win_width) >> 1, |
| 52 | (image_height + crop_win_height) >> 1) |
| 53 | return image.crop(random_region), label.crop(random_region) |
| 54 | |
| 55 | def randomRotation(image, label, edge): |
| 56 | mode = Image.BICUBIC |
no outgoing calls
no test coverage detected