Tuesday, 19 January 2016

Zoom_Image_Method1 (_by Pixel Replication)

clc
clear all
close all;

n=input('How many times should the image be zoomed? ');

a=randint(3,3,10);
[r,c]=size(a);

i=1;
for num=1:c
    b(:,i)=a(:,num);
        for t=1:n
            b(:,i+t-1)=b(:,i);
        end
    i=i+n;
end

[r,c]=size(b);
i=1;

for num=1:r
    d(i,:)=b(num,:);
    for t=1:n
        d(i+t-1,:)=d(i,:);
    end
    i=i+n;
end

figure,imshow(a);
figure,imshow(d);

No comments:

Post a Comment