I am trying to resize and rotate an image using octave. However when I try get the following error: Index exceeds matrix dimension... Anyone see what I am doing wrong?
I=imread('c:/cg/img/Lena.jpg'); % 128 x 128 uint
I2=rgb2gray(I);
alfa=.5;
for i=1:round(256*alfa)
for j=1:round(256*alfa)
is=round(i/alfa);
js=round(j/alfa);
if (is<1) is=1; endif;
if (js<1) js=1; endif;
I3(i,j)=I2(is,js);
end
end
imwrite(I3,"c:/cg/lenax0.5.jpg","jpg");
for i=1:256
for j=1:256
I4(i,j)=I3(257-j,i); %90
I5(i,j)=I3(257-i,257-j); %180
I6(i,j)=I3(j,257-i); %270
end
end
I7=[I3 I4; I5 I6];
imshow(I7);
imwrite(I7,"c:/cg/lena_rotate_90_180_270.jpg","jpg");