0
我試圖使用像素複製方法縮放圖像。下面的代碼有一個「警告:圖片太大,不適合屏幕顯示」。我不知道這是否與輸出有關。輸出完全顯示其他內容。這裏是一個鏈接到輸出... https://www.dropbox.com/s/ixl80jwutra8e1a/Q.PNG使用像素複製的Matlab縮放
Img = handles.Image;
temp = double(imread(Img));
b=temp;
[m,n,colormap]=size(b);
%If RGB Image is given at Input
if colormap==3
x=b(:,:,1);
y=b(:,:,2);
z=b(:,:,3);
end
k=1; %Counter for Row and
l=1; %Column replication
f=2; %Replica factor
for i=1:m %Loop for reading row and
for t=1:f %Row replication
for j=1:n %Loop for reading column and
for t=1:f %Column replication
if colormap==3 %If Image is RGB
c1(k,l)= x(i,j);
c2(k,l)= y(i,j);
c3(k,l)= z(i,j);
else %If Image is grayscale
c(k,l)=b(i,j);
end
l=l+1;
end
end
l=1;
k=k+1;
end
end
if colormap==3 %If Image is RGB
c(:,:,1)=c1;
c(:,:,2)=c2;
c(:,:,3)=c3;
end
axes(handles.axes2);
imshow(c);
到底是什麼問題,有什麼辦法呢?
只是一個快速的外觀,但乍一看好像你正在做的'L = 1;'錯地方 - 不應該在't'循環之後? –