You are on page 1of 54

:

-13-1
.
:
.
) :(Depth
)( .
) :(Resolution
.
. dpi
.

:
-13-1--
: :



RGB


:
. PNG :
JPGBMP TIFFGIF
.

:
-13-2
)(Intensity Image

: .


.
0 1 0 255 .
uint8 .
images
uint8 .

uint8.

:
-13-2 -
-
:

:
-13-2 -
)(Indexed Image
:
.1 :
. 1 256
.
.2 ) :(map 3
.

.

.

:
-13-2 -
)-(Indexed Image

:
-13-2 -


) 0 (1.
double uint8 .
uint8 0 1 0 255.

:
-13-2 -
RGB
RGB true color
0 255
. 255
255 0 0
. 16) (256*256*256
. rgb

.
rgb
) (r,g,b . 0
(double) 1 0 (uint8) 255
rgb .

:
-13-2 -
-RGB
rgb

:
-13-3 - imread
Imread
.
:
rgb m=imread(filename) :
imread(filename)=[m,map]:
m map .
: imread .
.

:
-13-4 - imshow
imshow
:
;)imshow(m
rgb
)imshow(I , map
;)imshow(filename

:
)>> imshow(fabric.png
:
;)>> m=imread(fabric.png
)imshow(m

:
-13-4 - -imshow

:
-13-4 - imtool
imtool .
imshow :
)>> imshow(fabric.png

:
-13-5 imwrite-
imwrite .
:
;)imwrite(m , filename
;)imwrite(X , map , filename

:
-13-6 - imfinfo
:
... .
:
)info=imfinfo(filename

:
-13-7
:
)bw=im2bw(m , level
)bw=im2bw(x , map , level
( ).
1
0
level
;)m=ind2gray(x , map
;)[x,map]=gray2ind(m
;)[x,map]=rgb2ind(m
;)m=ind2rgb(x , map
;)m=rgb2gray(m
.

:
-13-8
uint8

.
double .
uint8:
;)m=double(m
;)m=im2uint8(m

:
-13-9

.
:
: imresize
: imrotate
: imcrop

:
-13-9 -
: imresize
:
;)y=imresize(x , a
;)]y=imresize(x , [m , n
a . 2
. 1
.

.

:
-13-9 -
- imrotate
:
)]m2=imrotate(m , d , [Option] , [crop
.
bilinear, nearest bicubic.
nearest
. crop
.
.

:
-13-9 -
- -imrotate
:
;)m=imread(ic.tif
;)n=imrotate(m , 35); p=imrotate(m , 35,crop
;)imshow(n); figure; imshow(p

:
-13-9 -
: imcrop
:
)I2 = IMCROP(I,RECT
)X2 = IMCROP(X,MAP,RECT
)RGB2 = IMCROP(RGB,RECT
)[A,RECT] = IMCROP(...

rect
.

.

:
-13-9 -
: -imcrop
:
;)m=imread(pout.tif
)]imshow(m);figure;imcrop(m,[size(m)/4,size(m)/2

:
-13-10
filter2 :
)m2=filter2(h , m
h m h .
3*3 5*5.
);I=imread(rice.png
);J=filter2(fspecial(sobel),I
)Imshow(J

:
-13-10 -

fspecial
filter2 . :
) , (h=fspecial
.
:
gaussian:
sobel:
prewitt:
laplacian:
log:
average:
unsharp:

:
- -13-10
-
SobelFilter=fspecial(sobel);
[I,map]=imread('kids.tif');I=ind2gray(I,map); I2=filter2(SobelFilter,I);
imshow( I ); figure; imshow( I2 );

:
-13-11
:




:
-13-11 -

pixval impixel
impixel .
:
)a=imread(kids.tif),impixel(a

)P = IMPIXEL(I
)P = IMPIXEL(X,MAP
)P = IMPIXEL(RGB


. p
.
.
pixval
.
imshow .

:
-13-11 -
-
:improfile

:

:
;imshow(flowers.tif);improfile

:
-13-11 -
-
:imcontour :
;)im=imread(ic.tif
;)imshow(im);figure;imcontour(im,3

:
-13-11 -
-
:imhist :
;)I=imread(flowers.tif);I=rgb2gray(I
;)imshow(I);figure;imhist(I

:
-13-11 -
-
mean2 :std2
mean std
.
.
.
.

mean2 std2 .

:
-13-11 -
:

.

:
-13-11 -
:

.

.
:


:
-13-11 -
-
- imadjust

. :
)]J=imadjust(I , [low , high] , [bottom , top

.
.
:
;)I=imread(pout.tif
;)]J=imadjust(I , [0.3 , 0.7] , [0 ,1
;)subplot(2,2,1);imshow(I); subplot(2,2,2);imshow(J
)subplot(2,2,3); imhist(I); subplot(2,2,4); imhist(J

:
-13-11 -
-
- -imadjust

:
-13-11 -
-
- histeq
histeq
.
:
;)I=imread(tire.tif
;J=histeq(I);figure
;)subplot(2,2,1);imshow(I
;)subplot(2,2,2);imshow(J
;)subplot(2,2,3);imhist(I
;)subplot(2,2,4);imhist(J

:
-13-11 -
-
- -histeq

:
-13-11 -
-

.
. .
:

fspecial filter2
. medfilt2 .
) (sharpness .

.

:
- -13-11
-
:-
I = imread(eight.tif);
J= imnoise(I , Salt & pepper , 0.02); %
K= filter2(fspecial(average , 3) , J) / 255; %
L=medfilt2(J , [3 , 3]); %
subplot(2,2,1); imshow( I ); title(Initial Image)
subplot(2,2,2); imshow( J ); title(Noised Image);
subplot(2,2,3); imshow( K ); title(Mean Filter);
subplot(2,2,4); imshow( L ); title(Median Filter);

:
-13-11 -
-
- : -

:
-13-12


.

0 1 0 255 .

.
.

:
-13-12

imshow .
imshow(m) :
imshow(I ,map) : .

:
-13-12
Morphological Operations

.
.
.
.
:
-

:
-13-12 -
-Morphological Operations
)(Dilation & Erosion

.
.
.


.
.

.
.

:
-13-12 -
-Morphological Operations
-
) (Mask .
3 *3 1 .
3*3 9
.
imdilate imerode
. bwmorph
.
:
;)bw2=imerode(bw1, se
;)bw2=imdilate(bw1 , se

:
-13-12 -
-Morphological Operations
-
;)bw1=imread(circbw.tif); SE=eye(5
;)bw2=imerode(bw1 , SE
;)imshow(bw1); figure; imshow(bw2

:
-13-12 -
-Morphological Operations
Open & Close
.
.
.
.


.

bwmorph .
). (

:
- -13-12
-Morphological Operations
-Open & Close
bw1=imread(circbw.tif);
se= ones(40 , 30); bw2= imerode(bw1 , se);
bw3=imdilate(bw2 , se);
imshow(bw2); figure; imshow(bw3);

:
-13-12 -
-Morphological Operations
: immorph
immorph
. :
;)]bw2 = bwmorph(bw1 , operation , [n

.
. :
erode fill hbreak open skel remove close dilate

:
-13-12 -
-Morphological Operations
: -immorph:
)bw1= imread(circbw.tif); bw2= bwmorph(bw1 , skel , inf
;)imshow(bw1); figure; imshow(bw2

:
-1-13 flower.tif rgb .
. :
m
- 120 180
b1 b2 .
: . :
m(:,:,2)>120 & m(:,:,1) < 100 .
- b1 b11.
- b11 b2
c .
- b1 b11 b2 .
- ) - ( b1 b2
.
- text

:
-2-13 fabric.tif
) (grayscale .



. 600dpi .
:
...

You might also like