How to copy one image to another (blank) pixel by pixel?

조회 수: 29 (최근 30일)
Laryssa Seabra
Laryssa Seabra 2013년 6월 26일
Xc = imread('IM1.jpg');
tam = size(Xc)
sizex = tam(1);
sizey = tam(2);
blank = ones(sizex,sizey,3);
for i=1:sizex
for j=1:sizey
for d=1:3
blank(i,j,d)=Xc(i,j,d);
end
end
end
imshow(blank);
why isn't it working? any ideas?

채택된 답변

David Sanchez
David Sanchez 2013년 6월 26일
Xc = imread('Arinaga+29+de+mayo+de+2013-3.jpg');
[sizex sizey sizez]= size(Xc);
blank = zeros(sizex,sizey,sizez);
for i=1:sizex
for j=1:sizey
for d=1:3
blank(i,j,d)=Xc(i,j,d);
end
end
end
%%%%%the new addition
image(uint8(blank));
  댓글 수: 2
Laryssa Seabra
Laryssa Seabra 2013년 6월 26일
that's it! thanks a lot!
Sean de Wolski
Sean de Wolski 2013년 6월 26일
Alternatively, a more general case:
blank = zeros(sizex,sizey,sizez,class(Xc))

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

추가 답변 (1개)

Jonathan Sullivan
Jonathan Sullivan 2013년 6월 26일
You should try this:
Xc = imread('IM1.jpg');
blank = Xc;
imshow(blank);

카테고리

Help CenterFile Exchange에서 Geometric Transformation and Image Registration에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by