convolucion
TRANSCRIPT
![Page 1: Convolucion](https://reader036.vdocuments.pub/reader036/viewer/2022081801/544de299af7959f7138b526c/html5/thumbnails/1.jpg)
USO DE MATLAB
PARA HACER UNA
CONVOLUCION
DE UN ARCHIVO
DE IMAGEN
![Page 2: Convolucion](https://reader036.vdocuments.pub/reader036/viewer/2022081801/544de299af7959f7138b526c/html5/thumbnails/2.jpg)
PROCEDIMIENTO:PROCEDIMIENTO:PROCEDIMIENTO:PROCEDIMIENTO:LA IMAGEN SELECCIONADA SE MUESTRA EN LA PARTE DE ABAJO, PROCEDEMOS PRIMERO A APLICAR EL CODIGO DE MATLAB CON UNA RESPUESTA A LA MUESTRA UNITARIA DE h [n] = [1/32,1/32,1/32]
![Page 3: Convolucion](https://reader036.vdocuments.pub/reader036/viewer/2022081801/544de299af7959f7138b526c/html5/thumbnails/3.jpg)
CON UNA RESPUESTA A LA MUESTRA:h[n] =[1/32,1/32,1/32]
>> x=>> x=>> x=>> x=imreadimreadimreadimread('C:('C:('C:('C:\\\\Dark.jpg');Dark.jpg');Dark.jpg');Dark.jpg');% almacena en forma de matriz en la variable x el archivo de imagen deseado. >> >> >> >> h =[1/32,1/32,1/32];
% respuesta al impulso deun filtro pasa bajas por el cual se convolucionará lamatriz de la imagen>> y=>> y=>> y=>> y=convnconvnconvnconvn((((x,hx,hx,hx,h););););% Comando que realiza la operación de convolución>> >> >> >> imwriteimwriteimwriteimwrite((((y,'Cy,'Cy,'Cy,'C::::\\\\Darkreponse2.jpg');Darkreponse2.jpg');Darkreponse2.jpg');Darkreponse2.jpg');% Crea el archivo de imagen, resultado de la convolucion de la original con la muestra a la respuesta unitaria.
CODIGO DE MATLABCODIGO DE MATLABCODIGO DE MATLABCODIGO DE MATLAB
![Page 4: Convolucion](https://reader036.vdocuments.pub/reader036/viewer/2022081801/544de299af7959f7138b526c/html5/thumbnails/4.jpg)
IMAGEN ORIGINAL
IMAGEN TRAS LA CONVOLUCION CON LA RESPUESTA (1/32)
![Page 5: Convolucion](https://reader036.vdocuments.pub/reader036/viewer/2022081801/544de299af7959f7138b526c/html5/thumbnails/5.jpg)
>> x=imread('C:\Dark.jpg');>> h =[1/300,1/300,1/300];>> y=convn(x,h);>> imwrite(y,'C:\Darkreponse3.jpg');
CON UNA RESPUESTA A LA MUESTRA:h[n] =[1/300,1/300,1/300]
![Page 6: Convolucion](https://reader036.vdocuments.pub/reader036/viewer/2022081801/544de299af7959f7138b526c/html5/thumbnails/6.jpg)
Imagen original
Imagen después del filtro (1/300)
![Page 7: Convolucion](https://reader036.vdocuments.pub/reader036/viewer/2022081801/544de299af7959f7138b526c/html5/thumbnails/7.jpg)
>> x=>> x=>> x=>> x=imreadimreadimreadimread('C:('C:('C:('C:\\\\Dark.jpg');Dark.jpg');Dark.jpg');Dark.jpg');% almacena en forma de matriz en la variable x el archivo de imagen deseado. >> h=[1/500,1/500,1/500];>> h=[1/500,1/500,1/500];>> h=[1/500,1/500,1/500];>> h=[1/500,1/500,1/500];% respuesta al impulso deun filtro pasa bajas por el cual se convolucionará lamatriz de la imagen>> y=>> y=>> y=>> y=convnconvnconvnconvn((((x,hx,hx,hx,h););););% Comando que realiza la operación de convolución>> >> >> >> imwriteimwriteimwriteimwrite((((y,'Cy,'Cy,'Cy,'C::::\\\\Darkreponse.jpg');Darkreponse.jpg');Darkreponse.jpg');Darkreponse.jpg');% Crea el archivo de imagen, resultado de la convolucion de la original con la muestra a la respuesta unitaria.
CON UNA RESPUESTA A LA MUESTRA:h[n] =[1/500,1/500,1/500]
![Page 8: Convolucion](https://reader036.vdocuments.pub/reader036/viewer/2022081801/544de299af7959f7138b526c/html5/thumbnails/8.jpg)
Imagen original
Imagen después de la convolución(1/500).
![Page 9: Convolucion](https://reader036.vdocuments.pub/reader036/viewer/2022081801/544de299af7959f7138b526c/html5/thumbnails/9.jpg)
>> x=imread('C:\Dark.jpg');>> h =[1/1000,1/1000,1/1000];>> y=convn(x,h);>> imwrite(y,'C:\Darkreponse4.jpg');
CON UNA RESPUESTA A LA MUESTRA:h[n] =[1/1000,1/1000,1/1000]
![Page 10: Convolucion](https://reader036.vdocuments.pub/reader036/viewer/2022081801/544de299af7959f7138b526c/html5/thumbnails/10.jpg)
Imagen original
Imagen tras convolución (1/1000).
![Page 11: Convolucion](https://reader036.vdocuments.pub/reader036/viewer/2022081801/544de299af7959f7138b526c/html5/thumbnails/11.jpg)
COMPARANDO LAS IMAGENES
IMAGEN ORIGINAL
1/321/300
1/5001/1000
![Page 12: Convolucion](https://reader036.vdocuments.pub/reader036/viewer/2022081801/544de299af7959f7138b526c/html5/thumbnails/12.jpg)
USO DE MATLAB
PARA HACER UNA
CONVOLUCION DE
UN ARCHIVO DE
SONIDO
![Page 13: Convolucion](https://reader036.vdocuments.pub/reader036/viewer/2022081801/544de299af7959f7138b526c/html5/thumbnails/13.jpg)
FORMA DEL AUDIO ORIGINAL ES LA SIGUIENTE
0 2 4 6 8 10 12
x 105
-1
-0.8
-0.6
-0.4
-0.2
0
0.2
0.4
0.6
0.8
1AUDIO ORIGINAL
![Page 14: Convolucion](https://reader036.vdocuments.pub/reader036/viewer/2022081801/544de299af7959f7138b526c/html5/thumbnails/14.jpg)
RESPUESTA A LA MUESTRA DE 1/300
CODIGO MATLAB
>> A=wavread('C:\Blackbird');>> x1=[1/2,1/2,1/2,1/2,1/2];>> M=convn(A,x1);>> wavwrite(M,20050,16,'C:\Blackbirdreponse');>> plot(M,‘r','linewidth',1),title('Convolucion1/2'),grid;
![Page 15: Convolucion](https://reader036.vdocuments.pub/reader036/viewer/2022081801/544de299af7959f7138b526c/html5/thumbnails/15.jpg)
0 2 4 6 8 10 12
x 105
-1
-0.8
-0.6
-0.4
-0.2
0
0.2
0.4
0.6
0.8
1Convolucion 1/2
![Page 16: Convolucion](https://reader036.vdocuments.pub/reader036/viewer/2022081801/544de299af7959f7138b526c/html5/thumbnails/16.jpg)
RESPUESTA A LA MUESTRA DE 1/6
CODIGO MATLAB
>> A=wavread('C:\Blackbird');>> x2=[1/6,1/6,1/6,1/6,1/6];>> E=convn(A,x2);>> wavwrite(E,20050,16,'C:\Blackbirdreponse2');>> plot(E,‘m','linewidth',1),title('Convolucion1/6'),grid;
![Page 17: Convolucion](https://reader036.vdocuments.pub/reader036/viewer/2022081801/544de299af7959f7138b526c/html5/thumbnails/17.jpg)
0 2 4 6 8 10 12
x 105
-0.4
-0.3
-0.2
-0.1
0
0.1
0.2
0.3
0.4Convolucion 1/6
![Page 18: Convolucion](https://reader036.vdocuments.pub/reader036/viewer/2022081801/544de299af7959f7138b526c/html5/thumbnails/18.jpg)
>> a=wavread('C:\Blackbird');>> x3=[1/20,1/20,1/20,1/20,1/20];>> G=convn(A,x3);>> wavwrite(G,20050,16,'C:\Blackbirdreponse3');>> plot(G,‘b','linewidth',1),title('Convolucion1/20'),grid;
RESPUESTA A LA MUESTRA DE 1/20
CODIGO MATLAB
![Page 19: Convolucion](https://reader036.vdocuments.pub/reader036/viewer/2022081801/544de299af7959f7138b526c/html5/thumbnails/19.jpg)
0 2 4 6 8 10 12
x 105
-0.1
-0.08
-0.06
-0.04
-0.02
0
0.02
0.04
0.06
0.08
0.1Convolucion 1/20
![Page 20: Convolucion](https://reader036.vdocuments.pub/reader036/viewer/2022081801/544de299af7959f7138b526c/html5/thumbnails/20.jpg)
RESPUESTA A LA MUESTRA DE 1/32
CODIGO MATLAB
>> A=wavread('C:\Blackbird');>> x1=[1/32,1/32,1/32,1/32,1/32];>> M=convn(A,x1);>> wavwrite(M,20050,16,'C:\Blackbirdreponse');>> plot(M,'r','linewidth',1),title('Convolucion1/32'),grid;
![Page 21: Convolucion](https://reader036.vdocuments.pub/reader036/viewer/2022081801/544de299af7959f7138b526c/html5/thumbnails/21.jpg)
0 2 4 6 8 10 12
x 105
-0.08
-0.06
-0.04
-0.02
0
0.02
0.04
0.06
0.08Convolucion 1/32
![Page 22: Convolucion](https://reader036.vdocuments.pub/reader036/viewer/2022081801/544de299af7959f7138b526c/html5/thumbnails/22.jpg)
COMPARANDO SIMULTANEAMENTE LAS GRAFICAS
subplot(4,1,1),plot(M,‘r'),title('Convolucion1/2’),grid;subplot(4,1,2),plot(E,‘m'),title('Convolucion1/6'),grid;subplot(4,1,3),plot(G,‘b'),title('Convolucion1/20'),grid;subplot(4,1,4),plot(m,‘y'),title('Convolucion1/32'),grid;
![Page 23: Convolucion](https://reader036.vdocuments.pub/reader036/viewer/2022081801/544de299af7959f7138b526c/html5/thumbnails/23.jpg)
COMPARANDO SEÑALES
0 2 4 6 8 10 12
x 105
-101
Convolucion 1/2
0 2 4 6 8 10 12
x 105
-0.50
0.5Convolucion 1/6
0 2 4 6 8 10 12
x 105
-0.10
0.1Convolucion 1/20
0 2 4 6 8 10 12
x 105
-0.10
0.1Convolucion 1/32
![Page 24: Convolucion](https://reader036.vdocuments.pub/reader036/viewer/2022081801/544de299af7959f7138b526c/html5/thumbnails/24.jpg)
SUPERPONIENDO LAS GRAFICAS Y COMPARANDOLA CON LA ORIGINAL
>>plot(A,‘k','linewidth', 1),title('Comparacion del Audio Original y las Convoluciones'),grid; hold on;>>plot(M,‘r'); hold on;>>plot(E,‘m'); hold on;>> plot(G,’b');hold on;>>plot(m,‘y');
![Page 25: Convolucion](https://reader036.vdocuments.pub/reader036/viewer/2022081801/544de299af7959f7138b526c/html5/thumbnails/25.jpg)
SUPERPONIENDO SEÑALES
0 2 4 6 8 10 12
x 105
-1
-0.8
-0.6
-0.4
-0.2
0
0.2
0.4
0.6
0.8
1Comparacion del Audio Original y las Convoluciones