ejercicios en matlab

Embed Size (px)

DESCRIPTION

procesamiento de imágenes ejercicios resueltos en Matlab

Citation preview

ESCUELA SUPERIOR POLITCNICA DE CHIMBORAZO FACULTAD DE INFORMTICA Y ELECTRNICAESCUELA DE INGENIERA EN CONTROL Y REDES INDUSTRIALES TRABAJO EN CLASE

NOMBRE: Edith GarcsCODIGO: 24624911-11-2015

4.1 Crear una matriz 2 2 de tipo double

A = [1,5 -2; 0,5 0]

A =

1 5 -2 0 5 0

Y utilice para realizar las siguientes operaciones:

a. Convertir a uint8 e interpretar los resultados.C =

1 5 0 0 5 0 b. Convertir a un normalizado ([0, 255]) en escala de grises de la clase de datos uint8usando im2uint8 e interpretar los resultados. C =

255 255 0 0 255 0

c. Convertir a normalizado ([0.0, 1.0]) en escala de grises de la clase de datos doubleusando mat2gray e interpretar los resultados. e =

0.4286 1.0000 0 0.2857 1.0000 0.2857

d. Convertir el resultado del paso anterior a una imagen binaria usando im2bw(con un nivel de umbral de 0,5) e interpretar lo resultado. F =

0 1 0 0 1 0

4.2 Crear una matriz 2 2 de tipo double

A = [1 4; 5 3]

A =

1 4 5 3y escribir las sentencias en MATLAB para realizar las siguientes operaciones: a. Convertir a normalizado ([0.0, 1.0]) en escala de grises de la clase de datos doublee =

0 0.7500 1.0000 0.5000.

b. Convertir en una imagen binaria de la clase de datos logical, de tal manera que cualquier valor superior a 2 (en la imagen original) se interpretarn como 1 (verdadero). F =

0 1 1 1

c. Repetir el paso anterior, esta vez produciendo un resultado de la clase de datos doubl

G =

0 1 1 1. 4.3 La funcingray2indpermite la conversin de una imagen en escala de grises a su equivalente indexada. Lo interesante es la propiedad del mapa de color (paleta) mostrado?

a=imread('coins.png');[i map]= gray2ind(a);imshow (i, map)

4.4 Cmo funciona el rgb2ind para manejar la posibilidadde que la imagen original RGB contenga muchos ms colores que la paleta mxima (color map) tamao (65.536 colores)?

Una imagen indexada, consiste en guardar una imagen como dos matrices, donde la primera matriz tiene el mismo tamao que la imagen y un nmero para cada pxel y la segunda matriz se conoce como Mapa de Color, funcin en Matlab (Colormap)

4.5 Si escribe helpimdemos en MATLAB, podr ver (entre otras cosas) una lista de todas las imgenes de muestra que vienen con su IPT. Seleccionar cinco de esas imgenes y recoger la siguiente informacin sobre cada uno de ellas

IMAGEN 1

Filename: 'C:\Program Files\MATLAB\MATLAB Production Server\R2015a\toolbox\images\imdata\bag.png'FileModDate: '09-Aug-2004 21:41:08'FileSize: 35582Format: 'png'FormatVersion: []Width: 189Height: 250BitDepth: 8ColorType: 'grayscale'FormatSignature: [137 80 78 71 13 10 26 10]Colormap: []Histogram: []InterlaceType: 'none'Transparency: 'none'ImageModTime: '29 Sep 2003 20:17:21 +0000'Title: []Author: []Description: 'digital photograph of a handle to a bag'Copyright: 'Copyright The MathWorks, Inc.'

IMAGEN 2

Filename: coins.png'FileModDate: '13-Oct-2002 08:47:00'FileSize: 37906Format: 'png'Width: 300Height: 246BitDepth: 8ColorType: 'grayscale'FormatSignature: [137 80 78 71 13 10 26 10]InterlaceType: 'none'Transparency: 'none'ImageModTime: '19 Sep 2002 20:31:12 +0000'Copyright: 'Copyright The MathWorks, Inc.'

IMAGEN 3

Filename: 'C:\Program Files\MATLAB\MATLAB Production Server\R2015a\toolbox\images\imdata\camera...'FileModDate: '04-dic-2000 18:57:54'FileSize: 65240Format: 'tif'FormatVersion: []Width: 256Height: 256BitDepth: 8ColorType: 'grayscale'FormatSignature: [77 77 0 42]ByteOrder: 'big-endian'NewSubFileType: 0BitsPerSample: 8Compression: 'PackBits'PhotometricInterpretation: 'BlackIsZero'StripOffsets: [8 8262 16426 24578 32492 40499 48599 56637]SamplesPerPixel: 1RowsPerStrip: 32StripByteCounts: [8254 8164 8152 7914 8007 8100 8038 8235]XResolution: 72YResolution: 72ResolutionUnit: 'Inch'PlanarConfiguration: 'Chunky'Orientation: 1FillOrder: 1GrayResponseUnit: 0.0100MaxSampleValue: 255MinSampleValue: 0Thresholding: 1Offset: 64872ImageDescription: 'This image is distributed by The MathWorks, Inc. withpermission from the Massachuse...'

IMAGEN 4

Filename: 'C:\Program Files\MATLAB\MATLAB Production Server\R2015a\toolbox\images\imdata\blobs.png'FileModDate: '18-Nov-2002 16:13:30'FileSize: 1094Format: 'png'FormatVersion: []Width: 329Height: 272BitDepth: 1ColorType: 'grayscale'FormatSignature: [137 80 78 71 13 10 26 10]InterlaceType: 'none'Transparency: 'none'ImageModTime: '13 Nov 2002 20:21:22 +0000'Copyright: 'Copyright The Mathworks, Inc.'

IMAGEN 5

Filename: 'C:\Program Files\MATLAB\MATLAB Production Server\R2015a\toolbox\images\imdata\autumn.tif'FileModDate: '04-dic-2000 18:57:54'FileSize: 213642Format: 'tif'FormatVersion: []Width: 345Height: 206BitDepth: 24ColorType: 'truecolor'FormatSignature: [73 73 42 0]ByteOrder: 'little-endian'NewSubFileType: 0BitsPerSample: [8 8 8]Compression: 'Uncompressed'PhotometricInterpretation: 'RGB'StripOffsets: [1x30 double]SamplesPerPixel: 3RowsPerStrip: 7StripByteCounts: [1x30 double]XResolution: 72YResolution: 72ResolutionUnit: 'Inch'Colormap: []PlanarConfiguration: 'Chunky'TileWidth: []TileLength: []TileOffsets: []TileByteCounts: []Orientation: 1FillOrder: 1GrayResponseUnit: 0.0100MaxSampleValue: [255 255 255]MinSampleValue: [0 0 0]Thresholding: 1Offset: 213218

4.6 Seleccionar cinco imgenes disponibles en MATLAB (pueden ser los mismos que en el problema anterior, o usted elige). Abra cada uno de ellos utilizando imread, guardarlo (usandoimwrite) a (al menos tres) diferentes formatos de archivo, y comparar eltamao del archivo resultante(en bytes) para cada formato de salida.

IMAGEN 1

IMAGEN 2

IMAGEN 3

IMAGEN 4

IMAGEN 5