Effacer les filtres
Effacer les filtres

mask picture on other picture

2 vues (au cours des 30 derniers jours)
ahmed
ahmed le 17 Mai 2014
Commenté : ahmed le 17 Mai 2014
i had image
after some filters & operation extract the first object and become
i get this object by give its pixel to it like under
this is the code
the question can i use the image of dog (object) as a mask on the original image to crop the dog only from the original image >>>>> to use it to correlation
clc;
close all;
fontSize = 14;
[name1,path1]=uigetfile('*.*');
rgbImage=imread([path1,name1]);
figure,
subplot(2, 3, 1);
imshow(rgbImage);
text1 = sprintf('Original Color Image');
title(text1, 'FontSize', fontSize);
red=rgbImage(:,:,1);
g=rgbImage(:,:,2);
b=rgbImage(:,:,3);
templet1=rgbImage;
i1 = rgb2gray(rgbImage);
i11 = imadjust(i1);
i2 = edge(i11,'canny',0.4);
se = strel('square',2);
i22 = imclose(i2,se);
i3 = imdilate(i22,se);
i4 = imfill(i3,'holes');
BW2 = bwareaopen(i4, 1620);
d=medfilt2(BW2,[3 3]); %median filter
e=imclearborder(d, 4);
[L,NUM]=bwlabel(e,4);
object1=(L==1);
subplot(2, 3, 2);
imshow(object1);
patt=zeros([h w]);
newr=uint8(zeros([h w]));
newg=uint8(zeros([h w]));
newb=uint8(zeros([h w]));
[r,c]=find(L==1);
patt(min(r):max(r),min(c):max(c))=object1(min(r):max(r),min(c):max(c));
ind=find(patt);
newr(ind)=red(ind);
newg(ind)=g(ind);
newb(ind)=b(ind);
templet(:,:,1)=newr;
templet(:,:,2)=newg;
templet(:,:,3)=newb;
subplot(2, 3, 3),imshow(templet);

Réponses (1)

Image Analyst
Image Analyst le 17 Mai 2014
Not sure I want to answer now, with your history of deleting your past questions and replies.
  1 commentaire
ahmed
ahmed le 17 Mai 2014
yes i know I'm sorry but i delete it for personal things i want to delete full question but i couldn't so i delete the all answer I'm really sorry

Connectez-vous pour commenter.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by