DSP Lab 08 Image processing

ranchocucamongabrrrΤεχνίτη Νοημοσύνη και Ρομποτική

6 Νοε 2013 (πριν από 4 χρόνια και 6 μέρες)

149 εμφανίσεις

Nasir Ahmed Khan

Lab 08

2010
-
EE
-
043

Image

Processing

Object
:


To learn the Image processing on matlab.


Task 1:

a=imread('kids.tif');

b=imread('logo.tif');

subplot(211)

imshow(
a)

subplot(212)

imshow(b)

ia=imfinfo('kids.tif')

ib=imfinfo('logo.tif')

whos


Output:


For kids.tif


Type: indexed

Size: 400x318


Filename: [1x62 char]


FileModDate: '04
-
Dec
-
2000 13:57:58'


FileSize: 95162


Format: 'tif'


FormatVersion: []


Width: 318


Height: 400


BitDepth: 8


ColorType: 'indexed'


FormatSignature: [73 73 42
0]


ByteOrder: 'little
-
endian'


NewSubFileType: 0


BitsPerSample: 8


Compression: 'PackBits'


PhotometricInterpretation: 'RGB Palette'


StripOffsets: [16x1 double]



SamplesPerPixel: 1


RowsPerStrip: 25


StripByteCounts: [16x1 double]


XResolution: 72


YResolution: 72


ResolutionUnit: 'None'


Colormap: [256x3 double]


PlanarConfiguration: 'Chunky'


TileWidth: []


TileLength: []


TileOffsets: []

Nasir Ahmed Khan

Lab 08

2010
-
EE
-
043


TileByteCounts: []


Orientation: 1


FillOrder: 1


G
rayResponseUnit: 0.0100


MaxSampleValue: 255


MinSampleValue: 0


Thresholding: 1


Offset: 93308


For logo.tif


Type: grayscale

Size: 107x122



Filename: [1x62 char]


FileMo
dDate: '04
-
Dec
-
2000 13:57:58'


FileSize: 1074


Format: 'tif'


FormatVersion: []


Width: 122


Height: 107


BitDepth: 1


ColorType: 'grayscale'


FormatSignature: [73 73 42 0]


ByteOrder: 'little
-
endian'


NewSubFileType: 0


BitsPerSample: 1


Compression: 'CCITT 1D'


Photometri
cInterpretation: 'WhiteIsZero'


StripOffsets: [2x1 double]


SamplesPerPixel: 1


RowsPerStrip: 67


StripByteCounts: [2x1 double]


XResolution: 72


YResolution: 72



ResolutionUnit: 'None'


Colormap: []


PlanarConfiguration: 'Chunky'


TileWidth: []


TileLength: []


TileOffsets: []


TileByteCounts: []


Orientation: 1


FillOrder: 1


GrayResponseUnit: 0.0100


MaxSampleValue: 1


MinSampleValue: 0


Thresholding: 1


Offset: 880




Nasir Ahmed Khan

Lab 08

2010
-
EE
-
043

Task
2:

clc

z=imread(
'index.jpg'
);

imwrite(g,
'abs7.jpg'
);

imwrite(g,
'abs8.png'
);

imwrite(g,
'abs9.bmp'
);


Output

JPEG = 113 KB

BMP = 1.83 MB

PNG = 630 KB
Task
3
:
Task#3_1:

i=imread('trees.tif');

level=graythresh(i)

bw=im2bw(
i,level);

imwrite(bw,'trees1.jpg')

imwrite(bw,'trees2.png')

imwrite(bw,'trees3.bmp')


Output:

JPEG = 21.5 KB

BMP = 11.1 KB

PNG = 3.43 KB


Task # 3_2:

i=imread('abstract.jpg');

x=rgb2ind(i,128);

imwrite(x,'abs1.jpg')

imwrite(x,'abs2.pn
g')

imwrite(x,'abs3.bmp')


Output:

JPEG = 536 KB

BMP = 1.83 MB

PNG = 0.98 MB


Task # 3_3:

i=imread('abstract.jpg');

imwrite(x,'abs4.jpg')

imwrite(x,'abs5.png')

imwrite(x,'abs6.bmp')


Output:

JPEG = 536 KB

BMP = 1.83 MB

PNG = 0.98 MB

Task 4
:

z=imread('trees.tif');

a=im2uint8(z);

subplot(1,2,1)

imshow(a)

title('uint8 mode');

b=im2uint16(z);

subplot(1,2,2)

imshow(b)

title('uint16 mode');




Nasir Ahmed Khan

Lab 08

2010
-
EE
-
043

Task 5
:

f=imread('football.jpg');

subplot(2,2,1)

imshow(f)

title('True color image');

i=rgb2ind(f,128);

subplot(2,2,2)

imshow(i)

title('Indexed image');

g=rgb2gray(f);

subplot(2,2,3)

imshow(g)

title('Gray scale image');

level=graythresh(f)

b=im2bw(f,level);

subplot(2,2,4)

imshow(b)

title('Binary image');


Task 6:

f=imread('football.jpg');

r=f(:,:,1);

g=f(:,:,2);

b=f(:,:,3);

subplot(1,3,1);

imshow(r)

title('red color extracted');

subplot(1,3,2);

imshow(g)

title('green color extracted');

subplot(1,3,3);

imshow(b)

title('blue color extracted');




Nasir Ahmed Khan

Lab 08

2010
-
EE
-
043

Task 7:

Task 7 (a,b)

for

m=1:100;


for

n=1:100;


if

m
-
n==0


z(m,n)=0;


elseif

abs(m
-
n)==1


z(m,n)=0.5;


else


z(m,n)=1;


end


end

end

y=fliplr(z)

subplot(211)

imshow(z)

subplot(212)

imshow(y)


Task 7(c)

a=ones(1,100);

b=zeros(
1,100);

for c=1:100

if (
-
1)^c==1


z(c,:)=a;

else


z(c,:)=b;

end

end

imshow(z)


Task 7(d
)

a=ones(100,1);

b=zeros(100,1);

for c=1:100

if (
-
1)^c==1


z(:,c)=a;

else


z(:,c)=b;

end

end

imshow(z)




Nasir Ahmed Khan

Lab 08

2010
-
EE
-
043

Task 7(e
,f
)

for

m=1:100;


for

k=0;


for

n=1:1000;


q(m,n)=k;


k=k+0.001;


end


end

end

p=fliplr(q)

subplot(211)

imshow(q)

subplot(212)

imshow(p)




Conclusion:

In this lab we have learned



Image

Processing