You are on page 1of 54

:

-1-13

.
:
.
( :)Depth
() .
( :)Resolution
.
. dpi
.

:
-1-13--
: :



RGB


:
. PNG :
GIFTIFF BMPJPG
.

:
-2-13
()Intensity Image

: .


.
0 1 0 255 .
uint8 .
images
uint8 .

uint8.

:
-2-13 -
-
:

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

.

.

:
-2-13 -
(-)Indexed Image

:
-2-13 -


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

:
-2-13 -
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 .

:
-2-13 -
-RGB
rgb

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

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

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

:
-4-13 - -imshow

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

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

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

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

:
-8-13
uint8

.
double .

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

:
-9-13

. :
: imresize
: imrotate
: imcrop

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

.

.

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

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

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

rect
.

.

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

:
-10-13
filter2 :
)m2=filter2(h , m
h m h .
3*3 5*5.

:
-10-13 -

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

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

:
-11-13
:




:
-11-13 -

pixval impixel
impixel .
:
)P = IMPIXEL(I
)P = IMPIXEL(X,MAP
)P = IMPIXEL(RGB


. p
.
.
pixval
.
imshow .

:
-11-13 -
-
:improfile

:

;imshow(flowers.tif);improfile

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

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

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

mean2 std2 .

:
-11-13 -
:

.

:
-11-13 -
:

.

.
:


:
-11-13 -
-
- 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

:
-11-13 -
-
- -imadjust

:
-11-13 -
-
- 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

:
-11-13 -
-
- -histeq

:
-11-13 -
-

.
. .
:

fspecial filter2
. medfilt2 .
( )sharpness .
.

:
- -11-13
-
:-
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);

:
-11-13 -
-
- : -

:
-12-13


.

0 1 0 255 .

.
.

:
-12-13

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

:
-12-13
Morphological Operations

.
.
. .
:
-

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

.
.
.


.
.
.

.

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

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

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


.

bwmorph .
(. )

:
- -12-13
-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);

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

.
. :
erode fill hbreak open skel remove close dilate

:
-12-13 -
-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
.
- b11 b1 b2 .
- ( - ) b1 b2
.
- text

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



. dpi 600 .
:
...

You might also like