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:

--

--

Code:

function imgbgrm()

%% Developed by Selvakarna

% Image background removal version 0.01

% maile : electroselva@gmail.com //

% web url :www.sk-voxels.blogspot.in

% Chennai,India-42.

[a,b]=uigetfile(‘*’);

RGB=imread(a);

RGB=imresize(RGB,[512 512]);

while true()

imshow(RGB)

h1=imfreehand(gca);

foresub = getPosition(h1);

foregroundInd = sub2ind(size(RGB),foresub(:,2),foresub(:,1));

foregroundInd=single(foregroundInd);

hold on

h2=imfreehand(gca);

backsub = getPosition(h2);

backgroundInd = sub2ind(size(RGB),backsub(:,2),backsub(:,1));

backgroundInd=single(backgroundInd);

w = waitforbuttonpress;

if w==1

break

end

end

L = superpixels(RGB,500);

BW = lazysnapping(RGB,L,backgroundInd,foregroundInd);

maskedImage = RGB;

maskedImage(repmat(~BW,[1 1 3])) = 0;

figure;

imshow(maskedImage)

--

--

Code:

clc

clear all;

close all;

rgb=imread(‘yourimage.jpg’);

red_layer=rgb(:,:,1);

green_layer=rgb(:,:,2);

blue_layer=rgb(:,:,3);

figure,imshow(rgb);

title(‘Input RGB Image’);

figure,imshow(red_layer);

title(‘Red Layer’);

figure,imshow(green_layer);

title(‘Green_Layer’);

figure,imshow(blue_layer);

title(‘Blue_Layer’)

--

--

Selvakarna

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