Matlab program to remove constant back ground
Afficher commentaires plus anciens
Ian new to matlab.I need to remove the background to the image.i used below code but i did not get result. function [im]=RemoveBackground(I,Ib) I=imread('C:/Users/user/11.jpg'); figure(1),imshow(I) Ib=imread('C:/Users/user/10.jpg'); figure(2),imshow(Ib) % Ib=background image % I=input image % im=background removed image I1=rgb2gray(I); Ib1=rgb2gray(Ib); Id=imsubtract(Ib1,I1); Id=Id; Id=bwareaopen(Id,500,8); Id=imfill(Id,'holes'); Id=uint8(Id); [r c]=size(Id); for i=1:r for j=1:c if Id(i,j)==255 Id(i,j)=1; end end end im(:,:,1)=I(:,:,1).*Id; im(:,:,2)=I(:,:,2).*Id; im(:,:,3)=I(:,:,3).*Id;
figure(3),imshow(im);
end
pls help to me sir
1 commentaire
Réponses (0)
Catégories
En savoir plus sur Image Arithmetic dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!