Está en la página 1de 4

ACTIVIDAD: INTERPOLACION LINEAL DE IMAGEN/MATRIZ PARA AGRANDADO

Alumno: Lubeck Abraham huaman ponce 101677

Curso : procesamiento de imágenes medicas

% lee imagen o arreglo

imagen = im2double(imread('camaleon.jpg'));

imagen = [1 2 ; 4 5 ];

function [p] = interlol(imagen)

imagen_final = zeros((2*size(imagen))-1);

loli = 1;

c = 0;

ejex = size(imagen,1);

ejey = size(imagen,2);

for c =0 :loli

for y=1:ejey

for x=1:ejex

pixel=imagen(x,y);

imagen_final(((x*2)+1)-2,((y*2)+1)-2)=pixel;

end

end

end

ejey2 = size(imagen_final,1);

ejex2 = size(imagen_final,2)-1;

for y=1:ejey2

for x=1:ejex2

%disp (g);

if mod(x,2) == 0 && mod(y,2) != 0


%disp ("lolddd")

pixel=imagen_final(y,x-1);

pixel2 = imagen_final(y,x+1);

%pixel,pixel2;

imagen_final( y, x ) = (pixel+pixel2)/2;

end

end

end

for x=1:ejex2+1

for y=1:ejey2

%disp (g);

if mod(y,2) == 0

%disp ("lolddd")

pixel=imagen_final(y-1,x);

pixel2 = imagen_final(y+1,x);

%pixel,pixel2;

imagen_final( y, x ) = (pixel+pixel2)/2;

end

end

end

imagen;

imagen_final;

p = imagen_final;

end

function [p] = interlolx(imagen, iteraciones)


p=interlol(imagen);;

for c=1:iteraciones-1

p = interlol(p);

end

end

final = interlolx(imagen,2)

figure()

subplot(1,2,1)

imshow(imagen,[])

title('original ')

subplot(1,2,2)

imshow(final,[])

title('interpolada')

///// para el ejemplo de la matriz

También podría gustarte