You are on page 1of 68

BI GING MN: X L NH

www.ptit.edu.vn
GING VIN: THS. TRN THY H
B MN: K THUT IN T - KHOA KTDT1
Trang 1
HC VIN CNG NGH BU CHNH VIN THNG
BI GING MN
Ging vin: ThS. Trn Thy H
in thoi/E-mail: 0912166577 / thuyhadt@gmail.com
B mn: K thut in t- Khoa KTDT1
Hc k/Nm bin son: Hc k 2 nm 2013
X L NH
BI GING MN: X L NH
www.ptit.edu.vn
GING VIN: THS. TRN THY H
B MN: K THUT IN T - KHOA KTDT1
Trang 2
MC TIU MN HC
Cung cp cho sinh vin nhng kin thc c bn:
Cc khi nim v nh
Phng php v k thut x l nh:
Biu din,
Lc v nng cao cht lng nh
Phng php phn vng nh
Xc nh bin nh
Cc phng php nhn dng nh
Mt s k thut v cng ngh nn nh s
2
BI GING MN: X L NH
www.ptit.edu.vn
GING VIN: THS. TRN THY H
B MN: K THUT IN T - KHOA KTDT1
Trang 3
Ti liu
Hc liu bt buc:
[1]. Nng Ton, Gio trnh X l nh, Hc vin CNBCVT, 2010
[2] Lng Mnh B, Nguyn Thanh Thu, Nhp mn x l nh s. Nh
xut bn Khoa hc K thut, 1999
Hc liu tham kho
[3] John C. Russ , The Image Processing Handbook, CRC Press, 2002
[4] Alan C. Bovik , Handbook of Image and Video Processing, Academic
Press, 2000
[5] Rafael C. Gonzalez, Richard E. Woods, Steven L. Eddins, Digital
Image Processing Using MATLAB, Prentice Hall, 2003
[6] Nguyn Kim Sch. X l nh v Video s. Nh xut bn Khoa hc
K thut, 1997
3
BI GING MN: X L NH
www.ptit.edu.vn
GING VIN: THS. TRN THY H
B MN: K THUT IN T - KHOA KTDT1
Trang 4
nh gi
Tham gia hc tp trn lp: 10%
Thc hnh/Th nghim/Bi tp/Tho lun: 10%
Kim tra gia k: 10%
Kim tra cui k: 70%
4
BI GING MN: X L NH
www.ptit.edu.vn
GING VIN: THS. TRN THY H
B MN: K THUT IN T - KHOA KTDT1
Trang 5
1. Chng 1. Nhp mn x l nh. ( 2 tit).
2. Chng 2. Thu nhn nh. (4 tit).
3. Chng 3. X l nng cao cht lng nh. (4 tit).
4. Chng 4. Cc phng php pht hin bin. (4 tit).
5. Chng 5. Phn vng nh. (4 tit).
6. Chng 6. Nhn dng nh. (4 tit).
7. Chng 7. Nn d liu nh (2 tit).
5
BI GING MN: X L NH
www.ptit.edu.vn
GING VIN: THS. TRN THY H
B MN: K THUT IN T - KHOA KTDT1
Trang 6
Chng 1. NHP MN X L NH
BI GING MN: X L NH
www.ptit.edu.vn
GING VIN: THS. TRN THY H
B MN: K THUT IN T - KHOA KTDT1
Trang 7
1. Tng quan v h thng x l nh.
2. Nhng vn c bn trong x l nh
BI GING MN: X L NH
www.ptit.edu.vn
GING VIN: THS. TRN THY H
B MN: K THUT IN T - KHOA KTDT1
Trang 8
1.1. Tng quan v h thng x l nh.
Qu trnh x l nh l qu trnh thao tc
nh u vo nhm cho ra kt qu mong
mun.
Kt qu u ra ca mt qu trnh x l
nh c th l mt nh tt hn hoc mt
kt lun.
BI GING MN: X L NH
www.ptit.edu.vn
GING VIN: THS. TRN THY H
B MN: K THUT IN T - KHOA KTDT1
Trang 9
nh l tp hp cc imnh.
Mi im nh l c trng cng
sng hay mt du hiu no ti mt v
tr no ca i tng trong khng
gian.
nh c th xem nh mt hm n bin P(c
1
,
c
2
,..., c
n
).
Do , nh trong x l nh c th xem
nh nh nchiu.
BI GING MN: X L NH
www.ptit.edu.vn
GING VIN: THS. TRN THY H
B MN: K THUT IN T - KHOA KTDT1
Trang 10
S tng qut ca mt h thng x l nh:
BI GING MN: X L NH
www.ptit.edu.vn
GING VIN: THS. TRN THY H
B MN: K THUT IN T - KHOA KTDT1
Trang 11
1.2. NHNG VN C BN TRONG X L NH
1.2.1. Mt s khi nim c bn
Pixel (Picture Element): phn t nh
nh gm nhiu im nh, gi l pixel. Mi
pixel gm mt cp to x, y v mu. Cp
to x, y to nn phngii (resolution)
Khi c s ho, n thng c biu din
bi bng hai chiu I(n,p): n dng v p ct
nh gm n x p pixels.
BI GING MN: X L NH
www.ptit.edu.vn
GING VIN: THS. TRN THY H
B MN: K THUT IN T - KHOA KTDT1
Trang 12
K hiu I(x,y) ch mt pixel.
Thng chn n = p = 256.
Mt pixel c th lu tr trn 1,
4, 8 hay 24 bit.
12
BI GING MN: X L NH
www.ptit.edu.vn
GING VIN: THS. TRN THY H
B MN: K THUT IN T - KHOA KTDT1
Trang 13
Graylevel: Mc xm/Mu
L s cc gi tr c th c ca cc
imnh ca nh.
Mc xm l cng sng
Mu l mu ca imnh
BI GING MN: X L NH
www.ptit.edu.vn
GING VIN: THS. TRN THY H
B MN: K THUT IN T - KHOA KTDT1
Trang 14
1.2.2. Nn chnh bin dng
nh thu nhn thng b bin dng do cc thit b quang hc v
in t.
khc phc ngi ta s dng cc php chiu, cc
php chiu thng c xy dng trn tp cc im
iu khin.
BI GING MN: X L NH
www.ptit.edu.vn
GING VIN: THS. TRN THY H
B MN: K THUT IN T - KHOA KTDT1
Trang 15
1.2.3. Kh nhiu
C 2 loi nhiu c bn trong qu trnh
thu nhn nh:
Nhiu h thng: l nhiu c quy lut
c th kh bng cc php bin i.
Nhiu ngu nhin: vt bn khng r
nguyn nhn khc phc bng cc
php lc
BI GING MN: X L NH
www.ptit.edu.vn
GING VIN: THS. TRN THY H
B MN: K THUT IN T - KHOA KTDT1
Trang 16
1.2.4. Chnh mc xm
Nhm khc phc tnh khng ng u ca h
thng gy ra. Thng thng c 2 hng tip
cn:
Gim s mc xm: Thc hin bng cch nhm
cc mc xmgn nhau thnh mt b.
Trng hp ch c 2 mc xm th chuyn v
nh en trng.
ng dng: In nh mu bng my in en trng.
BI GING MN: X L NH
www.ptit.edu.vn
GING VIN: THS. TRN THY H
B MN: K THUT IN T - KHOA KTDT1
Trang 17
Tng s mc xm: Thc hin ni suy
ra cc mc xm trung gian bng k
thut ni suy. K thut ny nhm
tng cng mn cho nh.
17
BI GING MN: X L NH
www.ptit.edu.vn
GING VIN: THS. TRN THY H
B MN: K THUT IN T - KHOA KTDT1
Trang 18
1.2.5. Phn tch nh
Cc c im ca i tng c trch chn tu
theo mc ch nhn dng trong qu trnh x l nh.
C th nu ra mt s c imca nh sau y:
c im khng gian: Phn b mc xm, phn b
xc sut, bin , im un v.v..
c im bin i: Cc c im loi ny c trch
chn bng vic thc hin lc vng (zonal filtering).
Cc b vng c gi l mt n c im
(feature mask) thng l cc khe hp vi hnh dng
khc nhau (ch nht, tam gic, cung trn v.v..)
BI GING MN: X L NH
www.ptit.edu.vn
GING VIN: THS. TRN THY H
B MN: K THUT IN T - KHOA KTDT1
Trang 19
c im bin vng bin: c trng
cho ng bin ca i tng hu
ch trong vic trch trn cc thuc tnh
bt bin c dng khi nhn dng i
tng.
Cc c im ny c th c trch
chn nh ton t gradient, ton t la
bn, ton t Laplace v.v..
19
BI GING MN: X L NH
www.ptit.edu.vn
GING VIN: THS. TRN THY H
B MN: K THUT IN T - KHOA KTDT1
Trang 20
1.2.6. Nhn dng
C 2 cch nhn dng khc nhau:
Phn loi c mu (supervised classification):
trong mu u vo c nh danh nh
mt thnh phn ca mt lp xc nh.
Phn loi khng c mu (unsupervised
classification): trong cc mu c gn
vo cc lp khc nhau da trn mt tiu
chun ng dng no . Cc lp ny cho
n thi im phn loi vn cha bit hay
cha c nh danh.
BI GING MN: X L NH
www.ptit.edu.vn
GING VIN: THS. TRN THY H
B MN: K THUT IN T - KHOA KTDT1
Trang 21
H thng nhn dng t ng bao gm ba
khu tng ng vi ba giai on ch yu
sau:
Thu nhn d liu v tin x l.
Biu din d liu.
Nhn dng, ra quyt nh.
BI GING MN: X L NH
www.ptit.edu.vn
GING VIN: THS. TRN THY H
B MN: K THUT IN T - KHOA KTDT1
Trang 22
Bn cch tip cn khc nhau trong l
thuyt nhn dng l:
i snh mu da trn cc c trng
c trch chn.
Phn loi thng k.
i snh cu trc.
Phn loi da trn mng n-ron nhn
to.
22
BI GING MN: X L NH
www.ptit.edu.vn
GING VIN: THS. TRN THY H
B MN: K THUT IN T - KHOA KTDT1
Trang 23
1.2.7. Nn nh
Nhm gim thiu khng gian lu
tr.
Nn nh c 2 loi l nn c bo ton
v nn khng bo ton thng tin.
Nn khng bo ton th thng c
kh nng nn cao hn nhng kh
nng phc hi th kmhn.
BI GING MN: X L NH
www.ptit.edu.vn
GING VIN: THS. TRN THY H
B MN: K THUT IN T - KHOA KTDT1
Trang 24
C 4 k thut c bn trong nn nh:
Nn nh thng k: da vo vic thng
k tn xut xut hin ca gi tr cc
imnh
Nn nh khng gian: da vo v tr
khng gian ca cc im nh tin
hnh m ha. K thut li dng s
ging nhau ca cc im nh trong cc
vng gn nhau.
BI GING MN: X L NH
www.ptit.edu.vn
GING VIN: THS. TRN THY H
B MN: K THUT IN T - KHOA KTDT1
Trang 25
Nn nh s dng php bin i: y l
k thut tip cn theo hng nn khng
bo ton v do vy, k thut thng nn
hiu qu hn.
Nn nh Fractal: S dng tnh cht
Fractal (t ng dng) ca cc i tng
nh th hin s lp li ca cc chi tit.
K thut nn s tnh ton ch cn lu
tr phn gc nh v quy lut sinh ra
nh.
25
BI GING MN: X L NH
www.ptit.edu.vn
GING VIN: THS. TRN THY H
B MN: K THUT IN T - KHOA KTDT1
Trang 26
CHNG 2.
THU NHN NH
BI GING MN: X L NH
www.ptit.edu.vn
GING VIN: THS. TRN THY H
B MN: K THUT IN T - KHOA KTDT1
Trang 27
2.1. CC THIT B THU NHN NH
2.2. LY MU V LNG T
2.3. MT S PHNG PHP BIU DIN NH
2.4. CC NH DNG NH C BN
2.5. K THUT TI NHN NH
2.6. KHI NIMNH EN TRNG, NH MU
BI GING MN: X L NH
www.ptit.edu.vn
GING VIN: THS. TRN THY H
B MN: K THUT IN T - KHOA KTDT1
Trang 28
2.1. CC THIT B THU NHN NH
Cc thit b thu nhn nh c 2 loi chnh
ng vi 2 loi nh thng dng Raster,
Vector v c th cho nh en trng hoc nh
mu.
Cc thit b thu nhn nh Raster thng
thng l camera, scanner.
Cc thit b thu nhn nh Vector thng
thng l sensor hoc bn s ho digitalizer
hoc c chuyn i t nh Raster.
BI GING MN: X L NH
www.ptit.edu.vn
GING VIN: THS. TRN THY H
B MN: K THUT IN T - KHOA KTDT1
Trang 29
Nhn chung cc h thng thu nhn
nh thc hin qu trnh:
Cm bin: bin i nng lng
quang hc thnh nng lng in
(giai on ly mu)
Tng hp nng lng in thnh
nh (giai on lng t ha)
29
BI GING MN: X L NH
www.ptit.edu.vn
GING VIN: THS. TRN THY H
B MN: K THUT IN T - KHOA KTDT1
Trang 30
2.2. LY MU V LNG T HO
2.2.1. Giai on ly mu
S dng b cm bin hoc my qut
bin tn hiu quang ca nh thnh tn hiu
in lin tc.
My qut s qut theo chiu ngang to
ra tn hiu in ca nh, kt qu cho ra
mt tn hiu in hai chiu f(x,y) lin tc.
BI GING MN: X L NH
www.ptit.edu.vn
GING VIN: THS. TRN THY H
B MN: K THUT IN T - KHOA KTDT1
Trang 31
Ly mu bng scanner
nh c biu din bi hm f(x,y)
nh gc c th ti to c th
tn s ly mu:
f
x
> 2f
xmax
v f
y
> 2 f
ymax
vi f
xmax
v f
ymax
l tn s cao nht
ca tn hiu vo
BI GING MN: X L NH
www.ptit.edu.vn
GING VIN: THS. TRN THY H
B MN: K THUT IN T - KHOA KTDT1
Trang 32
2.2.2. Lng t ha
nh sau khi ly mu s c dng
f(m,n) vi m, n l nguyn nhng
gi tr f(m, n) vn l gi tr vt l
lin tc.
Qu trnh bin i gi tr f(m,n)
thnh mt s nguyn thch hp
lu tr gi l lng t ho.
BI GING MN: X L NH
www.ptit.edu.vn
GING VIN: THS. TRN THY H
B MN: K THUT IN T - KHOA KTDT1
Trang 33
Qu trnh lng t ha l qu trnh nh x
mt bin lin tc u vo bin ri rc u*
thuc tp hu hn [u
1
, u
2
,..u
L
] xc nh
trc, L l mc lng t ho c to ra.
V d:
To nh a cp xm th L=256:
f(m,n) = g [0, 255]
To nh 2
24
th L=2
24
:
f(m, n) = g [0, 2
24
1]
33
BI GING MN: X L NH
www.ptit.edu.vn
GING VIN: THS. TRN THY H
B MN: K THUT IN T - KHOA KTDT1
Trang 34
2.3. MT S PHNG PHP BIU DIN NH
Qu trnh lu tr nh nhm 2 mc ch:
Tit kimb nh
Gimthi gian x l
Vic la chn phn gii thch hp nh
cng p v mn tu thuc vo nhu cu s dng
v c trng ca mi nh c th, trn c s
cc nh thng c biu din theo 2 m hnh
c bn:
M hnh Raster
M hnh Vector
BI GING MN: X L NH
www.ptit.edu.vn
GING VIN: THS. TRN THY H
B MN: K THUT IN T - KHOA KTDT1
Trang 35
2.3.1. M hnh Raster
y l cch biu din nh thng dng
nht hin nay.
nh c biu din di dng ma trn
cc im(im nh).
nh thu nhn qua cc thit b nh
camera, scanner.
Tu theo yu cu thc t m mi im
nh c biu din bng 1 hay nhiu bit.
BI GING MN: X L NH
www.ptit.edu.vn
GING VIN: THS. TRN THY H
B MN: K THUT IN T - KHOA KTDT1
Trang 36
c im:
M hnh Raster thun li cho hin th v
in n.
Thit b thu nhn nh Raster ph hp vi
tc nhanh v cht lng cao cho c u
vo v u ra.
Mt thun li cho vic hin th trong mi
trng Windows
36
BI GING MN: X L NH
www.ptit.edu.vn
GING VIN: THS. TRN THY H
B MN: K THUT IN T - KHOA KTDT1
Trang 37
2.3.2. M hnh Vector
Bao gm cc i tng hnh hc
Ph bin trong phn mm m ha
ng (2D v c bit m hnh 3D)
Kch thc file (khng ph thuc vo
kch c)
Zoom ty (khng b v)
Thun li trong lu tr v thit k
BI GING MN: X L NH
www.ptit.edu.vn
GING VIN: THS. TRN THY H
B MN: K THUT IN T - KHOA KTDT1
Trang 38
2.4. KHI NIMNH EN TRNG, NH MU
nh l tp hp cc im nh, thng tin ca tng im
nh s quyt nh loi nh
C 3 loi nh s:
nh en trng
nh nh phn
nh mc xm
N mc, t 8 n 256 hoc nhiu hn
nh mu
Bao gm 3 trng mu , xanh da tri v xanh
l
BI GING MN: X L NH
www.ptit.edu.vn
GING VIN: THS. TRN THY H
B MN: K THUT IN T - KHOA KTDT1
Trang 39
M hnh mu
Mt con ngi c kh nng phn bit
khong 10 triu mu.
Tuy nhin no b con ngi ch c th
cm nhn c s khc bit ca vi chc
nghn mu.
Cc m hnh mu c s dng ti
hin li mt phn tp hp cc mu nhn
thy c nhng khng phi l tt c
BI GING MN: X L NH
www.ptit.edu.vn
GING VIN: THS. TRN THY H
B MN: K THUT IN T - KHOA KTDT1
Trang 40
M hnh RGB (Red, Green, Blue)
Chp nm 1911 bng ba tm lc , xanh l cy v xanh da tri.
hin th li ba hnh chiu phi c lng ln nhau trong phng ti
BI GING MN: X L NH
www.ptit.edu.vn
GING VIN: THS. TRN THY H
B MN: K THUT IN T - KHOA KTDT1
Trang 41
M hnh RGB
Da vo l thuyt 3
mu Young-Helmholtz
u th k 19
Da vo phng php
phi mu cng.
S dng trong hin th
trn mn hnh.
BI GING MN: X L NH
www.ptit.edu.vn
GING VIN: THS. TRN THY H
B MN: K THUT IN T - KHOA KTDT1
Trang 42
RBG trong my nh - Lc Bayer
Cm bin ch cm nhn cng sng
Cn c lp lc xc nh mu
Lp lc Bayer c s dng nhiu trong my nh
c y thng tin cho mt im nh, mt s
thut ton ni suy c s dng
BI GING MN: X L NH
www.ptit.edu.vn
GING VIN: THS. TRN THY H
B MN: K THUT IN T - KHOA KTDT1
Trang 43
My quay Three-CCD
tng nt v gim nhiu do cc thut ton
ni suy 3 sensor cho ba mu c th c dng
ring bit
S dng ch yu trong my quay chuyn nghip
BI GING MN: X L NH
www.ptit.edu.vn
GING VIN: THS. TRN THY H
B MN: K THUT IN T - KHOA KTDT1
Trang 44
Bayer Three-CCD
S dng 1 cmbin S dng 3 cmbin
Ch lc c 1 mu
trn mi pixel. xc
nh mu tip theo
phi s dng 1 s
thut ton ni suy
sai s trong iu kin
thiu sng, nh d b
nhiu.
Cho ra 3 mu tht s,
cho ra cht lng nh
tt hn, su mu,
sc nt hn, nh t b
nhiu.
BI GING MN: X L NH
www.ptit.edu.vn
GING VIN: THS. TRN THY H
B MN: K THUT IN T - KHOA KTDT1
Trang 45
M hnh mu CMY (Cyan, Magenta, Yellow)
Quy trnh in 3 mu, 1902
BI GING MN: X L NH
www.ptit.edu.vn
GING VIN: THS. TRN THY H
B MN: K THUT IN T - KHOA KTDT1
Trang 46
Ba mu ny l phn b tng ng ca ba
mu gc RGB.
H mu ny s dng phng php phi mu
tr thay v phi mu cng.
S dng ch yu trong in n.
(
(
(

(
(
(

=
(
(
(

B
G
R
Y
M
C
1
1
1
BI GING MN: X L NH
www.ptit.edu.vn
GING VIN: THS. TRN THY H
B MN: K THUT IN T - KHOA KTDT1
Trang 47
Phi mu cng l vic to nn cc mu sc bng cch
chng vo nhau nh sng pht ra t vi ngun sng.
Hai tia sng cng cng thuc hai trong ba mu
gc ni trn chng ln nhau s to nn mu th cp:
+ Lc = Vng;
+ Lam = Hng sm (cnh sen).
Lam + Lc = Xanh l
Ba tia sng thuc ba mu gc cng cng chng
ln nhau s to nn mu trng. Thay i cng
sng ca cc ngun s to ra gam mu ca ba mu
gc.
BI GING MN: X L NH
www.ptit.edu.vn
GING VIN: THS. TRN THY H
B MN: K THUT IN T - KHOA KTDT1
Trang 48
Phi mu tr: l vic to nn cc mu sc bng cch trn cc
mu nh cc loi sn, thuc nhum, mc, cc cht mu t nhin
...
Pha ba mu gc theo phng php ny, gm , vng, lam, cho
kt qu nh sau:
+ Vng = Da cam.
+ Lam = Tm.
Lam + Vng = Lc
+ Lam + Lc = en
Thc ra cch pha mu ny khng cho ph mu rng. Cc mu
trn vi nhau c th lm mt i sc . Pha cng nhiu mu vi
nhau th mu cng xn c, hay cn gi bng t chuyn mn l
b "cht mu".
BI GING MN: X L NH
www.ptit.edu.vn
GING VIN: THS. TRN THY H
B MN: K THUT IN T - KHOA KTDT1
Trang 49
BI GING MN: X L NH
www.ptit.edu.vn
GING VIN: THS. TRN THY H
B MN: K THUT IN T - KHOA KTDT1
Trang 50
M hnh mu HSV (Hue,
Saturation, Value) v HSL
(Hue, Saturation, Lightness)
M hnh mu ny mun sp
xp li h mu RGB hay CMY
theo mt cch d hnh dung
hn.
Trong Hue l tng mu,
Saturation l sc
Value l gi tr cng sng
hoc Lightness l sng (t
en n mu n trng).
BI GING MN: X L NH
www.ptit.edu.vn
GING VIN: THS. TRN THY H
B MN: K THUT IN T - KHOA KTDT1
Trang 51
Khi biu din mu trong h HSV v HSL th l hnh
tr tuy nhin do lng mu trng qu nhiu nn
thng thng ngi ta hin th dng hnh nn
(HSV) hoc hnh nn i (HSL) v chiu bn knh
gi l Chroma
HSL HSV
BI GING MN: X L NH
www.ptit.edu.vn
GING VIN: THS. TRN THY H
B MN: K THUT IN T - KHOA KTDT1
Trang 52
2.5. K thut in nh
Trong sch bo, tp ch, k thut na cng
(half tone) c s dng
BI GING MN: X L NH
www.ptit.edu.vn
GING VIN: THS. TRN THY H
B MN: K THUT IN T - KHOA KTDT1
Trang 53
K thut halftone l k thut chia
nh bc nh thnh chui cc im,
v mu sc lin tc c chuyn
thnh 1 thang v mu sc.
K thut ny s gip to cc hiu
ng nh bng cho bc nh, lm cho
bc nh c cm gic sng hn nh
gc m khng cn thm mu sc
khc.
BI GING MN: X L NH
www.ptit.edu.vn
GING VIN: THS. TRN THY H
B MN: K THUT IN T - KHOA KTDT1
Trang 54
K thut na cng (Halftone)
BI GING MN: X L NH
www.ptit.edu.vn
GING VIN: THS. TRN THY H
B MN: K THUT IN T - KHOA KTDT1
Trang 55
phn gii im trong k thut na
cng c tnh bng lpi (lines per
inch)
Bo thng dng 85 lpi
Tp ch in nt hn vi 135 n 150 lpi
c cht lng nh chun th nh
gc phi c phn gii gp 1.5 ln
nh na cng , nu mun nh cht
lng cao th con s ny l 2.
BI GING MN: X L NH
www.ptit.edu.vn
GING VIN: THS. TRN THY H
B MN: K THUT IN T - KHOA KTDT1
Trang 56
Khuch tn li (Error Diffusion)
L mt dng na cng .
Khuch tn li c thc hin bng
cch so snh mu sc thc t ca 1 im
nh vi mu sc gn nht.
u tin c pht trin bi Richard
Howland Ranger cho h thng gi nh
qua in thoi v in bo.
BI GING MN: X L NH
www.ptit.edu.vn
GING VIN: THS. TRN THY H
B MN: K THUT IN T - KHOA KTDT1
Trang 57
Khuch tn li 1 chiu
Cch n gin nht chuyn nh mu lin tc sang
nh halftone (vi ch 2 knh t nh a cp xm):
Qut nh ln lt tng dng v tng im nh mt.
So snh vi gi tr xm trung bnh.
Nu gi tr xmln hn th thay bng im nh
trng.
Nu gi tr xmnh hn th thay bng im nh
en.
V im nh hoc en hoc trng nn gi tr b lm
trn, phn tha ny c chuyn sang im tip
theo.
Qu trnh tip tc c lp li.
BI GING MN: X L NH
www.ptit.edu.vn
GING VIN: THS. TRN THY H
B MN: K THUT IN T - KHOA KTDT1
Trang 58
BI GING MN: X L NH
www.ptit.edu.vn
GING VIN: THS. TRN THY H
B MN: K THUT IN T - KHOA KTDT1
Trang 59
59
BI GING MN: X L NH
www.ptit.edu.vn
GING VIN: THS. TRN THY H
B MN: K THUT IN T - KHOA KTDT1
Trang 60
Khuch tn li 2 chiu
Khuch tn li mt chiu thng li
nhng ng thng dc khng mong mun.
Khuch tn li hai chiu gip gim li c
trng ny.
Phn d s c khuch tn mt phn c
xung dng di
(

1 1
2 #
4
1
# l im nh ang c x l
BI GING MN: X L NH
www.ptit.edu.vn
GING VIN: THS. TRN THY H
B MN: K THUT IN T - KHOA KTDT1
Trang 61
Ma trn khuch tn c th c tinh chnh hn na:
Ma trn ca Floyd v Steinberg:
(

1 5 3
7 #
16
1
- v # l nhng im nh v ang c x l
Ma trn ca J F Jarvis, C N Judice v W H Ninke
t Bell Labs:
(
(
(


1 3 5 3 1
3 5 7 5 3
5 7 #
48
1
- v # l nhng im nh v ang c x l
BI GING MN: X L NH
www.ptit.edu.vn
GING VIN: THS. TRN THY H
B MN: K THUT IN T - KHOA KTDT1
Trang 62
V d
Ngng = 128
22 < 128 Gi tr ca pixel = 0
error = old new = 22
3/16 5/16
7/16
1/16
error
255 0
68 187
210
56
255 22
64 180
200
55
255 0
64 180
200
55
BI GING MN: X L NH
www.ptit.edu.vn
GING VIN: THS. TRN THY H
B MN: K THUT IN T - KHOA KTDT1
Trang 63
Nhng loi khuch tn khc
Trong nh mu:
Thut ton nh trn c th c s dng cho tng
knh mu khc nhau
Tuy nhin nn chuyn qua h mu HSV hoc HSL
trc
V s khc bit trong sng d c pht hin
bi mt ngi hn.
V h thng nn khuch tn li da vo sng
hn l sc hay nht.
Phn chnh trong qu trnh chuyn mu cng
nn c tnh ton v chuyn sang im nh tip
theo.
BI GING MN: X L NH
www.ptit.edu.vn
GING VIN: THS. TRN THY H
B MN: K THUT IN T - KHOA KTDT1
Trang 64
Vi nhiu knh xm hn:
Khi s dng vi thit b u ra (my
in, mn hnh) c nhiu hn hai mc
sng.
Thay v s dng mt ngng th
nhiu ngng s c s dng, gi tr
s c lm trn ti ngng gn nht.
BI GING MN: X L NH
www.ptit.edu.vn
GING VIN: THS. TRN THY H
B MN: K THUT IN T - KHOA KTDT1
Trang 65
Mt s nh dng c bn
BMP (BITMAP)
Chun raster dng trong MS-Windows
GIF (Graphics Interchange Format)
Nh gn v dng trn web
nh c m ha theo 4 bc
Khi c gii m tng bc s c hin th.
iu ny gip vic ti nh hiu qu hn v ngi
dung c th dng vic ti nh nu thy nh khng
thch hp.
IMG
nh en trng
BI GING MN: X L NH
www.ptit.edu.vn
GING VIN: THS. TRN THY H
B MN: K THUT IN T - KHOA KTDT1
Trang 66
JPEG (Joint Photographic Experts Group)
Nn ti a nh (t l nn t 5:1 n 15:1) :
Ti u ha cch lu tr d liu.
Xc nh v loi b ti a d liu tha.
V l nn khng bo ton nn cht lng nh
cng b nh hng khi t l nn cao.
TIFF (Tagged-Image File Format)
6 kiu m ha (khng nn, Huffman, Pack Bits,
LZW, Fax Group 3, Fax Group 4)
3 kiu mu (en trng, a cp xm, mu)
BI GING MN: X L NH
www.ptit.edu.vn
GING VIN: THS. TRN THY H
B MN: K THUT IN T - KHOA KTDT1
Trang 67
PNG (Portable Network Graphic)
L phin bn m ngun m thay th cho GIF
Nn c bo ton nn ph hp vi nh c nhiu
mng ng mu ln.
Ph hp vi web v c kh nng hin th tng
bc
C thm knh alpha th hin trong.
RAW
Xut hin trn mt s my nh tuy nhin c th
khng cng chun
C th c nn c bo ton
BI GING MN: X L NH
www.ptit.edu.vn
GING VIN: THS. TRN THY H
B MN: K THUT IN T - KHOA KTDT1
Trang 68
SVG (Scalable Vector Graphics)
W3C (World Wide Web Consortium)
Khng c nn tuy nhin v cu to bi
XML, SVG c th c nn bi gzip
AI (Adobe Illustrator)
CDR (CorelDRAW)