저는 matlab를 처음 사용했습니다. 함수를 작성했습니다. 내가이 오류를 얻을위한 내가 처음에 작업 공간 내 기능을 실행하면루프에 대한 MATLAB 오류 때문에 "범위를 벗어난 인덱스에 액세스하려고했습니다 ..."
??? Attempted to access XX(461,:); index out of bounds because
size(XX)=[460,440,3].
Error in ==> FOH_Zoom at 10
XX(j,:)=(XX(2*j-1,:)+XX(2*j+1,:))/2;
을이 제 기능입니다 :
문제가 무엇인지function XX = FOH_Zoom(img)
X = ones(size(img)); %make a matrix of ones as size as image
XX=imresize(X,2); %make size of matrx double
[a,b]=size(X); %get the size of matrix
XX(1:2:end,1:2:end)=img(:,:); % fill odd rows and columns with original image data
[m,n]=size(XX);
for j=1:m-1
XX(j,:)=(XX(2*j-1,:)+XX(2*j+1,:))/2;
end
for i=1:n
XX(:,i)=(XX(:,2*i-1)+XX(:,2*i+1))/2;
end
imshow(XX); % show image
title([num2str(m),' *** ',num2str(n)]);
end
, 당신이 생각하십니까? 정말 도움이 어떤 도움을 안부.
행렬 'img'이 3D (즉, RGB 이미지) 인 경우 코드가 깨집니다. – Amro
답장을 보내 주셔서 감사합니다.하지만 이미지가 RGB가 아니므로 회색 음영입니다. – delkook