depth1
Contents
clear close all load filelist npicts = length(files);
binary
% k = [1 3 4 20] k=20; filename = char(files{k}); photo_info(filename) [img, cmap] = imread(filename); fprintf('range: %d to %d\n',min(min(img)),max(max(img))); whos img cmap disp('color map'); disp(cmap) imshow(img,cmap);
Filename: 'C:\ece563\depth\wolves.gif' FileModDate: '12-Apr-2012 20:00:00' FileSize: 8199 Format: 'GIF' FormatVersion: '87a' Left: 1 Top: 1 Width: 490 Height: 300 BitDepth: 1 ColorType: 'indexed' FormatSignature: 'GIF87a' BackgroundColor: 1 AspectRatio: 0 ColorTable: [2x3 double] Interlaced: 'no' range: 0 to 1 Name Size Bytes Class Attributes cmap 2x3 48 double img 300x490 147000 uint8 color map 0 0 0 1 1 1
colormap
g = 0:15;
g = reshape(0:15,4,4)';
g2 = imresize(g,64,'nearest');
imshow(g2,jet(16));
cartoon
% [2 9 19] k = 19; filename = char(files{k}); photo_info(filename) [img, cmap] = imread(filename); fprintf('range: %d to %d\n',min(min(img)),max(max(img))); whos img cmap disp('color map'); disp(cmap) imshow(img,cmap);
Filename: 'C:\ece563\depth\tbrawl.gif' FileModDate: '12-Apr-2012 20:00:00' FileSize: 63321 Format: 'GIF' FormatVersion: '87a' Left: 1 Top: 1 Width: 640 Height: 480 BitDepth: 7 ColorType: 'indexed' FormatSignature: 'GIF87a' BackgroundColor: 1 AspectRatio: 0 ColorTable: [128x3 double] Interlaced: 'no' range: 0 to 77 Name Size Bytes Class Attributes cmap 128x3 3072 double img 480x640 307200 uint8 color map 1.0000 1.0000 1.0000 1.0000 1.0000 0.8000 1.0000 1.0000 0.6000 1.0000 1.0000 0.4000 1.0000 1.0000 0.2000 1.0000 0.8000 0.8000 1.0000 0.8000 0.6000 1.0000 0.8000 0.4000 1.0000 0.8000 0.2000 1.0000 0.8000 0 1.0000 0.6000 1.0000 1.0000 0.6000 0.6000 0.8000 0.8000 0.8000 0.8000 0.8000 0.6000 0.8000 0.8000 0.4000 0.8000 0.8000 0.2000 0.8000 0.8000 0 0.8000 0.6000 0.6000 0.8000 0.6000 0.4000 0.8000 0.6000 0.2000 0.8000 0.4000 0.2000 0.6000 0.6000 0.8000 0.6000 0.6000 0.6000 0.6000 0.6000 0.4000 0.6000 0.6000 0.2000 0.6000 0.6000 0 0.6000 0.4000 0.2000 0.6000 0.4000 0 0.4000 0.8000 0.6000 0.4000 0.6000 1.0000 0.4000 0.6000 0.8000 0.4000 0.6000 0.6000 0.4000 0.6000 0.4000 0.4000 0.6000 0.2000 0.4000 0.4000 0.4000 0.4000 0.4000 0.2000 0.4000 0.4000 0 0.4000 0 0.4000 0.4000 0 0.2000 0.4000 0 0 0.2000 0.6000 0.4000 0.2000 0.4000 0 0.2000 0.2000 0.2000 0.2000 0.2000 0 0.2000 0 0.4000 0.2000 0 0.2000 0.2000 0 0 0 0.4000 0.6000 0 0.4000 0.4000 0 0.4000 0.2000 0 0.4000 0 0 0.2000 0.2000 0 0.2000 0 0 0 0.8000 0 0 0.4000 0 0 0.2000 0.4667 0 0 0.3333 0 0 0.2667 0 0 0.0667 0 0 0 0.4667 0 0 0.3333 0 0 0.2667 0 0 0.0667 0 0 0 0.8667 0 0 0.3333 0 0 0.2667 0 0 0.1333 0 0 0.0667 0.8667 0.8667 0.8667 0.6667 0.6667 0.6667 0.5333 0.5333 0.5333 0.4667 0.4667 0.4667 0.3333 0.3333 0.3333 0.2667 0.2667 0.2667 0.1333 0.1333 0.1333 0.0667 0.0667 0.0667 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
grayscale
% [6 12] k = 12; filename = char(files{k}); photo_info(filename) [img, cmap] = imread(filename); fprintf('range: %d to %d\n',min(min(img)),max(max(img))); whos img cmap disp('color map'); disp(cmap) imshow(img,cmap);
Filename: 'C:\ece563\depth\lighthou.tif' FileModDate: '21-Jan-2016 03:14:26' FileSize: 78854 Format: 'tif' FormatVersion: [] Width: 320 Height: 240 BitDepth: 8 ColorType: 'grayscale' FormatSignature: [73 73 42 0] ByteOrder: 'little-endian' NewSubFileType: 0 BitsPerSample: 8 Compression: 'Uncompressed' PhotometricInterpretation: 'BlackIsZero' StripOffsets: [1x240 double] SamplesPerPixel: 1 RowsPerStrip: 1 StripByteCounts: [1x240 double] XResolution: [] YResolution: [] ResolutionUnit: 'Inch' Colormap: [] PlanarConfiguration: 'Chunky' TileWidth: [] TileLength: [] TileOffsets: [] TileByteCounts: [] Orientation: 1 FillOrder: 1 GrayResponseUnit: 0.0100 MaxSampleValue: 255 MinSampleValue: 0 Thresholding: 1 Offset: 76808 range: 21 to 255 Name Size Bytes Class Attributes cmap 0x0 0 double img 240x320 76800 uint8 color map
pseudo-color
This code also illustrates the use of double-percent to keep text and corresponding images together
close all for k = [5 8 10 14]
filename = char(files{k}); photo_info(filename) [img, cmap] = imread(filename); fprintf('range: %d to %d\n',min(min(img)),max(max(img))); subplot(1,2,1); imshow(img,cmap); g = reshape(uint8(0:255),16,16)'; g = imresize(g,32,'nearest'); rgbmap = ind2rgb(g,cmap); subplot(1,2,2); imshow(rgbmap);
Filename: 'C:\ece563\depth\clown.gif' FileModDate: '19-Jan-2016 08:49:00' FileSize: 58787 Format: 'GIF' FormatVersion: '87a' Left: 1 Top: 1 Width: 320 Height: 240 BitDepth: 8 ColorType: 'indexed' FormatSignature: 'GIF87a' BackgroundColor: 1 AspectRatio: 0 ColorTable: [256x3 double] Interlaced: 'no' range: 0 to 255
Filename: 'C:\ece563\depth\girl2.gif' FileModDate: '12-Apr-2012 20:00:00' FileSize: 55972 Format: 'GIF' FormatVersion: '87a' Left: 1 Top: 1 Width: 320 Height: 240 BitDepth: 8 ColorType: 'indexed' FormatSignature: 'GIF87a' BackgroundColor: 1 AspectRatio: 0 ColorTable: [256x3 double] Interlaced: 'no' range: 0 to 255
Filename: 'C:\ece563\depth\gulls.gif' FileModDate: '12-Apr-2012 20:00:00' FileSize: 49966 Format: 'GIF' FormatVersion: '87a' Left: 1 Top: 1 Width: 320 Height: 240 BitDepth: 8 ColorType: 'indexed' FormatSignature: 'GIF87a' BackgroundColor: 1 AspectRatio: 0 ColorTable: [256x3 double] Interlaced: 'no' range: 0 to 255
Filename: 'C:\ece563\depth\mouse.gif' FileModDate: '12-Apr-2012 20:00:00' FileSize: 36047 Format: 'GIF' FormatVersion: '87a' Left: 1 Top: 1 Width: 320 Height: 240 BitDepth: 8 ColorType: 'indexed' FormatSignature: 'GIF87a' BackgroundColor: 1 AspectRatio: 0 ColorTable: [256x3 double] Interlaced: 'no' range: 0 to 223
end
24-bit color
% [ 7 11 13 15 17]; close all for k = [ 7 11 13 15 17];
filename = char(files{k}); photo_info(filename) rgb = imread(filename); imshow(rgb);
Filename: 'C:\ece563\depth\girl.jpg' FileModDate: '12-Apr-2012 20:00:00' FileSize: 9586 Format: 'jpg' FormatVersion: '' Width: 256 Height: 256 BitDepth: 24 ColorType: 'truecolor' FormatSignature: '' NumberOfSamples: 3 CodingMethod: 'Huffman' CodingProcess: 'Sequential' Comment: {}
Filename: 'C:\ece563\depth\lenna.jpg' FileModDate: '12-Apr-2012 20:00:00' FileSize: 37050 Format: 'jpg' FormatVersion: '' Width: 512 Height: 512 BitDepth: 24 ColorType: 'truecolor' FormatSignature: '' NumberOfSamples: 3 CodingMethod: 'Huffman' CodingProcess: 'Sequential' Comment: {}
Filename: 'C:\ece563\depth\mandrill.jpg' FileModDate: '12-Apr-2012 20:00:00' FileSize: 76258 Format: 'jpg' FormatVersion: '' Width: 512 Height: 512 BitDepth: 24 ColorType: 'truecolor' FormatSignature: '' NumberOfSamples: 3 CodingMethod: 'Huffman' CodingProcess: 'Sequential' Comment: {}
Filename: 'C:\ece563\depth\peppers.jpg' FileModDate: '12-Apr-2012 20:00:00' FileSize: 40388 Format: 'jpg' FormatVersion: '' Width: 512 Height: 512 BitDepth: 24 ColorType: 'truecolor' FormatSignature: '' NumberOfSamples: 3 CodingMethod: 'Huffman' CodingProcess: 'Sequential' Comment: {}
Filename: 'C:\ece563\depth\rgbt1.bmp' FileModDate: '12-Apr-2012 20:00:00' FileSize: 149094 Format: 'bmp' FormatVersion: 'Version 3 (Microsoft Windows 3.x)' Width: 240 Height: 207 BitDepth: 24 ColorType: 'truecolor' FormatSignature: 'BM' NumColormapEntries: 0 Colormap: [] RedMask: [] GreenMask: [] BlueMask: [] ImageDataOffset: 54 BitmapHeaderSize: 40 NumPlanes: 1 CompressionType: 'none' BitmapSize: 149040 HorzResolution: 0 VertResolution: 0 NumColorsUsed: 0 NumImportantColors: 0
end