Thursday, June 19, 2008

Assign 8, Q5

Here I used the nearest neighbour approximation function that I used in assignment #7 and applied it 4 times (f=0.8, 0.6, 0.4, 0.2) the large image just remains the same at f=1 or the original sized image.

Then layered the pics one on top of the other.

octave:10> a=imread("start.jpg");
octave:11> b=shrinkimg(a,0.8);
octave:12> c=shrinkimg(a,0.6);
octave:13> d=shrinkimg(a,0.4);
octave:14> e=shrinkimg(a,0.2);
octave:15> a1=double(a)/255;
octave:16> b1=double(b)/255;
octave:17> c1=double(c)/255;
octave:18> d1=double(d)/255;
octave:19> e1=double(e)/255;
octave:20> a1(52:459,78:690,:)=b1;
octave:21> a1(103:408,155:613,:)=c1;
octave:22> a1(155:357,231:536,:)=d1;
octave:23> a1(206:306,308:459,:)=e1;
octave:24> f=double(a1)/255;
octave:25> imwrite("nstart.jpg", f(:,:,1),f(:,:,2),f(:,:,3));
octave:26> imwrite("n1start.jpg",a1(:,:,1),a1(:,:,2),a1(:,:,3));

In a new terminal you can imshow:

a=imread("n1start.jpg");
b=double(a)/255;
imshow(b);

Here is the image:

No comments: