def proc_fit(name, k): im = cv2.imread(name) img = create_fixed_image_shape(bbox(im), out_shape, random_fill=False, mode='fit') new_name = name.replace(in_folder, out_folder) cv2.imwrite(new_name, img) if k % 10 == 0: print "Completed %d." % k
def proc(name, k): im = cv2.imread(name) imre = create_fixed_image_shape(bbox(im), temp_shape, random_fill=False, mode='fit') imgs = data_augmentation(imre, frame_size=out_shape) for i in range(len(imgs)): img = imgs[i] imgs.append(img[:, ::-1, :]) for i, img in enumerate(imgs): new_name = name.replace(in_folder, out_folder) new_name = new_name.replace('.jpeg', '_%d.jpeg' % i) cv2.imwrite(new_name, img) if k % 10 == 0: print "Completed %d." % k