def performs_seams(): #---Original Image --- img = mpimg.imread(img_path.format(current_image)) # plt.title('Original Image') plt.axis('off') plt.imshow(img) # Display data as an image # plt.show() sc = SeamCarver(img_path.format(current_image)) # Performs seam_carving.py #---Performs Seam Carving bigger = sc.resize((sc.image.width - int((rates_num[interations] / 2))), (sc.image.height - int((rates_num[interations] / 2)))) plt.figure() # Create a new figure # plt.title('Seam Carving') plt.axis('off') plt.imshow(np.asarray(bigger.arrayObj())) #---Performs LBP performs_lbp(bigger._array, 'seam_carving') #---Performs Seam Insertion smaller = sc.resize((sc.image.width + int((rates_num[interations] / 2))), (sc.image.height + int((rates_num[interations] / 2)))) plt.figure() # plt.title('Seam Insertion') plt.axis('off') plt.imshow(np.asarray(smaller.arrayObj())) #---Performs LBP performs_lbp(smaller._array, 'seam_insertion')
def scale_down_example(): sc = SeamCarver(IMAGE_FILE) image = sc.resize(450, 390) image.save("static/jack1TestWithFaceRec.jpg") sc.debug_animation.export_gif("static/jack1TestWithFaceRec.gif")
def scale_down_example(): sc = SeamCarver(IMAGE_FILE) image = sc.resize(200, 300) image.save("static/smaller.jpg") sc.debug_animation.export_gif("static/smaller.gif")
def scale_up_example(): sc = SeamCarver(IMAGE_FILE) image = sc.resize(500, 500) image.save("static/bigger.jpg") sc.debug_animation.export_gif("static/bigger.gif")