PHÁT TRIỂN MỘT SỐ PHƯƠNG PHÁP NHẬN DẠNG ẢNH VĂN BẢN TIẾNG VIỆT
VŨ HẢI QUÂN
Trang nhan đề
Mục lục
Chương 1: Giới thiệu.
Chương 2: Các kỹ thuật xử lý ảnh văn bản.
Chương 3: Các phương pháp đối sánh mẫu.
Chương 4: Các kỹ thuật phân lớp mẫu dựa trên xấp xỉ hàm.
Chương 5: Mô hình Markov ẩn.
Chương 6: Một số phương pháp nhận dạng tiếng Việt.
Chương 7: Kết quả thực nghiệm.
Chương 8: Kết luận và hướng phát triển.
Tài liệu tham khảo
41 trang |
Chia sẻ: maiphuongtl | Lượt xem: 2174 | Lượt tải: 0
Bạn đang xem trước 20 trang tài liệu Luận án Phát triển một số phương pháp nhận dạng ảnh văn bản tiếng Việt, để xem tài liệu hoàn chỉnh bạn click vào nút DOWNLOAD ở trên
nhs6 h6a.Ban
d~urie'nhanhla'ym~u(j dQphangiai cao,saud6 de'ndQphangiai tha'pbon.C\l
th€ la truoclien,<lnhdu'QclammabfingbQIQclow-passvasaud6riEnhanhla'y
9
mill con.D~dongiangiasar~ngLlx=Lly=Ll.Ne'usadl;mgbQ19Ctftns6thipFIR
(FiniteImpulseResponse)codQdai L.Ll, dinhly liy mill phatbi~ur~ngdn s6liy
mill con(l/L1sub)phaiIt nhit b~nghailftntftns6nguongcilabQ19Clow-pass.Nghla
la 1/Llsub>2/(L'Ll)ho~cL>2'(Llsub/Ll),trongdo Llsub/Llla h~s6liy mill con.Vi
d~,ne'umu6nliy mill continhi~uvoih~s6la 3,bQ19Clow-passphaitlnhm5igia
tq outputmill b~ngcachH1YtIlingblobit nhit 6 giatri inputmill. MQth~s6liy
mill con b~ng2 di;ltdu<;lcb~ngcach liy trungblob 5 mill inputb~ngmQtbQ19C
low-passki~uGauss.LOi;liky thu~tnay hi~ndangdU<;lcsa d~ngd~phanlOi;liky tv
trongnhlingphilom~mnh~ndi;lngkytv (OCR)thuongmi;lichlnhxacnhit.
i(x)t
1T
0 l l x
i(k) t
I~t0 ~
i/x)t
It
oL /---,' ~
il(k)b
- I I I
I ' , ,-~
';. ~uuur---~ ...~
ztEimmr---b k. "unuu. .
Hinh 2.2Anh huangcuavi~cILiUthongtinvi tri
Bay giGchungtase chuy~nsangvin d~xacQinhdQphangiai.MQteacht6ng
quat,dQphangiaiGangcaothlthongtindu<;lchmgiliGangnhi~u.Tuy omen,mQt
dQphangiai quacaoclingco th~lamlQke'tciu n~ncilavanban.Honnlia,dQ
phangi,Hcaoclingdoihoithie'tbi d~t i~nvaphucti;lPbon,duarakh6ilU<;lngdli
li~ukh6ng16,khongdn thie't.Cu6i clIng, ch9nh!a dQphangiiii dU<;lcxac djnh
b~nghai ye'ut6: nQi dungcila vanbanva m~cdichcila nhlingthaotaGtie'pthee.
Th~tv~y,mQttai li~uvanbanin voimQtfontIondoihoi liy mill (j dQphangiiH
10
tha'pbond€ c6th€ dQcdu'Qcsovoi vanbantu'ongtv nhu'ngvoifontchii'nhabon.
..
Ne'uthaotactie'prheala'ym~ula nhjphanh6a,tadn dQphangiai caoboneho
cacmucxam. SimondenghjchQnL1sacehosaukhinhjphanh6a,ca'utrucdong
manhnha'ttronganhvan banphairQngit nha't3pixel d€ tranhgay kh6 khantrong
nhii'ngthao tac tie'prhea.C6 nhii'ngdQphan giai khac nhaudff du'QCde nghj sii'
dl,mgchonhii'ngungdl,mgkhacnhau.Vi d1,l,Dengelsad1,lngmQtdQphtingiaira't
tha'p(75dpi)trangbu'ocphando~nchoanhthu'tin.Trongkhinhii'ngh~th6ngOCR
c6dQchinhxaccaol~isii'd1,lngdQphangiaitu300de'n400dpichonhii'ngvanban
"thu'ang".
51,(dad~ngcuanhii'ngdQphangiaidu'QCsad1,mgbdicactaegiakhacnhaudenghj
mQtungd1,lngphuct~p baag6mnhieutaeV1,lconmam6itrangso'd6c6th~thvc
hi~nt6tbangeachsad1,lngdQmQtphangiai thichhQp.Nhu'v~yanhband~udn
du'Qcla'ym~ud dQphangiaicao.DQphangiaitha'pboncuan6saud6c6th~d~t
du'Qcbangcachsii'd1,lngky thu~tla'ym~uconmotabentren.
N6i ng~ngQn,tie'ntrlnhIa'ymiiula bu'ocdn thi&tkhichuy€nd6imQtvanbanra
d~ngso'boa.N6 c6th€ gayma'thongtin.Tuynhiensvma'tmatnayc6th€ du'Qc
dieukhi€n banganti-aliasingvoinhii'ngthamso'du'Qcki€m soarbangdjnhIy la'y
miiu.Ky thu~tu'ongtvclingc6thi dl(Qeapd1,lngkhichungtamu6nla'ym~ucon
mQtanhso'h6a- la'ymiiud dQphangiaiband~ucaobon.Djnhly Ia'ym~ukhong
doihai vanbanphaidu'Qcla'ymiiud mucdQphangiainacoDieunaycu6icling
phl,1thuQcVaGung d1,lng.
2.2.2Lu'<jngh6a
Mftu,sinhbditie'ntrinhIa'ym~u,nh~nnhii'ng iatrithvc,lient1,lcvanhu'v~ydn
phaidu'QcIu'QngboathanhmQtso'hii'uh~ncacmuexamd~c6thi xii'Iy bangmay
tinh.Ne'us6muexam,L bang2, 1u'<;Jngh6acan gQila nhjphanh6a.Nhj phanh6a
la mQtthaotacph6bie'ntrongphantichanhvanbanvi haily do.Thu nha't,h~uhe't
cacanhvanbantronggi6ngnhu'chic6haimall,denvatrang.Nhl(v~yY tu'dngnhi
f
L
phanhoacovetlfnhien.Thuhai,nhiphanhoalamddngianra'tnhi~unhungthaa
lactie'pthea,nhuphanda~nvanh~nd~ng.NhuV?y,trudelien chungIa sexem
xettie'ntdnh1uQnghoat6ngquatmQteachng~ngQnvasaildo t?P trungVaGnhi
phanboa.
BinaryCode r(v)
III
lIO
101
100
011
010
001
000
r T
r: t
r ..j..
r~ +
.. I
r3 T
!
r2 i
Saturation-
rI _. J
"'-
r.-
[) ",-to.. I I I I i I
Yo VI v? V1 V4 Vs v6 V7 Vg Sample Value
Hinh 2.3.Hamd;j.ctrLlngcuatrinhILlQ'nghoa
v~m~tv~t1y,1uQnghoaduQeth\1'ehi~nbAngmQtthie'tbi di~ntu:gQi1abQehuy€n
d6ituclngt\1'-s6,g~ntrangnhungthie'tbi sO'hoahi~nd~i.Hlnh2.3minhhQamQt. ~
hamd~etrungeuamQtthie'tbi 1uQnghoadi€n hlnh.Thie'tbi d~ebi~tnayehuy€n
d6im6igiatrim~uth\1'ethanhmQtrangtammueriengre,duQemahoabAng3bit
sad\mgmahoanhiphan.Nhunggiatri Vjva rj gQi1.1caemuequye'tdinhvatai
thie'tmQteachtudng(tng.TrangmQtsO'thie'tbi sO'boa,nguaisl'td\mgcoth€ ehQn
s6muexam(bAngsO'muetaithie't),thuang1amQtlily thuaeua2.Trangnhungh~
th6ngkhae,consO'nayduQecO'dinh(j mQtgiatrikhalOn,256.Thie'tbi 1uQngboa
tronghlnh3 d6ngnha'trangnhungmuequye'tdinheachd~unhau.Nhungthie'tbi
lu<;Jnghoat6ngquatdu<;Jcxemxetbell dudikhongdn phai rheaquy1u~teh~tche
nay.
Thongthuang,nguoitath\1'ehi~n1u<;Jnghoatronghai bude.Bude thunha't,mQtcan
sO'lOn,256eh£ngh~n,caemuexamdu<;Jesa dl;mgd€ hamd~etrungcuathie'.tbi
lti<;Jngboahh nhumye'ntlohvdidQbaaboa.Trangoudetbu'hai,mQtcansonha
12
bon,tit2 de'n8, caemuexamdu<;1csa dl:lllgdlfavaoke'tquaeuabuoethunh!t.
f)i~mchinnye'ueuacachtie'pc~nhaibuocnayla: buocthunh!trho tacachbi~u
di~ns6eoth~dungehonhil'ng iai thu?tlinn vi nhuhistogramming,d~xacdinh
mQthamd~ctru'ngt6iu'urhobuocthuhai.
Tieuchuffnrho linn t6i u'uthuangdu<;1esadl:lllgnh!t la sais6 blnhphuongtrung
blnh(MS£)giil'agiatrim~uvvamuetaithie'tr(v).
E{e2}=E{[v-r(v)[}=f[v-r(v)[ p(v)dv (2.1)
Trangdop(v)la hamm~tdQxaesu!teuabie'nng~unhienv,co th~la dQu'utien
du<;1ebi 'trudceuanhil'ngvanbanho~eduQcx!p Xlb~nghistogrameuanhil'ngia
trim~utrangdeh tie'pe~nhaibude.Vdi mQts6ehotrudeL caemuexam,MSEeo
th~du<;1cbi~udi~nbdi :
E{e2)=I to.(v-r)2 p(v)dvJ (2.2)
dar(v)=rj lah~ngs6trongdo~nlvJ'vj+IJ.
Vji p(v) ehotrudeva s6 caemuc tai thie'tL c6 dinh,cae muc quye'tdinh
vj,j=l,...,L-l va eaemuetai thie'trj,j=O,...,L-l clfcti~uhoaMSE tuantheo
nhil'ngquailh~gall:
r I +r
v;=;-2 ;; j=l,...,L-l (2.3)
v.,
Jvp(v)dv
r;=:;o' ;j=l,...,L-I (2.4)
fp(v)dv
Vj
Tuynhien,kh6ngconhil'ngeaehgiaiquye'tdudid~ngkhepkinnaot6nt~itritkhi
chapnh~nmQts6 phepx!p xl. M~tkhae,nhil'ngphuongphaps6 phaidu<;1es1l'
dl,lng,d~nde'neachtrlnhbay d~ngbangeuaVjva r.irho nhi~uphanb6 tham86
ehuffn,nhuGauss,LaplacevaRayleight.
13
Bay giOchungta xernxet tru'onghQpngo~i1~nhu'ngquailtrQngvoi L =2. Do 1a
tru'onghQpnhiphanboaanh.Khi doMSE trdthanh:
E{e2}=f(v-ro)2p(v)dv+r (v-rl)2p(v)dv0 I (2.5)
Gia sadingp(v) co th€ du'Qcu'oc1u'Qngtit histogramva Vo.V2tu'ongungvoi VmimVmax'
Con 1~iba tharns6 dn du'Qctinh loan, do 1aTo,rI va VI' Tharns6 VI du'QcgQila
ngu'ongnhiphanboa.Honntl'arivI) va rlVI) qic ti€u MSE, voi rnQtgia tq cho
tru'ocilaVI,dongian1anhtl'ngiatritrungblnhtrongdo~ntu'ongung(2.4):
ro(vl)= £vp(v)dv
r p(v)dv
r.(V ) - rvp(v)dvI 1 - rp(v)dvI
(2.6)
(2.7)
Nhu'v~ydil d€ bie'nd6i VI titVode'nV2.MSE du'Qctinhb~ngeachthayrova rI b~ng
rivI) va rlvI) tu'ongungvachQnVI* sacchoMSE la qic ti€u.
Otsud~nghirnQtcachtu'ongttfnhu'nglieu chu~ndongianhonv~rn~tinhloan
dtfatrenphantichbi~ts6.TrongGongthUGnay,MSE tu'ongdu'ongvoiphu'ongsai
lOptrongO"~/(VI)'Ne'uO"~/(VI)du'Qcb6 sungVaGphu'ongsai lOpgitl'aO"l(VI),ta
du'QcloanbQbie'nd6i 0"/ (dQCl~pVI)'Nhu'v~y,thayVIctfcti€u MSE,giaithu~t
cilaOtsuq1'cd~iphu'ongsaigitl'alOp:
VI* =argmax{po(v1)[,uo(v,)- ,urf + PI (Vl)[,ul (VI) - ,ur]2}
Trangdo
Po(VI)=m(vl)
PI(VI)=I-m(vl)
,uo(VI)=,u(vl)/m(vl)
,ul(VI)= ,ur- ,u(VI)
I-m(vl)
,ur = ,u(V2 = vma..,J
Va
14
(2.8)
(2.9)
(2.10)
(2.11)
(2.12)
(2.13)
UJ(VI) =fp(v)dv"
J.L(vJ = r: vp(v)dv
Bi~uthuc(2.8)co th~dU<;5cdongianthanh:
(2.14)
(2.15)
VI * =argmax
{
[J.LT.UJ(VJ - J.L(vI)f
}UJ(vl)[l-UJ(v,)]
(2.16)
Khi v/ dadu<;5cxacdinh,caemuctai thie'trova r] co th~du<;5ctinhb~ngcachsa
dl:lllgbi~uthuc(2.6)va(2.7),ho~cmQteachtuongQUang:
1'0 * =J.L( VI *) I UJ( VI *)
r * - J.Lr- J.L(vJ*)I -
1-UJ(vl*)
(2.17)
(2.18)
Th~tfa,cont6nt~imQts6lieuchuinlu<;5nghoakhac,ch~ngh~nentropy,clingdlfa
trenhistogramcuacacmucxam.Histogramco th~du<;5ctinhtu loanbQanhvan
banho~ctumQtHinc~ndiaphuonggioih~nxungquanhdi~manhdangxet.Cac
histograml~nhungth6ngke khonggianb~cnha't.MQts6 th6ngke b~chai,sa
d\lllgcaematr~nd6ngxU<lthi<%nclingda du<;5cnghiencUutrongva'nd~nhiphan
boa. Noi chung,nghienCUllnhungke'tqua lu<;5nghoa la kho khan VI tinhkhong
tuye'ntinhcuahamd~ctrungtrongtrlnhlu<;5ngboa.Ne'uL lOn,ch~ngh~n16,
nhungke'tquacuanotraDendangchuy vacoth~gayranhungsail<%chmeamo
khongth~cha'pnh~ntrongmQts6ungd\lllg.VI nhiphanhoara'tthudng ~ptrong
Linhvlfcphanrichanhvanban,tase xemxetchi tie'tnhunganhhuangcuano
trongmQttrudngh<;5pdi~nhlnh.
Chncling vi d\l trongphftn2.1.Gia sa ding la'ymill i(x) d~tdU<;5cq~ai,(x), la
phienbanlQclow-passcua i(x), xemhlnh2.4. il(k) la tinhi<%ula'ymill nhungchua
dll<;5Cnhiphanhoa(ho~cla'ymill va lu<;5nghoavoi mQtgia tq ra'tIOnL). Gia thie't
r~ngnguongnhi philo hoa VI du<;5ctinhbai giai thu~tOtsu va la'ygia tri V!I)=~.
Phienbannhiphanhoacuai1(k) chIdinhbCiii}J)(k)vad6ngnha'tvoi i(k).Giatri
nayd~tdu<;5cb~ngeachla'ymftutrlfctie'pi(x)makhongsad\lnglQcanti-aliasing.
15
Nhoding i(k) duQetrlnhbaykernv~m~t hill thongtinvi tri.Ham if2)(k) Ia phien
bannhiphankhaed~tduQeb~ngeachgiastrr~nggiaithu~tOtsuclingea'pmOtgia
tri nguongkhaeV~2)=X. D6tha'yr~ngtruonghQpt~nha't,buoenhiphancoth~
mangl~isais6v~vi tri la .:tL1I2.Nhuv~y,t6ngeOngsais6v~dOrOngcoth~eao
b~ng,1.Ne'ui(x)bi~udi6nph~ngiaonhaueuamOtea'utruedo<;lnth~ngmanhvoi
dOrOngthl;t'esl;t'eua2,1,truonghQpt~nha'tudnglingvoi sai s6 co lienquailla
50%!
i(x). r- -~L~lJ. - - .
) '--~
ii' 1 ~ ~ '
(2)'I / ,-- - "
.
'=3/4/' I -~ I~I. -----
0 nor--"- - v"'e on,,(k~--~=f-_ui- - . 'F:~ii-U ,..
. "",']. i i-LL.
i~2\k~
i . r I() .
x--.-
k-.
I
1- . k.-
Hinh2.4.Meo!nOvitridonhiphanhoa.
Toml~i,nhii'ngke'tqualuQnghoaco th~khongduQechuy trongh~uhe'tnhii'ng
anhvan banne'uchungtastrdl;mgnhi~uhdn4 bitchom~u(L =16mucxam).Voi
nhii'ngvanbanehliacacanhtl;t'nhien,nhuanhchVpcaethenh~nd~ng,L nenduQC
chQnIOnhdn.Nhiphanboa,la truonghQpd~ebi~teualuQnghoavoiL =2,cofch
trongnhi~ukhiaqnh. No giamluQngdii'li~uhilltrii'(xemph~nsail),vaddngian
nhii'ngtbaolactie'pthea,nhuphando~nvanMn d~ng.Tuy nhien,nocoth~dua
densl!mil matthongtinquailtrQngehonhii'ngea'utruedo~nth~ngnha-ea'utrue
tlmtha'ytrongnhii'ngkyt~tincokichthuoeaha.
16
2.2.3Mah6aanh
MQtanhvanbandU<;1cla'ym~uvalU<;1ngboacoth6chuamQtlU<;1ngduli~ukh6ng
15,di~unayco th6gaynennhungva'nd~v~m~tlu'utru,chuy6nd6i vaXl(ly.
Phgnnayduaravi~cmahoaanhnhumQtgiaiphaprhova'nd~nay.Chungtachi
quailHimtdinhunglu<;1cd5mahoakhongma'thongtin,traingu<;1cvdinhunglu<;1c
d5ma'thongtin.Ma hoakhongma'thongtinnghlala anhbandgucoth6du<;1ctai
t(,10mQteachhoanhaotuphienbanmaboa.Honnua,chinhunganhnhiphanse
dU<;1cxtrly, dovai tron6i b~tcuachungtrangnnhvl,l'cphanrichanhvanban.
Co hai di6mchinhcua ma hoa anh.Trudc he'tla mo hlnh lang gi~nggall.Ch~ng
h(,1Q,nhungdi6manhk~cuamQtanhco khuynhhuangnh~nrunggia tri,tdng
ho~cden.Tinhcha'tnaydoi khidu<;1cgQila "duthuakhonggian".MQteachd~c
bi~tdongianmahi~uquakhacd6 l<;1idl,mgtinhduthuakhonggianla xemxet
nhungduongch':lYk~nhaucuacaedi6manhdenva tr~ngthayVI xemxetchinh
caedi6ma,.nh.Ke'tquanayflamtranglU<;1cd5mahoarun-length.Di6mthuhaila
mahoaentropi.No khaithacd~cdi6mla mQtsoca'uhlnhkhonggiancoth6xua't
hi~nthuongbonmQtso khac.Y tudngg5mstrdl,mgnhungtumahoang~nrho
nhlingca'uhlnhthuongg~pvanhungtumadaibonrhonhungca'uhlnhhie'm,ke't
quala duli~ulu'utrutrungblnhit bon.Trangphgntie'pthea,chungtasedungmQt
vi dl,ldongiand6 minhhQamahoarun-length(2.3.1)va mQtlU<;1cd5 mahoa
entropidu<;1cbie'tduditengQimahoaHuffman(2.3.2).
2.2.3.1.Ma h6arun-length
Ma hoarun-lengthg5mbi6udi€n anh,rheatungdong,bangnhungvi trivachi~u
dai cuanhungduongch':lYmaudenk~nhau.Nhuv~ymQtduongch(,1ydu'<jccm
dtnhbangmQtc~pso.Sothunha'tchivi tricuadi6mcinhmatidend~uliendoivdi
bientnii cliaann,trangkhisothlihaibi6udi€n socacdi6manhmaudenk~nhau
tieprheadi6md~ulien.Moi dongduQcke'thucbangmQtso,chingh(,1nla0,bi6u
di€n EOL (ketthucdong).Nhuv~ymQtdongtrongbi6uthibdimQtkyt1!EOL.
17
,....-
TronghinD2.5,dongthunha'tla tr6ngva nhuv~yduQcbi~udi~nbdi mQtEOL.
Duongch~ydftutiencuadongthuhaiba:td§udcQthuhai,co7di~mannden,va.
nhuv~yduQcbi~udi~nbAngmQtc~p(2,7).Tudngtv,duangch~ythuhaicuadong
thuhaiduQcbi~udi~nbAng(13,2).Nhuv~ydongthuhaichicohaiduangch~y,va
mQtEOL theesail c~p(13,2).Tie'ntrinhtie'pt1;1cde'nkhi chungta de'ndongcu6i
rung. Cuoi rung,chungtaduQcke'tquanhusail(EOL duQcmahoa la 0):
16
f()
Hinh 2.5.MQtVIdv v~anhnhiphan
Nhuv~y,hinD2.5QuQcbi~udi~nbdimQtday50so'.Ne'usa d1;1ng4 bitd~bi~u
di6nm6iso'till toanbQ ph~mvi [0,13],do~nmake'tquaseco4 x 50=200bit,
daihoneachbi~udi6nchu§:nband§u:10x 16=160bitLTuynhien,coth~tha'v- J
ding ph<;tmvi [0, 13]kh6ngduQcsii'dt,mgtO~illbQva trongthvct€ chi t~phQpbon
s6 {O,2, 7, 13}la dn thie't.Nhuv~y chI dn hai bit d~ma hoat~p hQpnaybiing
phepgan,vi d1;1,
18
0
(2, 7) (13, 2) 0
(2, 7) (13, 2) 0
(2, 7) (13, 2) 0
(2, 7) (7, 2) (13, 2) 0
(2, 2) (7, 2) (13, 2) 0
(2, 7) (13, 2) 0
(2, 2) (7, 2) (13, 2) 0
(2, 2) (7, 2) (13, 2) 0
0
10
.....
0 ->
2 ->
00
01
7 -> 10
13 -> 11
DI nhienphepgall phai du'<jesiip xe'pho~ctruy€n mQteachthichh<jp.Bay giOanh
c6 th6du'<jcbi6udi~nchib~ng2 x 50=100bit. Ki6u phepgall nay trangth1;1'cIe'
t':lathanhd':lngbandfiucuaphepmah6aentropi.(xemphfintie'prhea)
Ton t':linhi€u phienbankhacnhaucuaphepmah6arun-length.Vi dl,l,thayVIma
h6avi td cuadu'angch':lYbdikhmlngeachtuy~td6ieuan6d6ivoibientrai,chung
taclinge6th6mah6an6bdikhaangeachtuy~td6id6ivoi du'angeh':lYtru'oecua
clingda':lnthJng.Da tinhdongi.lnvakhongma-thongtint1;1'nhien,phepmah6a
run-lengthclingc6th6du'<jesadl;mgffiQteachtr1;1'ctie'ptrangnhii'ngthaotaexa Iy
.lnhnhu'IQcnhi~u.Vi dl,l,m6idu'angeh':lYng~nkhongc6Iane~ntrangdongtru'oe
cling nhu'trangdongtie'prheae6th6du'<jela':li,khongquailtamde'neachbi6udi~n
chufin.
Ma h6arun-lengthla ffiQteachd6khaithacs1;1'd1;1'thilakhonggianeuacae.lnh.N6
khongxemxets1;1'du'thilagiii'acacdongk€ nhau.51;1'du'thilagiii'aeacdongnayc6
th6du'<jckhaithacb~ngeachsad~ngnhii'nglu'<jedomah6ac6th6d1;1'daantru'oc,
nghIala sa dl,lngdii'li~ucuadongtru'oed6 d1;(daandongsailva mah6achi la
nhii'ngkhaebi~t.Vi dl,l,dongthabatranghlnh5 tu'on"gt1;fdongthahaivanhu'v~y
khongdn dlt<jCmah6a;chimQtilmab6sungdu'<je100trii'ha~etruy€n.MQtkhai
thacdfiydu tinhdu'thilakhonggianla ma h6anhii'ngdi~mbieneuaanh.Tuy
nhien,bQgiaimasaild6phainh~ndu'<jcroanbQanhtruoekhin6c6 th~giaima
dongdfiutieDvanhu'v~ydn mQtvitngd~mIOnbon.
2.2.3.2.MaHuffman
Ma Huffmankhaithactinhphanb6khongdongd€u eua'nhii'ngkhaDangtu'<jng
IfltngtrangmQtthongdi~p.NghIala, caeky t1;(thu'angxua-thi~ndu'<jcbi~udi~n
b~ngnhii'ngtil mangiintrangkhinhii'ngtil madaidlt<jesadl,lngchocacky t1;fit
19
xu.1thi~n.Ke'tquala dQdaitu trungblnhng~nhdn.Nhuv~ydi€m chinhye'ula
ki€u tu mavdi dQdaic6th€ thayd6idt«;5c,dvatrennhungk..l}aHangtu<;5ngtru'ng.
Trudclienchungtasexemxetphepmah6avasaild6la phepgiai IDa,di€u nay
kh6ngddngiannhutru'ongh<;5pmah6arun-length.
Vi~cxaydvngnhungtumag6mhaitie'ntrInh,rUtg9nvaphanchiaoXetvi d1,1t~p
h<;5pcacs6 {G,2,7, 13}thudU<;5ctuphepmah6arun-length(xemhlllh2.6).C6th€
llh~nth.1ydingdn s6cilachungkh6ngb~ngnhau.Ta ses~pxe'pl,;lirheathlitlf
giamd~nxacsu.1t(t~ns6tudngd6i)vagallcackyhi~u{Si;i =1, ...,4}chachung.
Xet caccQtthlinha'tvahaitronghlnh2.6(a).Trangtie'ntrlnhrutg9n,take'th<;5p
haiky hi~utftns6nh6nh.1thanhmQtkyhi~umdic6xacsu.1tla t6ngcilahaixac
su.1t.Di€u naygiambdtmQtkyhi~u.
(l~I~.'-: ::~J~=-:J~
~-_; m_-r8;50-~~-
~!~--;:;{ 0.2°.
I - ,---~i..L m-
l_._~_~
-.,
0.52I
1
(b)
0
Hinh 2.6Vi dl,lphepmah6ahuffman.
(a)tie'ntrJnhrutg(;>n,(b)tie'ntrJnhphanchiao
T~ph<;5pmdi cac ky hi~udU<;5cs~pxe'pl<;limQtl~nnuarheathli t1,1'giamcila cac
xac su.1t.Di€u nay haant.1tlftn l~pthli nh.1tcila tie'ntrlnhrut g9n.Tie'pt1,1ctie'n
trlnhde'nkhi chaconhaiky hi~u,hlnh2.6(a).Trangtie'ntrlnhphanchia,caeky
hi~udt«;5et<;labaygiodu<;5cphanehiamQtcachd~quy.Luc nay,cactumadu<;5c
xaydvngdftnb~ngeachthemcacbitGva 1VElacacke'tquaphanchia,xemhlnh
20
I
i
P(s-)
--:'l: 2 I - --0.48 1 "'----0.48 1 .....,.0.52---- ------------- "
I $2:0 01 <--0.20 01 -'. 0.0.32 0<1" . 0.482.------
$3: 7 000 '0.16 O(V
o'
'0.20 01 1
! $ -t: 13 001 -<"0.16fool-----------
2.6(b).Cu6icling,tathudU<;1cmQtt~ph<;1pcaetITmacocacdQdaico thethayd6i
{Sl : l'S2:01,s3:000,S4:0Ol}.£>Qdai trungblnhtfenky hi~ula:
L =IJ.p(s;)
i
=1.0.48+2.0.20+3.0.16+3.0.16
=1.84bit/
(2.19)
Nhodingmahoarun-lengthcilaanhtranghlnh2.5t~ofa 50ky hi~u.Nhuv~yma
hoaHuffmanchocaeket quamahoarun-lengtht6ngcQngla 1.84.50=92bit.
£>i€unaydu<;1csosanhvoi 160bitdoih6i choeachbi€u di8nchu§n.Lu'uy f~ng
100bit d~tdU<;1caph~ncu6iclingclingla mQt10~imahoaentropi.NhungsO'chua
sad~lllgiua0va13kh6ngconhungtITIDa.
Vi~cgiaimadu<;1ctht;t'chi~nquacaygiaiIDa.Di€u nayclingdU<;1cKaydt;t'ngtfong
lien trlnh phanchiaoM6i phanchia du<;1canh x~thanhmQtki€m tfa d€ xac dinh
xembit tiep rheala 0 hay I, hlnh2.6(b)va 2.7.M6i la cila cay bi€u di~nmQtky
hi~u.Tientrlnhgiaimab~td~ua g6ccay,nuta.CacduangdidU<;1cxacdinhb~ng
caclu6ngbit.Bit ky khinaod~tdenmQtnuthi, mQtkyhi~udU<;1cphatfa valien
trlnhtfal~ig6c,b~tdfiugiaimamQtkyhi~umoi.
~ SlRoot ~ /. ~a ~
o~ 0 G
Hinh2.7.Caygiaima
Vi dlJ, haymahoahaidongdiu eilahlnh2.5thanhmQtlu6ngbitsaildomahoa
chung.Ma hoarun-lengthduafachu6icaesO'sailday: 0,2,7, 13,2,O.V€ m~tk:Y
hi~u,chungta du<;1c525j53545j52.B~ngeaehsa dlJngmaHuffman hlnh2.6(b),chu6i
du'<;1cchuy€n thanhlu6ngbit: 011000001101.Tien trlnhgiai ma su dlJng cay giai
21
mavab~tdftud g6c.Khi bitdftutieDla0,chungtade'nnutb.Bit thuhai1a1.Nhu
v~ychungtade'nkyhi~uS2,truyennoill, vatrdl<;lig6c.Bdi vi bitthubala 1- de'n
ky hi~uSI>truyennodi vatrdl<;lig6c.Tie'ntrinhnayduQctie'pt1;1cde'nkhimQibit
duQcdQc.Cu6i clIng,chungtaduQcchu6icacky hi~uS2S]S3S4S]SZtudngungvoi
chu6icacs60,2,7,13,2,O.
De'ngiil'ath~pDieD70,maHuffmanduQcxemnhucacht6tnh§t.Trangthlfcte',
maHuffmanchi t6iu'ukhicacxacsua'tcuakyhi~ula caclily thuanguyendudng
cua(112).H<;lnche'naygftndaydaduQCgiaiquye'tb~ngmQthQmamoi,cacmas6
hQc.
Ma hoaanhcomQtItchsttlaudoivahi~nnay,nhieuluQcd6mahoathlfcte'duQc
chu.1nhoabdiUy banTuva'nDi~ntha<;livaDi~nbaaQu6cte'(CCI1T)vaT6chuG
Tieu chu.1nQu6cte'(ISO).DuoislfbaatrQcuahait6chuGnay,JBIG ciliaramQt
chu.1nchacacanhnhtphanva JPEG ciliarachu.1nchacacanhmUGxam.Vi d1,1,
phuongphapcuaJBIG sttd1,1ngcachxaydlfngdQphangiai khonggiantangdftn
thayvi cachma-run-length,thea sanbdimQtbQmahoas6hQcthichnghithayvi
bQma hoaHuffman tTnh,sttd1,1ngtrangvi d1,1truoc.ddQphangiai200dpi,JBIG
thoduQcty l~Dengiil'a5 va62chacactaili~uthudngm<;likhacnhau.Nhlnchung,
ty l~DentangrheadQphangiai.
, K ~?
2.3 PHEP BIEN 001ANH
Bie'nd6ianhla mQtthaataGxttly anhinputthanhanhoutput.Nhuv~yphepbie'n
d6iduQcd?ctabdiquailh~input-output,matinhtlfnhienph1,1thuQcvaam1,1cdich
cua thaatacoNhil'ngbie'nd6i hinh hQC(m1;1c3.1) co th~ph1,1cV1;1m1,1cdichdieD
chinh nhil'ngslf sai l~chmeamo tuy rheaanh nh~nduQcva chu.1nhoachil'vie't
l~ch.LQc(m1,1c3.2)If!thaataGcanbantrangxttlyanhvacoth~giupciiitie'nvi~c
tachanhDen(ml,lc3.3).Phathi~nbiend6ituQng(m1,1c3.4)valammanh(m1,lc3.3)
la hai (haaUlCthuongsttd1;1ngtrangphanrichanhvanban.Chung t<;lathanhgiaa
di~ntudi~manhde'ncachbi~udi€n c§pcaabon.
22 -
3.1.Cacphepbi~nd5ihinhhQc
A.nhvan banthudu'Qctu thie'tbi s6hoachill nhi~ulac dQnghlnhhQCkhacnhau,va
co th€ du'Qcdi~uchinhb~ngnhii'ngbie'nd6i hlnhhQcthiGhhQP.Vi dt,l,mQtvanban
khangd€ th~ngtrenmayquetse chora anhs6hoabi nghieng(hlnh2.8).Cacphep
bie'nd6i hlnh hQccling co th€ du'QCsadt,lngd€ chu~nhoa chii'vie'ttay bi lc$ch.
Trangnhii'ngbanve ky thu~t,cacky 11/va cacs6 co th€ du'Qcvie'ttheonhii'ng
hu'angkhac nhauva nhu'v~yvic$cnh~nd~ngchungdoi h6i mQtmQtphepquay
tru'ac.
--'1 -~-
lr<rat-. ~ :---..;1'J"
, ~ "" C'...' ... .., 1r,,-..".' . . .
"
/eOW/e
O
nI , ' '.. ~t4. .~..
'
p.
'
..
'
J' am. ",
kien'rt'" anXl/? , fJrJic ' " y.
,,'ve «17a'." ,la ~., thamg;a ' Yltonn'J... J'. MINHVongt' .' I va~ II euI J..
thl/i, 1;~nme ~' 0 cUdc' '"Kue Va,
Thon JYng,v/j IJaO ~onlatais,~h(J1.nayla PhlfCtCJp,va .
:huYen 9thuang" '. ~~... (tn.faUyr P~alc611~'m9tIron" " lIay "., , "0/ de,.. .- , 117lak'" un,N", 9:tlsanc " ",U9"n.hr'h "vOlnl
.
a" ."18nii n 1Il/r}.
. g \l:o
o'
, .,Uarn' ' oiV,Un r" ,na/./i" ... '" 9th. I
, 'I nganh. flJh(fe'+/-."g <Jygi ~e""b ,(J1. " . . ta17g'/..[-~.. ' anntoar, ang ' 'lfeen.. ,VI ClO(j;' J/ lien . '
. C(jthe~ . CoquYen: CiP.Itakhi ' elmehot,..~qanhiJr)
~ithUiCh~sClCh \Ia",,;l?pthliho C
a
ha?han"e
"
u.'khk ofif)v."y '..'[l,nghi'a!",, len ..' "'anoilL' 'v Pat "1 h- q Ciy?-ro Q
Ihyi naYd-oec!lIacYa' ~!i{h~'ch/'.m~laiSaon~Cokh';.'~eiaf
;~IU~19a~:~~fU?t~~:ne~ang:~h'!191trong~h~eCh~e~;~gth~~
.uq~tlen,H : ...yaChung~h~aviitra~h{1[Jho~cbatl/r}~dletJkie u,hOl
I c~lQh.. h,alv~nban. lqCOqa..1,8f}l1tha,9l/ tochtJ.'~k()tJCi
Thong~.' u Phap- AI ~Uaf7IroTi;"~dll1hrorao. 1)S!.'If!qUac t.911f7 dUn,, vOrAI.. IV("f:>,.,L." )01..1,1+1.-,'. ,0,."..., P '~
Hinh2.8.Motph~nanhvanbanbinghieng
B€ d~tdu'QcmQtke'tquadi~uchinhdung,dn conhi~ubu'ac.Tru'ache't,chungta
phai xac dinhki€u bi bie'nd~ngcila anhva tl;10mQtmahlnhtoanhQc.Trong
tru'onghQpanh2.8,ki€u sai lc$chanhr5 rangla mQtphepquayva mQtmahlnh
quaychinhxact5nt~itutoanhQcchu~n.Thuhai,chungtaphaixacdinhcacgia
tri thams6cuaphepbie'nd6i,ch~ngh~ngocquay.Bi~unaypht,lthuQcvaoung
dl,lllg.Tranghlnh2.8,gocquaycoth€ du'QcxacdjnhcnoloanbQvanbantrongkhi
co tru'onghQpphaidu'Qcxacdinhct,lcbQchom6inhomkyt1!.Cu6icling,banthan
sl;!di~uchinncoth€ d~tdu'QcquamOtquatrlnnhla'ym~ul~ianhs6hoabandffu.
23
2.3.1.1. Phuongphapcoban
Nhungbie'nd6ihlnhhQcco th~du<;5ctrlnhbayIDQteacht6ngquat.D~ti(x,y)la
anhbandauva {(x',y') 1ftanhbisail~ch.Haianhlienh~baicacphuongtrlnh:
x'=J; (x,y) (3.20)
y'=f2(X,y) (3.21)
Anhbandaucoth~du<;5cbi~udi~ntheoanhsail~chnhusan.
i(x,y)={(x',y')={(J;(x,y),f2(X,y)](3.22)
Ki~usail~chanhdu<;5cIDOtabaitinht1!nhiencuafIC',,)vahC.,.).Cacphepbie'n
d6iaffineCtuye'ntinh)g6IDtinhtie'n,dinhty1~,quay,vaxiencoth~du<;5cbi~udi~n
b~ngmatr~n:
~){::: t){:)C3.2~
Bang1t6ngke'tnhii'ngtinhcha'tcuacacbie'nd6iaffine.
Kiiu Tinhchat
Tinhtie'n a;j=O;i, j =1,2.
Thayd6i ty Iif: all =all =0
Quay a :g6cquay
Xien ~:g6cxien
Conhi€u hQbie'nd6ikhongtuye'ntinh,nhuphepchie'uvadathuG.Nhii'ngbie'nd6i
naydu<;5csii'dl;lllgtrongvi~cIDOhlnhsail~chanhdoh~!h5ngcamerat~ofa.Trong
lInh v~(cphantich van ban,tn;lcquailsatcua h~th5ngcameradu<;5csa:pxe'ptn,tc
giaovoi ID~tvanban.Nhu v~y,cacphepchie'ukhongcanthie't.Trai l~i,cacphep
bie'nd6idathUGra-tcoichkhiIDOhlnhcacsail~chanhdoh~th5ng5ngkinh.Hai
lo~isai l~chanh thongthu'ongla barrel,do hlnhd~ngtroll cua 5ngkinhva
pincushion- hlnh3.9.Cahaicoth~du<;5cxa'pXlbai:
24
all =cosa all =-sina
all =sina a22=cosa
all =1 all =tg
all =0 all =1
. 3
r =Cm+Cd.r (3.24)
Troncrd6r'=IX'2+y'2 r = 'X2+V20 'J ' V -
Cmla dQphongd~iva Cdla h<$s6 sai l<$ch.H<$so cuoiclingamchobarrelva
dudngchopincushion.H~so thli'hai la zerodo tinhdoi xli'ngcuah~th6ng6ng
nnh.Bi~uthli'c(3.24)coth~dU<;1cvie'tl~iduoid~ngdathli'c:
(
XI
)
=Cm
(
X
)
+Cd
( X2 +<)X )
(3.25)
y' Y (X2+y )y
Nhlnchung,tacoth~sadl,mgcacphepbie'nd6idathli'cd~xa'pxi cacsail<$chanh
hlnhhQckhacnhau.
Biendi,lngBarrel Biendi,lngPincusion
Hinh 3.9.cac biendi,lngquanghocdoongkinh
2.3.1.2. U<ic1u'<Jngthamso
Do co nhi~ubie'nd6ihlnhhQcchocacli'ngdl,mgkhacnhau,chungtachixernxet
haitruongh<;1ptrongphffnnay.Truongh<;1pthli'nha'tla xa'pxi gocl~chcuatrang
vanbanvathli'hailaxa'pxih<$s6sail<$chanhcuah~th6ng6ngnnh.
Giai thu~tudclu<;1nggocl<$chdu<;1cxernxettrongphffnsaild1,1'av oki~rntragia
thie't.NghIala,chungtachie'uanhtheernQts6trl,lC,tinhcacbi~ud6theehudngva
chQnhuangd~tc1,1'cd~itheelieuchuffnth~nghang.Xernhloh3.10.Trudclien,
bi~u00chophepchie'ugoca du<;1ctinhboi:
OJ
H(y/;a) =2)<Xk'Y/) (3.26)
k=-oe
OJ
= Ll(cosa..xk-sina.yJ,sina_'k+cosa.y/) (3.27)
k=-oo
25
Vdi cae quy ude {(x~,y;)=On~u(x~,y;) n~m ngoai van ban, va
/(x~,y;)={~ound(x~}round(Y~)]n~unguQel<,li.Sail do, vi~exac dinh tieuehu~n
th£nghangA(a) dvatrensVbi~nd6i histogramgiuacaeduangth£nglien ti~p
nhaurheahuangchidinhbdi anhusail:
OJ
A(a)=2)H(y,;a)-H(YI+I;a)]2 (3.28)
1=-«>
~y
C,
Hinh 3.10U8c llic;ng 6cnghieng
Cu6i cling,goel~ehudelu<;1ngehobdi:
a*=argmaxA(a)(3.29)
Phuongphapnayco timquailtrQngthvet~VInocothSthaotaetrveti~ptrenanh
muexammakhongdn phando<;inho~enhipMlnhoatrude.
Bay giOchungtaxemxetvi~eudelu<;1ngcaeh~so'sail~ehanhdo6ngldnhrhea
biSuthue(3.25).Phuongphapnayg6mnhi€u bude.TrudetienanhduQexaedinh,
i(x,y) d~ttrongmQtludihinhvuongvaphienbanbi sail~eh{(x',y')eilano.Sail
do,so'NcpcaediSmdi~ukhiSnduQe hQn,eh£ngh<;incaediSmgiaoeilaludi;Ncp
phai IOnbonso'h~so'ehuabi~ttrangbiSuthue(3.25).Ti~pthea,caequailh~
('\>Yj)B (x~,yJ,j=1 ,NcpduQethi~tl~p.Cu6icling,caeh~sf)ehuabi~tduQexae
c1inhb~ngphuongphapblnhphuongevetiSu.Bi€u thuG(3.25)co thSduQevi~tl<;ii
dudi d<;ingmatr~nnhusau:
26
z' =Z.C (3.30)
Trangdo:
Z'=
(
X:
)
;Z=
[
XI(x: +y2)X
)
;C =(cm
)y YI(X-+y2)y \..Cd
(3.31)
Vdi m6ic~pdi~m{(Xj,yJB (x~,yJ,j=1,...,Ncp},chungta chnh~phuongtrlnh
Z~=Zj .C +Rj' trongdoRj la vectorsais6cuaphepdo.Giai phapbinhphuongq(c
.,? ,,\,Nrp RTR d h b?
heu L'...Jj~l j j u<;1c 0 ch:
A
(
NCP
)
-I
(
NCP
JC = ~Z~Zj ~Z~Z~(3.32)
Trongdotchichuy~nvi cuamatr~n.
Phuongphapdanhgianaybaatrumph~nsail~chanhtrenroanbQph~nanhdU<;1c
mahlnhbdicungcach~s6.
2.3.1.3.La'ym~uI~ianh 56h6a
Budccu6icungtrangdi~uchinhhlnhhcla xaydvngli;licuaanhkhangbi sail~ch
19tl(dngtll'phienbanbi sail~ch,quabi~uthac(3.20),(3.21)va(3.22).Nhii'ngbi~u
thacnaydn dU<;1cdi~uchlnhchocacanhs6hoa i(k.f);x,I. /1y)va i (k'./1x',[. /1y').
Vdi mQtdi~mchotrudc(x=k.f);x,y=[./1y),di~m~',y,)tuongangdi;ltdU<;1cb~ng
bi~u thac (3.20)va (3.21)nhln chungkhangn~mtren ludi xac dinh bdi
{(k'./1x',z''/1y')/k',z'EN}.Nhuv~y,dn mQts6xa'pxi.
Xa'pxi dongiannha'tlaphuongphapnguoitanggi~ng~nnha't.Nghiala,
i'NN(x'. y') =1"[M roUn1 ~J6Y'roun{;,)] (3.33)
Phuongphapt6thonla nQisuyluongtuy~n.Trudclien,chungtaxacdinhhlnhchii'
nMt ABCD baaquanh(x',y')(hlnh3.11)saildotinhi(x',y') :
"
( o,.,) _",(b1 (
,, "
)
1SL x,Y -1 As'l ~) 1CD-1 AS, Jl (3.34)
Trongdo:
27
i'AB=il(A)+(;,)U'(B)-i'(A)] (3.35)
i'co=i'(C)+(;,)U'(D)-i'(C)] (3.36)
NQiSHYlu'ongtuye'nnhinchungduGapungh~uhe'tungdt).ngtronglInhv\fcphilo
richvanban.Tuynhien,ne'uanhdu'<;1cdi~uchinhco ty l~la'ymftutha'phdnannh
bi sai l~ch,la'ymftul~isethaotic trenmOtphienban19Clow-passcuaanhbi sai
l~chd6tranhrangcu'a.
y
~x
~ ~
c
b I Ay
B
a
x
Hinh 3.11.PhLiongphilpnQisuyILiangtinh
2.3.2.LQc
Ph~nnaygidithi~uhaid~ng19Cs6hoatuye'ntinhvakhongtuye'ntinh.Mt).cdich
la cungca'pcaecongct).cdbanchonhii'ngungdt).ng19Canhd6ivdi cacanhvan
ban.L9Cg6mbie'nd6imOtannhinputi(k,l)thanhmOtanhoutputio(k,i)thu'ongIa
mOthamnh~ncacgiatri inputtrongmOtvi tri quanhmOtHinc~nct).cbQ i(k,l).
Tinh tuye'ntinhclingnhu'tinhkhongtuye'ntinhcuahamnayxacdinhcacbQ19C
tuye'ntinh(khongtuye'ntinh).Ph~n3.2.1trinhbaycacbQ19Ctuye'ntinh.Sando
hai ldpcacbQ19ckhongtuye'ntinhsedu'<;1Ctrinhbaytrongph~n3.2.2va3.2.3,xe'p
lo~icac bQ19Cthut\l'va cacbQ19Chlnhthai.
2.3.2.1 LQctuye'ntinh
Xet ldpcaebQ19CFiniteImpulseResponse(FIR),du'<;1cmotabdibi6uthucxo~n:
28
"" ""
io(k,l)=i(k,l)*f(k,l) =L Li(k-k',l-l').f(k',l') (3.37)
k'=-oo/'=-00
Trongdo f(k,l) la bQIQchuangungxung,condu<;1cgQila ID~tn~ho~cd~ngrnftu.
Cahai i(k,l)va f(k,i) IaphffnrnarQngh~nche',nghlalachungnh?ngiatrizero
bellngoaivunganhhuang.NhuV?y,t6ngtrongbi6uthuG(3.37)du<;1cgiOih~n
trangIDQt?Ph<;1pconhuuh~ncacchis5.Vi d1,l,vairnQtID~tn~3x3,ph~rnvi cila
t6ngcacchis5la k',t =-1,0,1.Cachuangungxungtie'prheathuangdU<;1csii'd1,lng
trangphanrichanh:
[
1 2 1
]
It 2 4 2
1 2 1
+[~
[
-2 1
t 1 4
-2 1
[
-1
t -2
-1
{-:2
(3.38) (bQh}clowpassho4cliunmjn)
0 -1
]
0 -2 (3.39) (bQ19Cxacdjnhbiend9C)
0 -1
-2
]
1 (3.40)
-2
(bQphathi~nbienLaplaceroi r(lc)
2 -1
]
4 -2 (3.41)
2 -1 (bQ19Cxacdjnhthdngdang)
-2 1
]
5 - 2 (3.42)
-2 1
(bQ 19Cmi'J rQng)
NhungIan c~nIOnhon3x3clingc6th6du<;1Csii'd1,lng.
Nhii'ngtinh chat cila IQc tuye'ntinhdU<;1cbie'tde'nva du<;1cIDa ta trongnhieutai
li~u.N6i chung,cacbQIQctuye'ntinhthuangdu<;1csii'd1,lnglienke'tvai cacthaotaG
khangtuye'ntlnhkhac.Vi d1,l,bQphathi~nbienLaplacephaitie'prheabairnQthli
t1,lCphathi~nzero-crossingd~xacdinhcacdi6rnbien.£)6phathil$ndong,nhieu
bQ IQc nh':lYearn vai IDQthuang C1,lth6 du<;1cap d1,lngva cac ke'tqua du<;1Cke'th<;1p
vdi roantii'max-operatord6xacdinhhuang.lnhhuangC1,lCbQ.HonQua,c6th6can
29
sa dl,lllgde>phangiai dakh6nggiand6phathi~ncaedongco caede>fe>ngkhac
nhau.Nhungvi dl,lminhhQavaitfOeuacacbe>lQctuy~ntinhtrongxa19anhvan
ban:chungla nhungthanhphftncuacaegiai thu~tphliet~pnhunghi~mkhi sa
dl,lngde>el~p.Ben qlllh do,nhi€u tar Vl,lphanrichco th6th1!ehi~nb~ngnhil'ng
phu'ongphapthayth~dongianbon.Vi dl,l,phathi~ndongco th6du'<;1cth1!ehi~n
b~ngnhiphanhoavalammanh(3.5),it nha'tchonhil'nganhvanbancoeha'tlu'<;1ng
t6t.
2.3.2.2LQcs~pthuhi
Caebe>lQes~pthlit1!kh6ngtuy~ntinhvacoth6d~tdu't
Ianc~n3x3quanhdi6manhmachungtaquailtamirk,!).f)~tSk,/lat~phQpcaede>
xamtrongIane~neua(k,!):
Sk,l ={i(k',/')llk'-kl~1,11'-/1~* (3.43)
va Rk,lla ehu6ico thli t1!euano: Rk.l={lj~r2~...~r9h E Sk,l} (3.44)
Caeroantas~pthlit1!nhu'saildu'Qcbi~t:
iik,l) =r] (anman)
iik,l) =r9(giiinnil)
(3.45)
(3.46)
(3.47)
(3.48)
iik,l) =r9- r] (phdthi~ndLlongviin)
iik,l) =r5(trungtuyfn)
Be>IQctrungtuy~nla be>lQes~pthlit1!ph6bi~nnha't,VInoco th6khanhi~uxung
11!ckh6nglammaanhinput.Nhlnchung,caebe>lQeco th6du'<;1capdl,mgehocae
anhnhiphanvacaeanhde>xam(xem3.3.1).Chungtasetha'ytrongphftnti~prhea
r~ngconhil'ngdi6mtu'ongt1!giii'acaebe>lQes~pthlit1!vacaebe>lQehlnhthai.
2.3.2.3.lQChinhthai
LQehlnhthaid1!atrencaekhaini~m19thuy~tt~ph<;1pvarutracaed~ctru'ngeua
d6i tu'tphftnta du'<;1eea'utruethiehhIJpva m9ttoantli'hlnh
thai thiehh<;1p.No xemxetcaeanhnhu'caet~phQpva thaotaechungsa dl,mgcae
thaotac logicnhu'he>iva giao.Toantii'hlnhthaitr1!equailnha'tla hit-or-miss.
30
Nghlala, chungtaquetanhinputvasosanht<;lim6ivi tricaediemanhIane~nvdi
ph§ntaea'utrue.N6ue6mQtd6isanhbeanhac,giatridu<jexacdinhtrudeduc;1c
gall ehoanhoutputt<;livi tri d6; trai l<;lianhoutpute6theduc;1ethi6t l~pclinggia tri
nhu gia tri d6 euaanh inputho~eph§nbi! euagia tri duc;1edinhnghlatrude.Ch~ng
h<;ln,phffntii'ea'utrue3x3tronghlnh3.12,trangd6"1" chiradiemanhthuQephffn
ta ea'utrue,c6 theduc;1esad\:mgdedi~nvaocae16nhaeuaannhnhiphan.Cac
roanta hit-or-missthfchhc;1pehocaetaevt,ldongiannhungkhongthfchhc;1Peho
caetaevt,lphuet<;lp.Ti6pthea,chungtatdnhbayb6nthaotaecobanla nhungn~n
tangquail trQngnha'tcuaquatdnhlQehlnhthai.. . . . . . . I .......
1 1 1 . 1 1 1 1 1 .
--1.1-- .11111.
1 1 I . 1 1 1 I 1 .
. 1 1 1 1 1 .
. . I . 11.
. 1 1 1 1 I .
....... . . . . . . .
Anhinput Philotli cautrue Anhoutput
Hinh 3.12 Toan tlihit - mis
B~tA la t~phc;1pbiendi€n anhnhiphan,nghlala, A={(x;,yJji(xi'yJ=I},vaB la
phffntaea'utrue.(Ah duc;1exaedinhnhumQttinhti6neuaA baivectorb=(Xb'Yb)'
nghlala, (A)b={(x"Y;)+(Xb'Yb~(Xi'Y;)EA}.B6n pheproanhlnhthaicobaneuaA
ehobaiB duc;1edinhnghlanhusan:
DilationAEBB=YeAh
beB
(3.49)
Erosion A0B =I (ALb
beB
Closing A.B=(AEBB)0B
OpeningAoB =(A0B)EBB
(3.50)
(3.51)
(3.52)
Chungta da tdnhbayt6mtiit cacpheproanhlnhthaitrencaeanhnbi phan.
DilationmarQngvaerosionrutl<;lianhbandffu.Chungthuangduc;1esadt,lnglam
millduangvi~n,lamdffycae16nhavakhanhi€u.
2.3.3Tachroi anhvan~n
H§u h6tcaeanhvanbanla k6tquatitquatrlnhin a'nho~evi6ttrenmQtn~ndang
nha't,eh~ngh<;lnnhutagia'ytr~ng.Tachrai anh- vanbanho~ecaebanverakhai
31
n~nlamQttrangnhungthaotaGdin bannha'ttrangxii'1:9anh,ph1,lcV1,lchoeacthao
taGtie'pthea,nhuphando~nva gall nhan.Phffn2.3.3.1duara tie'll trlnhtachdl,l'a
trennguongmUGxam,giathie'tn~nla d6ngnha'trangcahaimoitruongnhi~uva
khongnhi~u.Trangphffn2.3.3.2chungtabo gia thie'td6ngnha'tva xettachroi
anhtun~n.
2.3.3.1Ngu'ongdQxam
Ne'uvanbancocha'tluQngt6tvacon~nd6ngnha't,quatrlnhtachcoth€ du'QCthl,l'c
hic$nb~ngcachsii'd1,lngtrl,l'ctie'pphuongphapnhiphanhoamotatrongphffn2.2.
Nhil'ngvanbanlo~inayne'uduQcquetd dQphangiaicaosechomQtke'tquatach
hffunhuhofmbaa.Rtli thay,trangmQtso'truonghQpkhichungtaapd1,lngpht(ong
phapnaychoanhcocacvungtdongphankhacnhau,ke'tquakhongnhumongdQi.
Cac dongtuongphantha'pbi boma't.B~ngcachdi~uchinnnguong,co th€ khoi
plwccacdongnay.Tuynhien,lUGnayl~ixua'thic$ncacdi€m anhnhi~utrenn~n.
Phuongphal?di~uchinhduQcd~nghig6mch(;mmQtnguongvoi mQtty l~ph~n
tramchotruoc,ch~ngh~n10%,cacdi€m annco dQxamtha'phonnguongnay
(phuongphapp-tile).Trongphffnsail,chungtatrlnhbayhaicachtie'pc?nd€ giai
quye'tva'nd~nay.D€ dongian,chungtasechiminhhQacacphuongphapnguong
roanCI,lC,tuydingtrangmQtso'truonghQp,caephuongphapngu'OngC1,lCbQthleh
hQpbon.
Cachtie'pc?ndffubaag6mlQcanntruockhinhiphanboa,sii'd1,lngbQlQclammill
tuye'ntinh,clIngca'pbdibi~uthUG(3.38).Co th~tha'yr~ngnhi~ugiambot,nhu'ng
cacca'utrucdongdayd~cla chomQtso'pixeldinhvaonhau.Clingco th~sii'd1,lng
cacbQlQcl'J16ngtuye'ntinh,nhutrungtuye'nch~ngh~n.Tuynhienke'tquakhac
bic$tla ra'tit.
Cachtie'pc?n tnuhai thii'lo~ibenhi~usailkhinhiphanboa.MQtbQlQctrung
ruye'nduQcapdl,lngchoanhnb!phantra thanhhQlQcchinhcoth€ la'pd~ycac16
32
rnho,lamkhitcackhehonhovalo~ibonhi6uxung.Cachnayd6ikhiphavoke't
cffuho?clamdinhcacchCi'l~i.
2.3.3.2N~nk~tc~u
Nhi~uchudngtrinhso~nthaovanbanhi~nd~iclingcffpkhanangt~oran~nke't
cffu.Ch~ngh~n,mQtvanbanduQcthie'tke'n6i b~td~16icu6ns1,1'chu9cuadQc
gia VaGmQtsO'vungnaGdo.Kh6ngmay,no t~ora nhi~uvffnd~d6i vdiOCR.
Trongph~nsau,chungtam6tamQtky thu~tddngianvahi~uquadlfatrenqua
trinhlQChlnhthaid~giaiquye'tva'nd~tachanhkhoin~n.
Trudclien,anhduQcnhiphanhoa,sii'dl,mgphudngphap cuaph~n2.2.Tie'prhea
mQtpheploanerosionduQc.ap dl,mg,sa dl,mgph~nta ca'utruc3x3.Cu6icung,
pheploandilationduQcthlfchi~ntrenanhduQcanmOllboiclingph~ntii'ca'utruc.
NghTala, anhnhiphandffduQcnO.Co th~nh~ntha'ydingne'ukichthudccuacac
ph~ntii'ke'tca'unhohdnkichthudcuacacph~ntaca'utrucvacuavanban,ky
thu~tnaythlf.chi~nt6t.Ne'ukh6ng,sedn xa19pht1ct~phdn.
2.3.4.Bi~udi~nvaphathi~nbien
Sau1u1.itachkhoin~n,cacd6i tuQngduQckhoanhvung,danhgia va cu6icung
phanlo~i.MQtd6ituQngduQcchidinhhoanroanboibiencuano,biencoth~duQc
phathi~nboigiaithu~tsau.
1. Quet anh den khi gq.pdiem anh den. GQi no la pixel 1.
2. L~p
Neu "diem anh hien thdi lei den"
Thi "do ngu<;1c"
Nguqc li?-i "sang phai"
Ben khi "gq.p pixel 1"
Giciithu~tdotlmbien
33
I
I
------------- >
Hinh3.13 Dotimbienclangian
Hinh3.14 Do timbienvdinhi~udOitll<;1ngphacti;lp
(011)
3
(010)
2 (001)
I
000) 4 0 (000)
7
(Ill)
5
(101) 6
OW)
Hinh3.15 Mii chu6iFreeman
34
~4
ffinh3.13minhhQavi~cpMt hi~nd6ituQnglienke'tdongian.Chungtahillyding
pixelgi6ngnhau,ch~ngh<;\npixel1,dllQCphathi~nnhieul~n.Tuy nhien,co the
khii'chungmQtcachd~dang.Noi chung,anhcothechuanhieud6itllQng,g6mcac
16h6ng,made'nluQcchungcothechuanhi~ud6ituQngnhobon.Ch~ngh<;\n,vi~c
dorimphaiduQcl~p d~quyd€ phat hi~nmQibienbellngoaivabelltrongcuamQi
d6i tUQng.ffinh3.14trinhbayquatrinhdorimanhchuacacd6i tuQngl6ngnhau.
LttuY dingdo rimmQibientrongva ngoait~onenmQtphando<;\nanhinputvdi
nhieuvung(xemphfin4).
MQt bien dllQCchi dinhbdi cactQadQ(x,y)- trencacdi€m anhcuano,gQila cac
diembien.MQteachbi€u di~ncodQnghonlamahoaFreeman.ChicactQadQ
(x,y)- cuadi€m biendfiutienduQcIttugiil'.Cacdi€m bientie'prheaduQcmahoa
lienquailde'ndiembientrudc.ffinh3.15trinhbay8machu6i,m6imaduQcbi€u
di~nb~ng3bit.Vi dl;l,cacdiembienhinh3.14duQcmahoanhusalt:
077 175 4 443 3 1
Ho~c:
000 III III 001 III 101 100 100 100 all all 001
CacdiembienthudllQCcod<;\ngmQtdllongcongdong.Noi cachkhac,chu6itQa
dQ(x,y)tuanrheamQtchuky.Di~unayco nghiala bienco th€ dllQcbi€u di~n
b~l1gnhil'ngchu6iFourier,vdicach~sO'd~ctadllongcongdong.Honfilla,nhil'ng
h~sO'naycothedu'Qcke'thQpvaocacbQmotaFourierduaracactinhchatkhong
d6irheaphepquayvaphepthayd6ivi trL
2.3.5.Lammanhvabi@udi~neautrue
Hfiuhe'tnhfrngd6itllQngtronganhvanband~ucocaeeautruedong.Trongnhil'ng
lingdl:lngct,).th€, mQtthaythe'thichQpd€ bi€u di~nd6ituQngbdibiencuanola
bi€u di~ndong.No co tfimquailtrQngth1!cte'vinocoth€ dongiannhi~uthaotac
tieptheetrangphanrichCalltruc.Cachbi€u di~ndongco thed<;\tdllQcb~ngtie'n
trinhlammanh.
35
Hinh3.16Quy LfacIanc~ndi!!lammanh
Y tlidngchinhcuaquatrlnhlammanhla x6anhi€u l~ncacdi€m biend~giamb€
fQngdongconmQtpixel.Di€u nayphaidu<;JcthlfChi~nkhongcin tachraid6i
tu'<;Jng(tachd6itu<;Jngthanhhaiph~n)clingnhukhongdn x6acaedi€m cu6idong.
N6i cachkhac,chungtac6th~nh?ntha'ylammanhla x6acacdi€m bienc6di€u
ki~n.Giiii thu?tsongsongdongian,khongnh~yearnvdinhi~uduangvi€n, nhu
sau.
Sa dt:mgquyudcl?nc?nhlnh3.16,d~tNT(P1)la s6cacbi6nd6i0 (tr~ng)thanh1
(den)trongchu6ic6thITtlf ,vaNZ(P1)la s6cacIanc?nkhac0
cuaPI- Di~manhPI du<;Jcx6a(d~tbAng0) n6u:
2=:;NZ(~)=:;6 (2.53)
va:
NT(~)=1 (2.54)
va:
Pz.P4.Ps=0 hor;icNT(P2):j;1 {2.55)
va:
Pz.P4. P6 =0 hor;icNT(P4):j;1 (2.56)
Tien trinhdLtr;cli;ipdenkhikh6ngconthayd6inaatrangdnh.
MQt s6 IOncac giai thu?tlammanh,khacnhaubdi nhil'ngdi€u ki~nx6a,da du<;Jc
d€ nght-TrangmQtGongtrlnhnghiencUug~nday,20giaithu?tkhacnhaudadu<;Jc
tht!chi~ntrongd6xemxetcaclieuchugnnhu'khaDangxayd!,1'ngl~i,t6cGQtinh
roan,tinhn!ongtlf Goivdi Calltruelien quail,chatlU<;1ngcila ca'utruc,tinhk6tnoi
saukhi lamminh,vavand€ songsong.
36
P3 P2 P9
P4 PI Ps
Ps P6 P7
Noi chung,caedongmanht<,toboi giai thu~tlammanheh1i'ahai ki~upixelden,
di~mthongthudngvadi~md~ebi~t.M(>tdi~mthudngco2pixeldenIane?ll.M(>t
di~md~ebi~tco 0, 1,3 ho~e4pixeldenIan e~n.Nhii'ngs6naycon dU<;1egQi1ath1i'
W'euapixel den.Nhu v~y,m(>tpixel co th1i'tv 0 la mQtdi~meachly, th1i'tV 1 la
di~mke"thue,th1i'tv2la di~mn~mtrendong,th1i'tv3la di~mchii'T, vamQtpixel
coth1i'tv41amQtdi~mgiao,hlnh3.17a.
MQteachthichh<;1pd~motadiu trueeuaanhlammanhIabi~udi€n d6thi.Cae
nut dU<;1ek "th<;1pvdi caedi~md~ebi~tva caedudngeongvdi caedongmanhgiii'a
caenutne"uco, xemhlnh3.17b.Chinhxaebon,mQtnutdU<;1echI dinhboi ki~ueua
no (caehly, diEmcu6i,chii'T, ho~cgiao)vavi tri (cactQadQx,y).MQtclinggiii'a
hai nutco thEdu<;1cbi~udi€n boimaehu6iho~cboi mQts6xa'pxl, nhucacll,lc
giaeho~cacb-spline.
.
Di€m cuoi
Di€m col~p
Di€m thU'C1ng
Hinh3.17 a.Minhhoacaeki~udi~m b. Bi~udi~nea'utruedla a
M(>tgiaithu~tdongiand~tlmxa'pXldagiaeeuamQtdudngcongnhusau.Xa'pXl
dudngcongb~ngdo<,tnh~ngn6icaedi~meu6iA vaB. Ne"ukhoangeachtitdiEm
xa nhit trendudngeongC de"ndo<,tnAB lOll honnguongdinhnghlatrudc,n6i A
vdi C va C voi B. L~pl<;lithuwe ehonhii'ngdo<,tnmdi AC vaBC de"nkhi nguong
dinhnghlatru'dedU<;1cthoa.
37
A ?
2.4.PHAN E>OANANH
Phando~nla tie'ntrlnhehiaanhthanhnhi€u vung,m6ivungchuamQtd6itUyng
ho~cmQtnh6mcacd6itU<;1ngclingki~u.Ch~ngh~n,mQtd6i tu<;1nge6th~la mQt
ky tl!trenmQttrangvanbanho~emQtdo~nth~ngtrongmQtbanve Icythu~tho~c
mQtnh6mcaed6i tu<;1nge6th~bi~udi~nmQtt11ho~ehaido~nth~ngtie'pxuevoi
nhau.Trangphanrichanhvanban,4 giaithu~tphando~nthuangdU<;1csii'd\mgla
gallnhiinthanhph~nlienthong,phanrichcay-X-Y, lamoboerheaduangch~y,va
bie'nd6iHough.ChungsedU<;1Cmotachitie't rongcacph~nsau.
2.4.1.Cannhanthanhphanlienthong
Ky thu~tnaygallrhom6ithanhph~nlienthongcuaanhnhiphanmQtnhanrieng
bi~t.Nhanthuangla caeso'tl!nhienb~td~ut11mQtde'nt6ngso'caethanhph~n
lien thongtronganhinput.Giai thu~tquetanht11traisangphaiva t11trenxu5ng
duoi.Trangdongthunha'tchuacaepixelden,mQtnhanduynha'tdu<;1egallrhom6i
duangeh~ylien t1,lcuacacpixelden.Voi m6ipixeldeneuacaedongtie'pthea,
cacpixelIanc~ntrendongtruocvapixelbelltraidu<;1cxemxet(hlnh3.l8(a)).Ne'u
ba'tky pixeLIan c~nnaGdu<;1cgall nh11n,nhiintudngtl!du<;1egall rhopixeldenhi~n
thai; ngu<;1cl~i, nhiin tie'prheaehuasii'd1,lngdU<;1eehQn.Thu t1,lCnay tie'ptl,lcclIo
de'ndongcu6iclh anh.
Luc ke'tthuctie'ntdnhnay,mQthanhphftnlienthongc6th~chuacacpixelc6cac
nhiinkhacnhauVIkhichungtaxemxetIanc~ncuapixelden,ch~ngh~npixel"?"
tranghlnh3.l8(c),pixeld5ivoi Iane~ntrcHvanhungIane~ntrongdongtru'oce6
th~dU<;1cgallnhiinmQtcachriengbi~t.(Trongvi d1,lnay,chungtasii'd1,lngnhiin
euaIanc~ntrai).MQttlnhhu5ngnhuv~yphaidU<;1exacdinhvagill I~i.Sauti~n
tdnhquet<lnh,vi~cgallnhandu<;1clIGanta'tb~ngcachth5ngnha'tmallthu~ncae
nhiinva gall l(;licaenhiinchuasii'd1,lng.f)~minhhQarho thut1,lC,xemhlnh3.18.
38
. p p p .
. L ?
a. Uin c~ncua"?";P=dongtnlac;L=lanc~ntrai
** *** 11 222
** *** 11 222
**** **** 11112222
******** 111?****
* * * * * * * *
*** * *** *
*** ** *** **
* * * * * * * * * * * * * *
* * * *
b. Anh band~u c. Tien trinhdanhnhan
...11...222 11...111....
...11..222 11...111....
..1111.2222 1111.1111....
. . . 1 I 1 1 1 I 1 1 . . . . . . . I 1 I 1 1 1 1 1 . . . .
. . . . . 1 1 I 1 . . . . . . . . . . . I 1 I 1 . . . . . .
. . 1 I 1 . . ) . . .. . . . . . 1 1 I . . 2 . . .
..111..)). 111..22..
.44..111. .)) ))..111..22..
..44 )).......
d. Saukhiquetd~ydli e.Ketquadanhnhansaurung
Hinh3.18E>anhnhancaethanhph~nlienthong
2.4.2.Phantichcay-X-Y.
Phanrichdiy-X-Y la giaithu~tphando~nph6bi€n trangphanrichanhvanban.Y
tudngcdbancuagiai thu~tla khaithacdnhco ca'utrUcdQcho~cngangcuah~u
h€t cacanhvanban.MQttrangvanbanthuangg6mcacdongvanbanngangkhac
nhau.Nh~nxetnayd~nd€n ytUdngchi€u ngangcacpixeldentrencactn,lcdQc,
phando(lntrangthanhcacdaitr~ngvacaedaivanban.MQtdaitr~ngtuongling
vdi ffiQtt~phQpcaedonglien tl,lcit bonn pixeL,vamQtdaivanbanlingvdi t~p
hQpcaedonglientl,leeoit nha'tnpixeln€u nguongduQed~tb~ngn. Saudo,m6i
39
dai van ban e6 th€ duQeehi€u dQetrentl1;1en§.mngangthuduQecac vi trl cila cac
ky tl!trongdelinay.Thil tl,1Csaltc6 th€ duQCsadl,1ngd€ rutracaeky t1,1':
1. Tfnhroanphepchieungangd{fiwJi roanbi?trang.
2. Phiin tickphepchieudi rut ra cacdong.
3. V6'imJi dong,tinhphepchieudQc.
4. Phiin tickmJi phepchieudt;ltdu(/ctrongb£c6'c3 di rut ra cackYtfC.
Tuy nhien, t5ngquathdn,c6 th€ dn thlfehi~nnhi~uhdnhai phep ehi€u d€ d(;lt
d€n cac ky t1,1'.Hlnh 3.19trlnhbay mQteffuhlnh khonggian (caeky t1,1'duQcbi€u
di~nmQteachtuQngtrungbdi cachQp)trongd6mQts6ky tlf chid(;ltduQcsaltphep
ehi€u thti'ba (ngang).C6 th€ nh~nthayf§.ngnhungvan banphti'ct(;lpbone6 th€
doi hoinhi~uphepehi€u hdnd€ rutfa caeky tlfriengbi~t.Nhuv~y,d€ baadam
co th€ ho(;ltdQngduQe,giaithu~t5ngquatsechi€u vanbandQcvangangd€n khi
hai phepchi€u lien Wcd(;ltk€t quatudngt1,1'.
Saukhi thtfchi~n
phepchieuthu2
.+.
chieu dung
:~ - - ~::8]J:0: ::0::::::::'
~:o~:~:~:0: ~:D~:~O:~:~:~:O:~:~O:~:~:~:~:~:~:~:~:~:~:::
Saukhithl,fchi~n
phepchieudiiu
tien(chieungang)
Hinh 3.19Vi dl,JcuamQtvanbandoihoi baphepchi€u.
Cffutrueduli~ut1,1'nhiend€ lu'uk€t quaeilagiaithu~tla mQtcaye6caenutbi€u
di~ncaevunghlnhehunh~t.M6i nute6th€ c6nhi€u nutcon,m6inutconbi€u
di~nmQtvungconciia vungchaoCaenuteu6i(nutla) la nhungnutkhongth€
phanchiathemdu'Qcfilla.Chungbi€u di~ncacvlingkhongth€ phanehiavaduQe
40
I
gQila cacth1,1'cth€ figureDto'.Hlnh3.20trlnhbaymOtvi dl,lcilavanbantrongdo
cacky t1,1'dU<;1cbi€u di~nbdicachOp,vabi€u di~ndiy cilano.
Anh vanban
Hinh 3.20 Anh vanbanvad;;tngbi~udi~ntheocaycuan6
MOtvin d~vai giaithu~tphanrichcay-X-Yphatsinhtrangs1,1'hi~ndi~ncilamOt
sO'd.;lllgd6hQaCl,lth€. Khi do,dn thie'tkhoanhvimgchungvaapd1,lngphantich
thanhphftn,lienthong.
Trangphftnmotabell tren,phanrichcay-X-Y beanloandU<;1cxemxetnhumOt
giaithu~thaicip theenghiakhongcotrithuGcilavanband€ th1,1'chi~nphando~n.
MOtsO'lacgiasii'd1,lngtri thUGd€ huangdftnphanrich.S~l'ke'th<;1pthongtincip
caova thip rhoke'tquat6tnhu'ngdoi.hoir~ngphftntrlnhbaycilavanbancomOt
ciu trucdu<;1CdinhnghianaGdo.QuailtrQngbon,saisO'trongduli~udonhi~uco
th€ dftnde'nthit b~iv~phando~nvakhongth€ suachuadt1'<;1c.VOJeachtie'pc~n
trongdo tie'ntrinhcip caovacip thip du<Jctachrai, vin d~duli~unhi~udu<Jc
beande'ngiai do~ngall nhansando.Vu di~m13.lu<Jngdii'li~uphaigiai quye'tsan
do nhohonnhi~ucachbi€u di~nbandftu.
2.4.3.Lamnhoedu'ongch~y(run-lengthsmear)
Gi6ngnhuphanrichcay-X-Y,giaithu~tlamnhoetheeQuangch~u-RLSdoihoi
s1,1'Qi~ucblnhdQl~chtruac.TruaelienRLSphathi~nmQiQuangch~y{fAng(cacsO'
0 lient\Ic)Clladongvasandoehuy€nd5inhungQuangch~ycoehi~udaing~nhon
41
nguongdinhnghlatrudc,T thanhnhii'ngQuangch~yden.Cac Quangch~yden
khongd6i.Ch~ngh~nvdiT=3,RLSchuy6nd6idong
000 1 1 0 1 0 1 1 1 0 0 1 0 0 0 1 1 100
thanh:
0 0 0 1 1 1 1 1 1 1 1 1 1 1 0 0 0 1 1 1 1 1
Ho~tdQngcilagiaithu~tRLSnhusau:trudctienapdt:mgrheatUngdongvasaudo
rheatungcQt,thuduQchaianhriengbi~t.A.nhcu6iclingduQcktt hQpbdiphep
roanlogicAND giii'ahaianhvuaduQcsinhtrudcdo.
Ktt quacila giai thu~tRLS co th6duQCsa d\mgd6 gall nhanthanhph~nlien
thong,thuduQcmQtt~phQpcacvung.Nhii'ngvungconch thudcra'tIOnrheacac
tQadQx,y- thuangtuonglingvdicacd6ituQngd5hQatrongkhih~uhtt cacdong
vanbant~oracacvungduQckeodairheachi~ungang.,
2.4.4.Bie'nd6i Hough
Khongnhunhii'ngphuongphapphando~ndaxemxettrudcday,trangdocacd6i
tuQngriengbi~tphaiduQctachrai,bitn d6iHoughlamvi~ct6tk6cakhicacd6i
tuQngbi dinhvdinhau.Xetbie'nd6iHoughdungd6phathi~nduangth~ng.
y
b
b=xla+Yl
x a
1
I
,
Xl X2 X3 .a
Hinh 3.21 Ph<ithi~ndl1<'1ngth~ngb~nggiaithu~tHough
Chungta hayxemxetphuongtrlnhcila mQtdo~nth~ngy =ax+b,cacthams6
(a,b)daduQcxacdinh,xemhinh3.21.Ntu di6m(Xl>YI)thuQcv~do~nth~ng,thlr5
rangdingba'tky ci,ip(a,b)thoaYI=ax!+bclingIamQtlerigiai.Noi cachkhac,vdi
42
rnQtdi€rn (Xf,YJ) chotn.toc,du'ongcongb=-xja+YJtrangkhonggiantharns6 (a,b)
rno ta rnQiWi giai c6 th€. Bi€u tu'ongt1,tcling dungchocac di€m (XbY2),(X3,Y3),...
N~u n di€rn (Xf,Yj),(Xz,Y2),..., (xmYn)niirn tren cling rnQtdo~nth~ngtrongkhong
gian anh,cac du'ongcongtu'ongungcua chungphaica:tnhauclingrnQtdi€rn
(a*,b*)trongkhonggiantharns6.D1,tatrentinhchfftnay,giai thu~tHoughdu'<;jc
rnotanhu'sau:
1. Lw;mghoakh6nggianthamso(a,b)thimhcactebaa.
2. T(;lO6 tichlilyAcc(a,b)vakhiJit(lOcacthanhphdncilanobangkh6ng.
3. Vai m6ipixelden(x,y)trongkh6nggiandnh,mri tebaac£laAcc(a,b)thoa
b = -XCI+y dLC(!Ctang len mQt.
4. Phathi?ncactri qtcd(lidiaplutO"ngtrongkh6nggianthamso'(a,b).M6i tri ung
vaimQt{)ph(!pcacdilmcungdLCimgthangtrongkhonggiandnh.
TrongthlfCt~,giatrta khongxacdtnhchocacdu'ongth~ngdung.MQtd~ngdu'ong
th~ngtharns6 thichh<;jphonla r =x.cose+y.sinB,trangd6 ria khoangcachtit
tamcuakhonggian(x,y)d~ndu'ongth~ngva e la g6ccuaphaptuy~nd~ndu'ong
th~ng.Bi€u nayd~nd~nrnQtdu'ongconghlnhsintrangkhonggiantharns6(B,r)
chorn6idi€rn (x,y).Gi,Uthu~tHoughkhongd6i.Nhi€u khiaqnh thlfchi~nv€ 1:9
thuy~tkhaccuabi~nd6iHough,baag6rnlu'<;jngh6atharns6vaphathi~ncaccrt
clfcd~idtaphu'ongdadu'<;jcnghienCUll.
Bi~nd6iHoughc6 th€ du'Qcapdt,mgchobfftky du'ongcongtharns6nao,ch~ng
h~ndu'ongtroll,ellipse,vaciinhii'ngdu'ongcongkhongtharns6.N6 torarfftrn~nh
d6i voi anhnhi~uva d~cbi~tgiupichtrongvi~cphannchcacbanve Icythu~t,
trongdohftu h~tcacdu'ongcongla nhii'ngdo~nth~ngvacaecungtrOll.Honnii'a,
cacchu6ivanbantrongcacbanveIcythu~tco th€ du'<;jcphathi~nquabi~nd6i
Houghbiingcachxemm6iehu6inhu'mQtdo~nth~ngeocaephftntli'lacaek:Ytlf.
43
2.5clal THI~UTRICH CHQN D~CTRVNC
MQttrongnhlingml;ledieheuaphantiehannvanbanla phanlo~icaeIcytt,tvacac
ky hi~uthanhcaelOp.TriehehQnd~etrungla mOtbuoctrQgiup,lamehovi~c
phanlOpd€ dang.TriehehQnd~etrungla mOtd6i tuQngnghieneUutrongnh~n
d~ngm~uva co th~duQechia thanhhaieachtie'pe~n,th6ngke vaca'utrUc.Ml;le
dieheuaphftnnayla trinhbaymOts6phuongphaptrieDehQnd~etrungdongian
vahi~uquadaduQesli'dl;lngrOngdi tronglInnvt,tephantiehannvanban.
2.5.1.Cacd~ctrlinghinhhQc
Caed~etrunghinhhQedongiancoth~ra'tcoannhudngtrongnhi€u lingdl;lng.
Ching h~n,caekiehthuoet~eohuangx-vay-euathanhphftnlienthongcoth~du
dephanbi~tcaeky tlftucaephftnd6hQa.Duoidayla mOtdanhsaehkhongdfty
ducaed~etrunghinhhQe.
1. Caekiehthuoetheophuongx,y,vatyl~euachung.
2. Chuvi
3. Di~ntieh
4. Caekhoangeachelfed~ivaelfeti~utubiende'ntamkh6i
5. S6cae16
6. S6Euler=(S6thanhphftnlienthong)- (S6l6)
7. E>O5nd!nh=(ChuVi)2/(41t.Di~ntieh)
8. Caeda'uhi~u(phepehie'ungangvadQCcuacaepixelden)
TronglInnvt,tephantiehanhvanban,nhlingd~etntngnaythuongduQcsli'dl;lngd~
phanlOptruoecaed6ituQngthanhky tt!vaanhd6hQa.Saudo,caethanhphftn
tronglo~ikY tt,tdu<jegli'iehotrlnhOCRtrongkhicaethanhphftnd6hQaduQephan
tichbdi trinhnh~nd~ngd6hQa.Ngoaiml;lediehphanloptrUoe,mOts6d~etntng
teenclingcothi gapphftndangk~vaophanlopcaeky tt,teu6icling.
44
2.5.2.Caemoment
Cacd6itu<;1ngclingcoth€ du<;1cmotabaimoment.ChungdU<;1cdinhnghlanhusail:
Mp,q =J li(x,y),xPyqdxdY(5.57)
Trongdop vaq la cacca'psO'nguyenkhongamcuamoment,i(x,y)la anhmt1'c
xam cua d6i tu<;1ng,va D Ia phftnma rQngkhonggian cua d6i tu<;1ng.Lu'uyrang
ne'ula anhnhiphanvaigiatri 1chocacpixeldenva0chocacpixeltr~ng,thiMo.o
la di~ntichcuad6i tu<;1ngtrongkhiMl,ova Mo.lla cactQadQx,ycuatamkh6i
IU<;1ng.Co th€ tha'yding t~ph<;1pvo hC;lncac moment{Mp,q;p,q =0, 1,2, ...}xac
dinhi(x,y)mQtcachduynha't.Tuynhien,vaicacgiatrip vaq lOn,cacmomentlId
nennh~yearnd6ivai nhi€u nentrongthl{cte'chicacgiatrip va q nhodU<;1csa'
dl:lllg.
Cac momentdinhnghlabai bi€u tht1'c(5.57)dQcl~pvi tri va nhuv~ykhongth€
dU<;1csa dl,lllgmQteachtrl{ctie'pd€ sosanhhinhdC;lng(ngoC;litrll di~ntich).MQt
dinhnghlakhac,caemomenttam,nhusail:
M;,q=JJDi(x,y).(x-xy(y-jiYdxdY (5.58)
Trong do:
MIo -- Mo,l (5.59)x=~, y- MMo.o 0,0
T~p h<;1pcaemomentamea'phai (p+q=2),M;.o,M~.2,M~1d-inhnghlaellipseqUail
tinhcuad6i tU<;1ngva thudU<;1cquacacvectoreigen,huangBchinhcui:1d6i tu<;1ng:
1
[
2.M~1
]
O=-arctan
M e -Me,2 2.0 0,-
(5.60)
£)i:!.cbi~t,coth€ nh~ntha'yrangcaet6h<;1pmomenttamsaildQcl~pvaihuangcua
d6i tU'<;1ng.
rfJl=M~.o+M~.2 (5.61)
rfJ2=(M~.o-1}1~,2)2+4(M1~1)2(5.62)
45
Do tinhcha'tkhongd6itheophepquay,caet6h<;fpcuamomentra'thii'uichd6ivdi
OCR.
2.6. KET LU~N
Trongchuangnay chungta dffxemxet caephuongphapxii'19anhkhacnhau
thuangsii'dt,mgtrongnnhvrj.cphilotichanhvanban.CaephuongphapdU<;1cnh6m
thanh4 lol;li:thunh~nanh,bie'nd6i anh,philodol;lnanhva trichchQnd~ctrung.
Cacht6 chucnaydrj.avaocaebudcxii'19cuanhi€u h~th6ngphilotichanhvan
ban hi~ndangdU<;1csa dt,mg.f)i~mchinhtrongchuangnay la trlnhbay cae9tudng
eoban,va dongian- nhungky thu~tn€n tangnha'trangphilotichanhvanban.
46