COMPARACION DE IMAGENES EN MATLAB



En este caso se van ha comparar naipes, lo que se tiene son 3 naipes como una base de datos y se procede a ingresar una cuarta imagen que va ha ser un naipe igual o diferente y mediante el software se obtiene cuata similitud tienen.

%BASE DE DATOS
n1=imread('cinco.jpg');
n2=imread('dos.jpg');
n3=imread('ocho.jpg');
figure(1);
subplot(1,3,1), imshow(n1);
subplot(1,3,2), imshow(n2);
subplot(1,3,3), imshow(n3);

%RECORTAR IMAGEN
n11=imcrop(n1,[0 0 200 250]);
n12=imcrop(n2,[0 0 200 250]);
n13=imcrop(n3,[0 0 200 250]);
figure(2);
subplot(1,3,1), imshow(n11);
subplot(1,3,2), imshow(n12);
subplot(1,3,3), imshow(n13);

%INGRESAR IMAGEN
ning=imread('siete.jpg');
ningrec=imcrop(ning,[0 0 200 250]);
figure(3); subplot(1,2,1); imshow(ning);
subplot(1,2,2); imshow(ningrec);

%CONVERTIR IMAGEN
n1c=rgb2gray(n11);
n2c=rgb2gray(n12);
n3c=rgb2gray(n13);
n4c=rgb2gray(ningrec);
figure(4);
subplot(2,2,1); imshow(n1c); title('naipe 1');
subplot(2,2,2); imshow(n2c); title('naipe 2');
subplot(2,2,3); imshow(n3c); title('naipe 3');
subplot(2,2,4); imshow(n4c); title('naipe ingresado');


%CORRELACION DE LA IMAGENES
k1=corr2(n4c,n1c);
k2=corr2(n4c,n2c);
k3=corr2(n4c,n3c);

k=[k1 k2 k3];

if ((k1>k2) && (k1>k3))
    disp('es el naipe 1');
elseif ((k2>k1)&&(k2>k3))
    disp('es el naipe 2');
elseif ((k3>k1)&&(k3>k2))
    disp('es el naipe 3');
else
    disp('imagen ingresada no es igual a ninguna');
end




Comments

Popular posts from this blog

IPVT GRATIS MEDIANTE VLC CON LISTA-2 M3U

Diseño Antena Logaritmica Microstrip de 10-20 GHz en Ansoft Dessigner.

VoIP en Cisco Packet Tracer con dial peer.