def random_augment_image(image, row):
# start0_max, end0_max, start1_max, end1_max = get_bounding_boxes_positions(image, row)
# image = cv2.rectangle(image, (int(start1_max), int(start0_max)), (int(end1_max), int(end0_max)), (0, 0, 255), thickness=5)
if random.randint(0, 1) == 0:
image = return_random_crop(image, row)
else:
image = return_random_perspective(image, row)
image = random_rotate(image)
# all possible mirroring and flips (in total there are only 8 possible configurations)
mirror = random.randint(0, 1)
if mirror != 0:
image = image[::-1, :, :]
angle = random.randint(0, 3)
if angle != 0:
image = np.rot90(image, k=angle)
image = lightning_change(image)
image = blur_image(image)
return image
a03_augmentation.py 文件源码
python
阅读 37
收藏 0
点赞 0
评论 0
评论列表
文章目录