Instant Background Blur using Python
Image Blur and Background Change
Image Background Blur:
Code:
import pixellib
from pixellib.tune_bg import alter_bg
change_bg = alter_bg(model_type = “pb”)
change_bg.load_pascalvoc_model(“drive/My Drive/Pixellib/Instant/xception_pascalvoc.pb”)
change_bg.blur_bg(“/images/ajith.jpg”, extreme = True, detect = “person”, output_image_name=”output/ajith_out.png”)
Input Image:
Output Image:
Background Change
Code:
import pixellib
from pixellib.tune_bg import alter_bg
import cv2
# change_bg = alter_bg(model_type = “pb”)
# change_bg.load_pascalvoc_model(“xception_pascalvoc.pb”)
output = change_bg.change_bg_img(f_image_path = input_im,b_image_path = bak_dir, detect = “person”)
cv2.imwrite(out_dir, output)
plt.imshow(output)
plt.show()
Input Image:
Output Image: