In [1]:
import imageio.v2 as imageio
import numpy as np
import matplotlib.pyplot as plt
def plot_image_from_array(image_array, title=''''Image''''):
plt.imshow(image_array, cmap=''''gray'''')
plt.axis(''''off'''') # Hide axes
plt.title(title)
plt.show()
In [2]:
#!pip install rembg
In [3]:
from PIL import Image, ImageFilter
from rembg import remove
im = Image.open("sharbat_gula2.jpg")
im_new = remove(im)
plot_image_from_array(im, title=''''Original'''')
plot_image_from_array(im_new, title=''''No background'''')