def save_rotated_test_images():
#
# DESCRIPTION
# This function rotates the test image and create four patches of 400 * 400
# It then saves those 32 images in the test_set_images folder of each image
#
#
# Loop over all images
for i in range(1,51):
# Load image
image = mpimg.imread('test_set_images/test_'+str(i)+'/test_'+str(i)+'.png')
rotations = mk_rotations(image)
rota_count = 0
for rotation in rotations:
patches = make_4_patch(rotation)
patch_count = 0
for patch in patches:
patch = format_image(patch)
Image.fromarray(patch).save('test_set_images/test_'+str(i)+'/Test_'+str(i)+'_rota'+str(rota_count)+'_patch'+str(patch_count)+'.png')
patch_count += 1
rota_count+=1
print('Writing image ',i)
评论列表
文章目录