필터 지우기
필터 지우기

mask picture on other picture

조회 수: 2 (최근 30일)
ahmed
ahmed 2014년 5월 17일
댓글: ahmed 2014년 5월 17일
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);

답변 (1개)

Image Analyst
Image Analyst 2014년 5월 17일
Not sure I want to answer now, with your history of deleting your past questions and replies.
  댓글 수: 1
ahmed
ahmed 2014년 5월 17일
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

댓글을 달려면 로그인하십시오.

Community Treasure Hunt

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

Start Hunting!

Translated by