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:

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Selvakarna

IMAGING Research, Pixel Analysis ,AI,ML,DL Research and Development