Tuesday, 19 January 2016

Zoom_Image_Method2_(_by Pixel Replication)

clc;
clear all;
close all;

im1=imread('https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiWSg9XpAfMMTDbbGSVal1fG65pAQbQDz0TM9m634fgKb3AkUmaV8GPt1rTrQ7_lUyUZ6gh3VmidsERX-C-x2qQ8HFYX9jSToF2plpVVRI3W6cI6j2T05Q8CpqEWZk9lSUz3T3B94eZCfo/s1600/apknee1+copy.jpg');
(Image to be zoomed)

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

[r,c]=size(im1);
n=input('How many times should the image be zoomed? ');

i=1:n;
j=1:n;
t=(n-1);

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

for x=1:(r-1)
 i=1:n;j=(1+(n*x)):(n*(x+1));
for num=num+1:num+r
    b(i,j)=im1(num);
    i=i+n:i+n+t;   
end
end

subplot(2,1,1),imshow(im1);
subplot(2,1,2),imshow(b);

No comments:

Post a Comment