0
Arnold Transform 용 matlab 코드를 작성했습니다. 그것을 실행에 나는 다음과 같은 오류가 발생하고, 그러나Arnold Transform Matlab : 인덱스가 범위를 벗어남 (오류)
clc;
clear all;
close all;
[FileName,PathName] = uigetfile('*.jpg','Select the Cover Image');
file = fullfile(PathName,FileName);
disp(['User selected : ', file]);
cover = imresize(imread(file),[128 128]);
cover = double(cover);
if ndims(cover) ~= 3
msgbox('The cover image must be colour');
break;
end
figure;
subplot(1,2,1);
imshow(uint8(cover),[]);
title('Cover image');
%num specifies the number of Iterations for the Arnold Transform
num = input('\nEnter the value of num: ');
[m n] = size(cover);
out = zeros(m);
n = n - 1;
for j=1:num
for y=0:n
for x=0:n
p = [ 1 1 ; 1 2 ] * [ x ; y ];
out(mod(p(2), m)+1, mod(p(1), m)+1) = cover(y+1, x+1);
% newcover(row,col)=cover((mod(nrowp,rown)+1),(mod(ncolp,coln)+1));
end
end
cover = out;
end
imshow(newcover)
figure(2)
: 나는 다음 코드 줄을 사용하고
??? Attempted to access cover(129,1); index out of bounds because
size(cover)=[128,128,3].
Error in ==> main at 28
out(mod(p(2), m)+1, mod(p(1), m)+1) = cover(y+1, x+1);
은 누군가가 그것을 밖으로 정렬 도와 주시겠습니까? 감사. 세 가지 차원을 설명하기 위해 size
전화를 변경
참고 : Matlab이 '1'에서 계산을 시작하기 때문에 Matlab에서 인덱스를 '0'으로 시작할 때주의해야합니다. – Schorsch
@Schorsch 절대적으로. 나는이 경우'cover (y + 1, x + 1) '때문에 의도적이라고 가정했다. – beaker
@beaker ..하지만 이미 루프를 시작하기 전에 n의 값을 1로 줄입니다 .. 코드를 변경하여 u가 물어 보았습니다 .. 나는 같은 오류가 발생했습니다 .. 나는 여러 가지 다른 것들을 시도했습니다. 그러나 나는 그것을 밖으로 분류 할 수 없다. – competesingh