lvtn full final

Click here to load reader

Post on 14-Jun-2015

1.649 views

Category:

Documents

1 download

Embed Size (px)

TRANSCRIPT

MC LCTI LIU THAM KHO & TRCH DNV Hng Phong Lun vn tt nghipLIT K CC HNHHnh 2.1a, b, c, d: Cc c trng cnh, ng, bao quanh tm, ng choHnh 2.2 : nh chia nh ti ta (x,y)Hnh 2.3 : Tng cc gi tr pixel nm trong vng AHnh 2.4 : V d v cc t th ca hnh ch nht c trngHnh 2.5 : Lc c bn ca AdaBoostHnh 2.6 : Thut ton hc AdaBoostHnh 2.7 : M hnh minh ha tc v pht hin vt th dng chui cascadeHnh 2.8 : Dng chui cascade c hun luyn pht hin ca s con ph hpHnh 2.9 : Cu trc cc chui cascade song songHnh 2.10 : Cu trc cc chui cascade ni tip, vi N giai on hc hun luynHnh 3.1 : Minh ha qu trnh ly muHnh 3.2 : Minh ha qu trnh hc hun luynHnh 3.3 : Minh ha qu trnh kim th c s d liu car_back.xmlHnh 3.4 : Minh ha qu trnh kim th c s d liu bus_vn_full_22112008.xmlHnh 3.5 : Minh ha qu trnh kim th c s d liu truck_vn_26112008.xmlHnh 3.6 : S khi ca qu trnh nhn dng xeHnh 3.7 : M hnh ha thut ton c lng khong cchHnh 3.8 : M hnh camera quan st trong khng gian 3-DHnh 3.9 : Minh ha kt qu c lng khong cchHnh 3.10 : Minh ha kt qu m s lng xe c trong hnhHnh 3.11 : S khi t chc phn mm h thngHnh 3.12 : S khi h thng hon chnh t chc phn mm h thngHnh 3.13 : M t h thng pht hin xe dng thut ton HaarHnh 3.14 : Giao din chng trnh nhn dng xeHnh 3.15 : Mu camera c s dng trong lun vnTrang 2V Hng Phong Lun vn tt nghipLIT K CC BNGBng 2.1 : Cc dng thut ton hc hun luyn AdaBoostBng 2.2 : Thut ton pht hin ng thi co gin vng c trng i tngBng 3.1Bng 3.1a : Mu xe hi du lch c nhnBng 3.1b : Mu xe butBng 3.1c : Mu xe tiBng 3.2 : Cu trc file c s d liu c trng ca i tng xe hi c nhnBng 3.3 : Kt qu kim th c s d liu c trng xe hi c nhnBng 3.4 : Kt qu kim th c s d liu c trng xe butBng 3.5 : Kt qu kim th c s d liu c trng xe tiBng 3.6 : Tng kt cc kt qu kim th c s d liuBng 3.7 : M lnh in hnh ca thut ton pht hin v nhn dng xe hiBng 3.8 : M lnh thc hin thut ton c lng khong cchBng 3.9 : M lnh thc hin thut ton m xeBng 4.1 : Cc kt qu x l nhn dngBng 4.1a : Kt qu x l nhn dng xe butBng 4.1b : Kt qu x l nhn dng xe hi c nhnBng 4.1c : Kt qu x l nhn dng tiBng 4.2 : Kt qu x l nhn dng xe tng hpBng 4.3 : nh gi chnh xc trong nhn dng ca phn mm lun vnTrang 3V Hng Phong Lun vn tt nghipPHN AGII THIUTrang 4V Hng Phong Lun vn tt nghipi Hc Quc Gia Tp. H Ch Minh CNG HO X HI CH NGHA VIT NAMTRNG I HC BCH KHOA c Lp T Do Hnh Phc - - - - - - - - o O o - - - - - - - -NHIM V LUN VN THC SH v tn hc vin : V HNG PHONG Phi : NamNgy thng nm sinh : 22/02/1982 Ni sinh : Khnh HaChuyn ngnh : T NG HO M s HV :01506364I. TN TI: NHN DNG XE TRN C S TH GIC MY TNHII. NHIM V:- Phn tch v tng hp cc phng php nhn dng xe.- Xy dng chng trnh nhn dng xe da trn cng c Th gic my tnh.III. NGY GIAO NHIM V: ngy 30 thng 01 nm 2008IV. NGY HON THNH NHIM V:ngy 30 thng 11 nm 2008V. CN B HNG DN: TS. TRNG NH CHU Gio Vin Hng Dn Ch Nhim Ngnh B MnNi dung v cng Lun vn Thc s c Hi ng Chuyn Ngnh thng qua.Ngy .. thng .. nm 200PHNG O TO SAU I HC KHOA QUN L NGNHTrang 5V Hng Phong Lun vn tt nghipLI CM NTrc tin, xin cm n thy TS Trng nh Chu v gi m, quan tm, gip cho hc vin trong sut thi gian thc hin ti tt nghip ny.Bn cnh , hc vin cng xin gi li cm n n tt c nhng thy c trc tip ging dy trong sut kha hc; nhng ngi bn quan tm, ng vin v chia s kin thc cng nh kinh nghim chuyn ngnh trong qu trnh hc tp v rn luyn va qua ca hc vin.Cng xin chn thnh cm n s quan tm h tr, to iu kin v ht lng ng vin v tinh thn ln vt cht ca cc thnh vin trong gia nh trong sut thi gian qua.Sau cng, hc vin gi li chc sc khe, hnh phc n qu thy c, gia nh v bn b.Trng i hc Bch Khoa Tp. H Ch MinhThng 11 nm 2008Hc vinV Hng PhongTrang 6V Hng Phong Lun vn tt nghipL LCH TRCH NGANGH v tn : V HNG PHONGPhi : NamNgy sinh : 22-02-1982Ni sinh : Tp Nha Trang tnh Khnh HaH khu TT: 8/C3 u C phng 10 qun Tn Bnh Tp HCMa ch email : [email protected] [email protected] TRNH O TO:9/2000 4/2005: Sinh vin khoa in - in t, b mn K thut in t - h chnh quy - trng H SPKT Tp HCM.9/2006 n nay : hcvincaohcKhoainint, chuynngnhT ng ha - h chnh quy trng H Bch Khoa Tp HCM.QU TRNH CNG TC:2005 11/2006 : Qun tr mng ti Cng ty Phn mm Si gn (SSP Saigon Software Park).Trang 7V Hng Phong Lun vn tt nghipABSTRACTNow, in the age of the 21st century, thanks for the high speed development of Science and Technology, human is inventing and processing many scientific projects with theirs mega-structures. From the alternatives of machines and engines instead of human in works which required a high-level of decision and concentrating, the results, facts and effects is being trusted. These things are really huge meaning, thus increases values of lives s quality days by days.Inthisthesis, issuesnamedVehiclesDetectionandRecognitionBasedon Computer Vision, also have same ways of thinking above. This is one of the most amazing applications and projects which is resrearched and approached by many scientists who working in fields of Computer Vision and Digital Image Processing cause of demands in real lives and diversified approaching methods.This project shows some problems which related to the basic knowledge that beingbuiltoncontentswithin. TheauthorusedtoolscalledOpenCVtoapply Haar-like features that ran on Visual C++.NET environment and AdaBoost (Adaptive Boost) algorithms to speed up the detection and recognition processing on all perspectives and types of vehicles. Results have got a feature called real-time effects in detection and recognition. This is importance for modifying traffics, controlling lanes, extracting information of vehicles, Trang 8V Hng Phong Lun vn tt nghipTM TT LUN VN THC STrong thi i ca th k 21, vi s pht trin nhy vt ca trnh Khoa hc k thut, con ngi to nn v pht trin nhiu cng trnh khoa hc mang tnh tm c. Vi s thay th dn ca my mc cho con ngi trong cc nhim v mang tnh chnh xc v tp trung cao th kt qu t c hon ton c tin cy v nh gi cao. iu ny thc s c ngha to ln v gp phn tng thm gi tr v cht lng cuc sng. ti lun vn ny, nhn dng xe trn c s th gic my tnh, cng khng nm ngoi ngha . y l mt dng ng dng th v m nhiu nh khoa hc , ang v s khng ngng nghin cu v nhu cu thc tin v a dng phng php tip cn. Trong ti ny s trnh by trong cc vn lin quan ti kin thc nn tng xy dng nn lun vn. Hc vin s dng cng c OpenCV ng dng cc ctrngHaar-likechytrnnntngVisual C++.NETvthut tontngtc AdaBoost nhm nng cao tc pht hinv nhn dng cc hnh thi khc nhau ca xe. Kt qu thu c c c tnh thi gian thc cc din tin ca qu trnh pht hin v nhn dng xe.Ni dung lun vn gm 5 chng:Chng 1: Gii thiu tng quanChng 2: C s l thuytChng 3: Xy dng h thngChng 4: Kt qu - Nhn xt Phn tchChng 5: Kt lun v hng pht trin tiTrang 9V Hng Phong Lun vn tt nghipPHN BNI DUNGTrang 10V Hng Phong Lun vn tt nghipCHNG 1GII THIU TNG QUAN1.1 GII THIUTh gic l gic quan cho php con ngi cng nh hu ht cc loi ng vt khc thu thp thng tin nhanh nht, tinh t nht v cng l knh thng tin trao i tin cy gip a ra nhng quyt nh kp thi v nhanh chng trong hu ht cc hot ng trong thc t ca con ngi. V vy, vi ngha v cng quan trng , cng vi s pht trin ca khoa hc k thut v ng dng ca n trong nhiu lnh vc c tin hnh rng ri, nht l trong ng dng lin quan ti x l nh ca i tng c th l xe hi trong cnh quang giao thng, c bit l trong tnh trng xe ang chuyn ng. T gia th k XX n nay, c bit l t thp nin 80, ngy cng c nhiu ng dng c chc nng pht hin vt th, v d nh xe hi, l mt cng vic kh trong lnh vc x l nh. Chc nng ny c bit hu dng trong rt nhiu mi trng v lnh vc khc nhau (bao gm an ninh, th gic ngi my, gii tr, iu tit giao thng, ). Hng lot cc cuc nghin cu v th nghim v vn t ng nhn dng xe hi c tin hnh mnh m, song song cng lc vi s pht trin mnh m ca h thng giao thng trn th gii cng nh Vit Nam, l mt v d minh chng bi tnh c th, a dng, phc tp v cp thit.Trang 11V Hng Phong Lun vn tt nghipThng thng, cc c tnh ca x l v phn tch nh ch yu b nh hng bi c tnh ca nh tnh v nh ng (video). Cc l do c th a ra l: v tr tng quan gia my nh v i tng, xe b che khut mt phn hoc ton phn; s kt hp ca cc c im xe c, kch thc, mu sc, nh hng ca cnh nn ( sng chi, tng phn, nhiu ging i tng, ) l rt khc nhau, v n nh hng n cht lng ca qu trnh pht hin v nhn dng xe. Cn nh hng vmt chquancngcthknnhhngquanst ghi hnhcacamera, hng nh sng, c tnh k thut ca my nh, camera, tc h thng my x l ch (my tnh PC hoc laptop) cng gy ra nh hng khng nh n ti.1.2 MC CH NGHIN CUH thng nhn dng xe dng trong quan st giao thng l mt ng dng quan trng trong cuc sng hin i hng ngy. Vi h thng nh vy th mt thut ton pht hin v nhn dng theo thi gian thc l cn thit khi u vo ca h thng l mt chui hnh nh video. Vic ng dng mt thut ton gii quyt vn pht hin xe l mt trong nhng khu quan trng trong h thng quan trc giao thng. Tc v ny pht hin cc loi xe trong tm khong cch trung bnh v tm khong cch xa (trn 20m). [9, trang 13 15] [12, trang 410 411]1.3 CC TI NGHIN CU V HNG NGHIN CU NGHCho n nay, c rt nhiu cc ti nghin cu v h thng pht hin v nhn dng xe m ch yu l thc hin trong cc phng th nghim Khoa hc my tnh ca cc trng i hc trn th gii [1][2]. Cc nghin cu ny ch yu xoay quanh vn tm hng tip cn v xy dng m hnh thut ton pht hin v nhn dng xe trong vic quan st giao thng ni chung.Trang 12V Hng Phong Lun vn tt nghipCc ti ny, phn ln nu bt c phng php Lu lng quang, y l phng php in hnh cho vic quan trc h thng cc vt th chuyn ng c qu o ni chung hoc h thng xe tham gia giao thng ni ring [1][2][12]. Ngoi ra, cn c phng php x l trn pixel c trng i tng, ch yu l phn tch din tch v chu vi ng bao im nh ca i tng, coi l c trng ca loi xe quan st. Nhng bn cnh , ch mt s t cc ti li t s dng phng php phn tch v d tm c trng Haar-like. Do vy, trong lun vn ny, c th p ng tt cc yu cu v tin cy, n nh trong vic quan trc h thng giao thng, th hc vin ngh s dng phng php Haar-like pht hin xe trn c s thut ton trch c trng AdaBoost.1.4 TNG QUAN V PHT HIN V NHN DNG XE Bi ton pht hin v nhn dng xe hi c th gm qua 2 bc.1.4.1 Pht hin xePht hin xe l thut ton chuyn bit xut pht t thut ton pht hin vt th. Khi cho mt ngun nh u vo (c th l tn hiu hnh t camera hoc t mt file video nh dng AVI), thut ton xc nh xem trong khung hnh nhn c c xe ang c k vng hay khng. Nu c xe th ngay lp tc ch ra v tr v phm vi chim ch ca i tng xe c trong nh. y l bc quan trng u tin trong hu ht cc ng dng phn tch vt th ni chung v xe tham gia giao thng ni ring (v d: nhn dng kiu dng xe, nh v xe trong nh, bm theo xe, nhn bit v tr v t th ca xe c trong nh,).Trang 13V Hng Phong Lun vn tt nghip1.4.2 Nhn dng xeVi kt qu pht hin xe bc trn, t so snh vi c s d liu c xy dng sn tin hnh nhn dng c kiu dng xe l loi xe no. T th quan st xe t camera, v tr ca xe so vi camera v cc thng tin lin quan lun c cp nht tc thi bi my tnh.1.5 L DO THC HIN TINm c ngha quan trng ca knh thng tin thu c trong hu ht cc tnh hung di dng hnh nh. S pht trin mnh m v a dng ca x hi vi nhiu nghin cu v ng dng thuc lnh vc ny lun c tin hnh v p dng rng ri trong nhiu ngnh ngh v lnh vc khoa hc k thut khc nhau trn th gii, c bit l pht hin v nhn dng xe hi.Bi ton pht hin v nhn dng xe c nhiu nhm cc nh khoa hc quan tm v thc hin nhng p ng c vn x l trong thi gian thc l mt vn tng i kh. Thc t cho thy cc kt qu cn hn ch, tc x l chm, qu trnh x l nhiu nhm lnh trn my tnh ch khin cho tc b tr hon mc d khng nhiu.V vy, nghin cu ng dng ti pht hin v nhn dng xe x l trn c s th gic my tnh trong thi gian thc mang tnh cp thit.1.6 MC TIU TINghin cu ng dng pht hin nhn dng xe trn c s th gic my tnh, p ng trong thi gian thc.Trang 14V Hng Phong Lun vn tt nghip1.7 NHIM V LUN VN Phn tch v tng hp cc phng php nhn dng xe. Xy dng chng trnh nhn dng xe da trn cng c Th gic my tnh.1.7.1 Phm vi thc hin V l thuyt: phng php ph hp pht hin v nhn dng xe. V ng dng: chng trnh phn mm pht hin v nhn dng xe. Cc iu kin thc hin: camera ghi hnh trc din t pha sau ui ca xe, cng nh sng l 300 500 lux ( sng tiu chun bnh thng) hoc nh sng ngoi tri ban ngy bnh thng. i tng l cc loi xe vi cc hnh dng khc nhau (xe hi c nhn, xe but, xe ti container). Vic nhn dng c thc hin t pha sau ui ca xe.1.7.2 D kin cc lnh vc ng dng ca ti Gim st an ninh Quan st v iu tit giao thngTrang 15V Hng Phong Lun vn tt nghipCHNG 2C S L THUYT2.1 CC PHNG PHP PHT HIN HNH NH XEPht hin hay pht hin i tng chuyn bit, v d nh xe hi trong cnh quang giao thng, liu c xut hin trong nh thu c t camera (hnh ng) hay nhng tm hnh tnh da trn s tr gip ca my tnh t lu c con ngi nghin cu v pht trin bi n ng vai tr l c s chung v l nn tng nghin cu v ng dng trong cc lnh vc v cc h thng khc. Trong qu trnh nghin cu v pht trin, th yu cu c t ln hng u l yu t chnh xc v phi thc hin nhanh chng trong thi gian thc. Do vy, vic ny cn c s phi hp v b sung cht ch cho nhau ca hai lnh vc l X l nh (Image Processing) v Th gic my tnh (Computer Vision).C rt nhiu phng php v hng tip cn ca vn pht hin xe hi. nh v xe trong mt cnh quang giao thng l phng php n gin, bi v n ch xc nh v tr hay ta ca chic xe c trong nh m thi. Vic tip theo l nhn dng (vehicle recognition) l cng vic phc tp hn. Tc v ny s so snh mt nh ca xe hi trong nh u vo vi tt c cc nh c trong c s d liu c hun luyn trc v a ra nh gn nht.Trang 16V Hng Phong Lun vn tt nghipChai hngtipcnchnhthngcsdngpht hinxe: cc phng php da trn nh v cc phng php da trn dng hnh hc. Cc phng php c th c lit k ra nh sau [9, trang 17 25]2.1.1 Pht hin da trn nhCc phng php thuc nhm ny da trn mt tp hp cc hnh mu ca i tng v s dng ca s trt pht hin xe. Cch lm ny khc bit so vi cc phng php da trn khun mu (cn thit phi c sn m hnh xe, hnh thi xe). trch c trng t cc mu v d, cn phi thc hin vic cho hc hun luyn di dng thng k hoc cc thut ton hc my (machine learning) vi nhiu cc mu nh c cha i tng xe v khng cha i tng xe. Do s xut hin ca xe trong nh l ngu nhin vi nhiu gc quan st khc nhau nn thng phi xp x chng to nn s phn bit ca hai i tng. Ty theo cch tip cn xc xut no m s xut hin cc phng php pht hin tng ng. Lit k di y l mt s cc phng php thuc nhm ny: Phng php EigenObjects (PCA) Phng php Fisher s Linear Discriminant Cc phng php da trn Eigen-space Cc phng php da trn mang n-ron nhn to Support Vector Machine SVM Phng php M hnh Markov n (Hidden Markov Model HMM) Phng php Sparse Network of Winnows (SNoW)Do nhm phng php ny da trn vic hun luyn sao cho thu c m hnh i tng xe t mt tp d liu tch cc (positive - nh c cha hnh xe hi) v Trang 17V Hng Phong Lun vn tt nghipmt tp d liu khng tch cc (negative - nh khng cha hnh i tng) nn chng c s tng quan so snh trc tip n cc c im hnh hc ca mt kiu xe in hnh.Nhc im ca phng php ny i hi phi lun c sn c s d liu hnh xe rt ln. c th pht hin v nhn dng c xe, my tnh phi lun d trong c s d liu hnh ny ri mi a ra kt qu.2.1.2 Pht hin da trn dng hnh hcKhc vi nhm phng php va nu trn, cc phng php thuc nhm ny quan tm n cc c im cu trc hnh hc ca xe. V vy chng cn c gi l nhm tip cn da trn c trng (feature - based). Ty theo cch trin khai vn m chng c chia thnh hai phn nhm: Cc phng php Bottom Up Phng php da trn lung nh sng (hay lu lng quang - optical flow)Nhm phng php Bottom Upch yu dng cc c im hnh dng bt bin ca xe i vi ngoi cnh v nn nh pht hin ra xe. Ri ty vo mi lin h ca chng vi nhau m thit lp cc lin kt gia cc c im bt bin ny ngay trong nh u tin, tip theo s da vo m tm chng trn cc nh k tip.Phng php ca phn nhm th hai, lung nh sng, l phng php x l tng quan nh sng theo tun t cc bc. Th nht, thut ton tm c trng quan trng ca i tng (v d nh gc ca xe) trong hai khung hnh lin tip nhau. Th hai, dng thut ton hp nht tnh lin quan ng nht gia cc c trng (trong trng hp nylgc caxe). Bc cui cng, cc lung ctrng i Trang 18V Hng Phong Lun vn tt nghiptng c trch xut khi nh c tp hp li thnh mt nhm nu cc khong cch Euclide ca cc lung (v tr i tng v hng chuyn ng ca i tng) l nh. [1, phn 2.1]Cth, phngphpnykhngch sdngccthut tonhc(learning algorithm) hun luyn to cc b phn lp (cascade) bng cc hnh mu v d tch cc (c cha hnh nh xe) v cc hnh mu khng tch cc (khng cha hnh nh xe hi) c la chn cn thn (y l phng php da trn nh). Cc hnh nh sau khi c chn lc cn thn s c quyt nh c trng cho tng loi xe bi thut ton hc hu ht c lin quan trc tip n cc c trng ring bit trn hnh nh xe hi (c im cc chi tit trn xe, gng, u xe, ui xe, dn n, cc g ni, ). K thut tng tc ci thin tc tm kim da trn cc b phn loi bng cch ly ra cc trng s cho cc mu v d dng trong hun luyn.[1, phn 2.2]2.2 PHNG PHP C S DNG TRONG LUN VNTrong lun vn ny, vic pht hin xe l s kt hp gia mt thut ton tng tc AdaBoost (Adaptive Boost tng tc thch nghi) v c tnh p ng nhanh ca cc c trng Haar. y l mt phng php c xem nh l phi hp ca c hai phng php nu trn l : Phng php da trn nh v Phng php da trn dng hnh hc. thc hin chc nng pht hin v nhn dng xe hi, hc vin trin khai s dng thut ton pht hin i tng (da trn cc c trng Haar-like v thut ton tng tc AdaBoost) trn tng frame nh thu c t ngun tn hiu hnh nh (camera hoc file video) ri da vo cc thut ton x l nh v th gic my tnh thi hnh cc tc v ln cc xe c pht hin v nhn dng. Sau y l phn trnh Trang 19V Hng Phong Lun vn tt nghipby phng thc hot ng ca phng php pht hin xe hi bng cc c trng c lit k sau y:2.2.1 Cc c trng Haar-likeMc ch ca vic s dng cc c trng Haar-like l m bo yu cu p ng thi gian thc. Mi mt c trng Haar-like bao gm 2 hoc 3 khi hnh mu trng v en lin kt nhau. (Hnh 2.1 a, b, c, d) [1, trang 4] [4, trang 2] [9, trang 33]Hnh 2.1a: Cc c trng cnhHnh 2.1b: Cc c trng ngTrang 20V Hng Phong Lun vn tt nghipHnh 2.1c: Cc c trng bao quanh tmHnh 2.1d: c trng ng choGi tr ca c trng Haar-like c xc nh bi chnh lch gia tng cc gi tr pixel mc xm nm trong vng en so vi vng trng.Cch dng nh chia nh (integral image) gip tnh ton nhanh chng cc c trng Haar-like.Hnh chia nh v tr (x,y) bng tng cc gi tr pixel pha bn tri ca ta (x,y) bao gm: y y x xy x i y x P' , ') ' , ' ( ) , ((2.1)Trang 21V Hng Phong Lun vn tt nghipHnh 2.2: nh chia nh ti ta (x,y)Tng cc gi tr pixel trong vng A:P1 = A1 ; P2 = A2; P3 = A1 + A3P = A + A1 + A2 + A3; (2.2)A = P + P1 P2 P3;Hnh 2.3: Tng cc gi tr pixel nm trong vng A pht hin ra xe hi, nh u vo c pht hinbng mt ca s con c cha c trng Haar-like. Da trn tng c trng Haar-likejf , mt b phn loi yu ) (x hjc quy nh nh sau:Trang 22V Hng Phong Lun vn tt nghip' h w;{ o o45 , 0 . Hai v d cho hai trng hp ca hnh ch nht c cho trong Hnh 2.4.Trang 23V Hng Phong Lun vn tt nghipHnh 2.4: V d v cc t th ca hnh ch nht c trngS lng c trng xut pht t mi mu l ln v khc nhau gia mu ny vi mu khc v c tnh theo cng thc bn di.Nu cho w W X / v h H Y / th s lng c trng i vi kch thc h wtrong nh c kch thcH W c tnh theo cng thc bn di: [4, phn 2.1]

,`

.| + + ,`

.| + + 211211Yh HXw W Y XTrong trng hp hnh ch nht c trng nghing 45oth cng thc tnh s lng c trng:

,`

.| + + ,`

.| + + 211211Yz HXz W Y X vi h w z + 2.2.3 Thut ton tng tc AdaBoostAdaBoost (Adaptive Boost) l mt thut ton hc mnh, gip y nhanh vic to ra mt b phn loi mnh (strong classifier) bng cch chn cc c trng tt trong mt h cc b phn loi yu (weak classifier - b phn loi yu) v kt hp chng li tuyn tnh bng cch s dng cc trng s (Hnh 2.5). iu ny tht s Trang 24V Hng Phong Lun vn tt nghipci thin dn chnh xc nh p dng hiu qu mt chui cc b phn loi yu. [9, trang 39 47]AdaBoostTp hun luynH cc bphn lp yuB phnlp mnhCc trng sHnh 2.5: Lc c bn ca AdaBoostThut ton hc ny ban u duy tr mt phn b chun (tng ng nhau) cc trng s ln mi mt mu hun luyn. Trong bc lp u tin, thut ton hun luyn mt b phn loi yu bng cch dng mt c trng Haar-like thc hin tt nht vic pht hin cc mu th hun luyn. Trong ln lp th hai, cc mu th dng cho hun luyn nhng b phn loi nhm bi b phn loi yu u tin c nhn trng s cao hn sao cho c trng Haar-like c chn ln ny phi tp trung kh nng tnh ton cho cc mu th b phn loi nhm ny. S lp li tip tc thc hin v cc kt qu cui cng s l mt chui cascade cc kt hp tuyn tnh ca cc b phn loi yu, to ra mt b phn loi mnh, gip to c chnh xc mong mun. Thut ton hc AdaBoost sau 3 ln lp c minh ha trong Hnh 2.6 l mt v d thut ton AdaBoost sau ba ln lp. [11]Trang 25V Hng Phong Lun vn tt nghipHnh 2.6: Thut ton hc AdaBoostPhng php AdaBoost c nhiu dng khc nhau [4, phn 3] : Tng tc thch nghi ri rc (Discrete AdaBoost DAB) Tng tc thch nghi thc (Real AdaBoost RAB) Tng tc thch nghi linh hot (Gentle AdaBoost GAB)Cc phng php trn u c dng cho vic tnh ton phc tp t cc mu phn loi, nhng khc nhau thut ton hc hun luyn. (Bng 2.1)Bng 2.1: Cc dng thut ton hc hun luyn AdaBoostTrang 26V Hng Phong Lun vn tt nghipReal AdaBoost1. Ng vo: S =( ) ( ) { N Ny x y x , , ... , ,1 1 S cc bc lp li T2. Khi to: N dn/ 1) 1 (cho tt c n = 1, , N3. Do for t =1, , T(a) Hun luyn b phn loi bng b mu th c nh trng s { ) (,td Svi gi thit:

{ 1 , 1 : + x ht, v d( )) (,ttd S L h.(b) Tnh sai s hun luyn cho b trng s t ca ht :( ) Nnn t ntn tx h y I d1) () ( (c) t:ttt1log21(d) Cp nht cc trng s:{ t n t n ttntnZ x h y d d / ) ( exp) ( ) 1 ( +Vi Zt l hng s chun ha, sao cho +Nntnd1) 1 (1Ngng lnh if khi t = 0 hoc khi 213t v t T = t 14. Xut ra:TttTrrtTx h x f11) ( ) (Discrete AdaBoost (Freund & Schpire)1. N mu c cho ( ) ( )N Ny x y x , , ... , ,1 1 vi { 1 , 1 , iky xTrang 27V Hng Phong Lun vn tt nghip2. Bt u vi cc trng s N i N wi,..., 1 , / 1 3. Lp li cho M m ,..., 1 (a) Ph hp b phn loi ( ) { 1 , 1 x fms dng cc trng siw ca tp d liu hun luyn ( ) ( )N Ny x y x , , ... , ,1 1(b) Tnh cc thng s ( )( )[ ]x mf y w mE err 1 , ( ) ( )m m merr err c / 1 log (c) t gi tr( ) ( )( )i m ix f y m i ic w w 1 . exp ., i = 1,,N, v chun ha cc trng s iiw 14. Ng ra ca b phn loi( )]]]

Mmm mx f c sign1.Gentle AdaBoost1. Cho N mu ( ) ( )N Ny x y x , , ... , ,1 1 vi { 1 , 1 , iky x2. Bt u vi cc trng s N i N wi,..., 1 , / 1 3. Lp li cho M m ,..., 1 (a) Ph hp hm quy ( ) x fm bi trng s bnh phng ti thiu (least-squares) caiy i viix vi trng siw(b) t gi tr( ) ( )i m i i ix f y w w . exp . , i = 1,,N v chun ha cc trng s iiw 1 4. Ng ra ca b phn loi ( )]]]

Mmm mx f c sign1.Trong ba phng php AdaBoost trn, hc vin thc hin lun vn chn phng php GAB lm phng php chnh cho qu trnh hun luyn my.Trang 28V Hng Phong Lun vn tt nghipB phn loi mnh cui cng l s kt hp c trng s ca cc b phn loi yu:) ( ... ) ( ) ( ) ( ) (3 3 2 2 1 1x h x h x h x h x HN N + + + + Qu trnh hc hun luyn nhn dng theo tng chui cascade v cc giai on stage c th hin nh hnh di y, trong i tng cn c pht hin l ng cong c, kn, mu xanh da tri (c t tn l: Target Concept) [3]Hnh 2.7: M hnh minh ha tc v pht hin vt th dng chui cascadeTrong thc t, chui cascade cc b phn loi c trin khai nhm tng tc thc thi ca thut ton pht hin. Trong giai on u ca qu trnh hun luyn, ngng ca b phn loi yu c iu chnh thp sao cho xp x 100% cc i tng ch c th c d ra trong khi vn gi t l nhn dng sai mu khng tch cc gn bng zero. S cn bng ca mt ngng thp gn lin vi t l pht hin sai mu tch cc cao hn. Mt mu tch cc ng ra t b phn lp u tin l thng s t ng vo cho b phn lp th hai, cng s c iu chnh sao cho t c t l pht hin rt cao. Tng t nh th, mt mu tch cc xut ra t b phn lp th hai li tip tc l thng s t ng vo cho b phn lp th ba, [11].Trang 29V Hng Phong Lun vn tt nghipCc ca s con l tch cc (ph hp, d ng i tng) nu c cho qua ti tng b phn lp ca chui cascade c hun luyn. Nu khng, mt ng ra trn chui s loi bt k ca s khng ph hp ngay lp tc (Hnh 2.8); [9, trang 59] [10] ;[link 1].Hnh 2.8: Dng chui cascade c hun luyn pht hin ca s con ph hpBng cch s dng cu trc gm cc chui cascade song song, tc pht hin i tng s c ci thin ng k (Hnh 2.9) [link 1] .Trang 30V Hng Phong Lun vn tt nghipHnh 2.9: Cu trc cc chui cascade song song2.2.4 Giai on hun luyn ca b phn loi (stage) Thut ton tng tc thch nghi c s dng lm phng php chnh pht hin v pht hin i tng xe trong lun vn. Thut ton tng tc l m hnh hc my hiu qu c s dng nhiu trong cc ti v nhn dng trc y. M hnh ny ch s dng cc b phn loi yu. Tc v hc c da trn Nmu hun luyn( ) ( )N Ny x y x , , ... , ,1 1vi kx v { 1 , 1 iy.ix v vect c thnh t k. Mi thnh t k c chc nng m ha mt c trng c lin quan cho tc v hc. Ng ra mong mun sau khi m ha c hai gi tr l-1 v 1. Trong trng hp pht hin i tng vt th, thnh t ng voix l mt c trng Haar-like. Cc gi tr ng ra -1 v 1 cho bit nh x l c cha hay l khng cha i tng mong mun.2.2.5 Tng phn loi (cascade)Tng (t) ca b phn loi bao gm cc cy (tree) gi tr gim dn sau mi giai on (stage) m b phn loi c hun luyn nhn dng hu ht cc i tng vt th mong mun, ng thi cng loi b cc i tng khng c hun luyn. V d, trong lun vn ny, cc b phn loi c hun luyn qua t nht 20 giai on (stage). n giai on cui cng, gi tr false alarm = 07 6 . 9 5 . 020 e v trng kht (hit rate) khong 9047 . 0 995 . 020. (Hnh 2.10) [4, phn 4] Trang 31V Hng Phong Lun vn tt nghiph h h h h. . . . .1 - f 1 - f 1 - f 1 - fhit-rate = hNfalse-alarms = fNstage 1 stage 2 stage 3 stage NHnh 2.10: Cu trc cc chui cascade ni tip, vi N giai on hc hun luynGi s, thit lp ban u vi cc gi tr ' 9 9 5 . 05 . 0r a t e h i ta l a r m f a l s eStage 1:'9 9 5 . 05 . 011hfStage 2: '22229 9 5 . 05 . 0hfStage 3: '33339 9 5 . 05 . 0hfStage N: 'NNNNhf9 9 5 . 05 . 0Trang 32V Hng Phong Lun vn tt nghipTi mi giai on hun luyn stage, b phn loi to ra thng s hit-rate h v false-alarm rate f mi lm ng vo thng s t cho giai on hun luyn k tip sau. ng vi mi giai on c hun luyn s dng mt trong phng php tng tc. B tng tc c th hc hun luyn bi mt mt phn loi mnh da trn mt tp hp cc b phn loi yu bng cch d li trng s cc mu hun luyn. B phn loi yu c dng cho giai on u ca qu trnh hun luyn, dng tp hp v c kt cc c trng s ca tp hun luyn. Ti mi tng hun luyn, b phn loi da theo cc i lng c trng va c cp nht ti tng k trc (false-alarm,hit-rate) c thm vo nhm tng thm tnh chnh xc trong qu trnh tnh ton trng s c trng. Vi vic tng dn s giai on hun luyn v s lng cc b phn loi yu, s l cn thit tnh ra cc thng s false-alarm rate ng vi mi hit-rate tnh c s lm tng tnh chnh xc cho tc v pht hin i tng.Trang 33V Hng Phong Lun vn tt nghip2.2.6 c tnh co gin vng c trng i tng2.2.6.1 Pht biu bi tonKhng phi lc no i tng xut hin trong nh cng xut hin vi v tr ta hoc din tch v tr chim ch l khng i, m ngc li, cc i tng xut hin ti rt nhiu v tr khc nhau v din tch chim ch khc nhau. Do , c th pht hin ra c trng i tng trong nh vi cc din tch chim ch khc nhau th cn mt thut ton pht hin i tng bm theo tnh co gin ca c trng i tng. Mt trong nhng u im ca phng php c trng Haar-like l d dng co gin ca s c trng. Thut ton ny pht hin c trng vi cc nh chia nh cha cc cc c trng tm c trong nh bt u t pha trn bn tri v nh chia nh bt u c ln dn theo hng qua phi v hng xung di. Gii php thch hp khoanh vng c trng nh l khoanh vng bao gm tt c cc nh chia nh cha c trng va tm c. Khi i tng trong nh c xu hng tng dn din tch chim ch trong nh (v d trng hp i tng tin n gn camera) th lng nh chia nh tng nhiu hn cha cc c trng.2.2.6.2 Thut tonThut ton pht hin i tng, ng thi co gin vng ca s c trng sao cho lun bm theo i tng c vit trong Bng 2.2.Trang 34V Hng Phong Lun vn tt nghipBng 2.2: Thut ton pht hin ng thi co gin vng c trng i tng [3, trang 11]window_size = window_size0scale = 1objects = {}while (window_size image_size) doclassifier_cascade = classifier_cascade0 scaledX = scaledY = scalefor (0 Y image_height window_height) dofor (0 X image_height window_height) doregion_to_test = { 0 x X + window_width ; 0 y Y + window_width }if (classifier_cascade(region_to_test) = 1) thenobjects = objects {region_to_test}end ifX = X + dXend forY = Y + dYend forscale = scale C// C: constant; = 1.1 ; 1.2end whileTrang 35V Hng Phong Lun vn tt nghipCHNG 3XY DNG H THNG3.1 TNG XY DNG V HOT NG CA H THNGT yu cu t ra ca lun vn, hc vin xut v thc hin h thng: Mt card thu hnh nhn tn hiu video trc tuyn t camera (hoc nhp mt file video) v gi n n my tnh c phn mm pht hin v nhn dng xe c vit bng ngn ng lp trnh thch hp. Trong trng hp khng th cho h thng thc hin ti thc a cnh quanggiao thng th c th quay video li cnh quang giao thng cho my tnh x l. Sau thi gian tnh ton, my tnh s tin hnh pht hin v nhn dng xe xut hin trong chui hnh nh v tin hnh khoanh vng c cha c trng xe. Trong qu trnh nghin cu, hc vin tch hp thm thut ton c lng khong cch t camera n xe, m phn loi cc xe, t ngi kho st c th tnh ton cc thng s lin quan n xe hoc cnh quang giao thng.3.2 TIN HNH XY DNG C S D LIU NH XE3.2.1 Xy dng c s d liuTrang 36V Hng Phong Lun vn tt nghip3.2.1.1 Thu thp hnh nh xeNh vo vic s dng cc cng c tm kim trn internet v t cc ngun nh tin cy c sn, hc vin s dng su tm cc mu xe nhm mc ch xy dng c s d liu cc phn loi xe phc v cho ti. Cc ngun nh tch cc c hc vin su tm bao gm cc ngun d liu v a ch: Google Image Flickr ca Yahoo! Photobucket.com (trang web chia s nh) Ngun nh chia s t cc kho nh ca cc trng i hc trn th gii (MIT, UIUC, Carnagie Mellon,) nh do hc vin chp t thc a cnh quang giao thng (chim phn ln)Vic su tm v tm kim nh mu phc v cho cng tc hc hun luyn cho my tnh i hi tiu tn nhiu thi gian. Cc mu hnh nh xe c tm kim v su tm i hi c s ng nht v t th chp ly mu v cc kiu dng khng qu khc bit, cng nh hnh dng khng qu ging so vi cc mu xe cn li. Cc xe c chn lm nh mu hc hun luyn phi c v tr r rng trong nh, khng b che khut (nu b che t hn 41 din tch pixel cng tm chp nhn) v c t th i xng, ngha l khng qu nghing theo cc hng x, y, z (110% i vi hng x v y; 50% i vi hng z). Cc nh khng tch cc (khng cha hnh i tng) c hc vin ly t ngun d liu c sn vi cc dng hnh phong cnh thin nhin, hnh chn dung, ng thc vt, ni tht, kin trc,Trang 37V Hng Phong Lun vn tt nghip3.2.1.2 Phn loi bng tay c s d liu hnhCc nh sau khi c thu thp, sau c hc vin phn loi ring bit theo tng hnh dng khc nhau ca xe (xe hi du lch c nhn, xe but, xe ti,).Vi mi c s d liu c to thnh, hc vin s dng hn 550 hnh tch cc (hnh c cha i tng - positive image) v 6.000 hnh khng tch cc (khng cha i tng - negative image) dng cho hun luyn.Trong lun vn, cc loi xe c phn nhm ty theo c trng v hnh dng cu trc bn ngoi v chc nng s dng nh ni trn. Cc nhm hnh sau khi phn bit c t ring r nhm to thun li cho vic hun luyn xe trn c s cc mu phn loi ny.Mu hnh hun luyn tiu biu cho tng nhm phn loi xe trnh by trong Bng 3.1 a, b, c :Bng 3.1:Bng 3.1a: Mu xe hi du lch c nhnBng 3.1b: Mu xe butTrang 38V Hng Phong Lun vn tt nghipBng 3.1c: Mu xe ti Cc nh khng tch cc, khng cha i tng (negative image) c su tm d dng t cc ngun nh c sn.3.2.1.3 Tin hnh ly mu, to b c s d liu hun luynTrong cng c hun luyn OpenCV 1.0 ca Intel c sn lnh Objectmarker.Lnh ny dng nh du vng c cha c trng ca i tng c trong nh bng cch dng hnh ch nht nh du khoanh vng cha c trng. (Hnh 3.1)Trang 39V Hng Phong Lun vn tt nghipHnh 3.1: Minh ha qu trnh ly mung bao ch nht mu tm nh du vng c trng i tng cn hun luyn3.2.1.4 Tin hnh hc hun luyn cho my tnhCngsdngcngc ni trn, sdnglnhCreatesamplesv Haartrainning hun luyn to c s d liu c trng v xut c s d liu ra dng file .xml phc v trong m lnh chng trnh phn mm nhn dng ca lun vn.Hai lnh chun, in hnh c hc vin thc hin trong lun vn: To file hc vector vector.vecdng lnh:Trang 40V Hng Phong Lun vn tt nghipMu lnh thi hnhcreatesamples.exe -info positive/info.txt -vec data/vector.vec -num 466 maxxangle 1.1 maxyangle 1.1 maxzangle 0.5 -w 20 -h 20vi,-info positive/info.txt: file cha thng tin ta ca khung ch nht bao c trng i tng trong nh mu.-vec data/vector.vec : ng dn cha file vector.vec to ra trn.-num 466 : b hun luyn gm 466 nh tch cc (c cha i tng).-w 20 : chiu rng mu ng ra (tnh theo pixel).-h 20 : chiu cao mu ng ra (tnh theo pixel).Cc thng s maxxangle , maxyangle , maxzangle quy nh cc gc xoay ti a theo cc hng trong khng gian ca i tng m m bo i tng vn c pht hin. Tin hnh hc hun luyn cho my tnh:Mu lnh thi hnhhaartraining.exe -data data/cascade -vec data/vector.vec -bg negative/infofile.txt -npos 466 -nneg 3125 -nstages 24 -mem 1200 -mode ALL -w 20 -h 20 nonsym minhitrate 0.995 maxfalsealarm 0.5 weighttrimming 0.95vi,-datadata/cascade: ng dn cha cc file thng s ngra c cp nht(false-alarm , hit-rate) ca tng tng hun luyn (cascade).Trang 41V Hng Phong Lun vn tt nghip-vec data/vector.vec : ng dn cha file vector.vec to ra trn-bg negative/infofile.txt : ng dn n file cha cc nh khng tch cc-npos 466 : s lng nh tch cc (ging khai bo phn trn)-nneg 3125 : s lng nh khng tch cc (thng tin cc file ny c cha trong file infofile.txt)-nstages 24 : s lng giai on (stage) hun luyn-mem 1200 : dung lng b nh cn cho qu trnh hun luyn (MB). My tnh c b nh RAM cng nhiu th qu trnh hun luyn xy ra cng nhanh.-nonsym : khai bo cc i tng hun luyn l khng c tnh i xngminhitrate 0.995 maxfalsealarm 0.5 weighttrimming 0.95: l cc thng s quy chun v trng kht (ph hp hit rate) ti thiu, ngng sai (false alarm) v trng s hun luyn (Hnh 3.2). Cc gi tr trn l mc nh, hoc c th thay i ty theo kh ca i tng v s lng nh mu.Hnh 3.2: Hnh minh ha qu trnh hc hun luynTrang 42V Hng Phong Lun vn tt nghipGhi ch: cc lnh trn c chy trong mi trng h iu hnh Windows v c ng gi trong cc file thc thi lnh nh dng .batnhm d chnh sa v thao tc.Theo khuyn co ca Intel [7], my tnh c dng cho cng tc hun luyn ny i hi phi c cu hnh mnh. V vy, hc vin thc hin xy dng c s d liu s dng my tnh bn vi CPU Intel Core 2 Duo E6320 2 x 1.86 GHz, RAM 2GB, HDD 80GB. Vi cu hnh my ny th mi mt c s d liu (mi mt file .xml) c to thnh tiu tn thi gian lin tc hn 42 ting ng h (gn 2 ngy).C s d liu nh dng file .xml sau khi xy dng c dng nh trong Bng 3.2.Bng 3.2: Cu trc file c s d liu c trng ca i tng xe hi c nhn

20 20

11 11 1 8 -1.

11 11 1 4 2.12.1753159817308187e-003Trang 43V Hng Phong Lun vn tt nghip-0.73076921701431270.4051173031330109

12 7 12 1 -1.

12 7 6 1 2.13.6706560058519244e-004-0.70521551370620730.2407480031251907

3.2.2 Ghi nhn v th mu c s d liu kt quVi mi c s d liu to ra, hc vin tin hnh kim th nhiu ln nh gi tin cy nhm ngy cng nng cao t l pht hin ng i tng. Do , mi mt c s d liu c th c xy dng t nht mt ln nh gi c s d liu no l tin cy nht a vo h thng.Trang 44V Hng Phong Lun vn tt nghipQu trnh th c s d liu trn nh tnh nhm nh gi t l pht hin ng i tng tng ng vi c trng cha trong cc file c s d liu .xml tng ng. kim th c s d liu, dng lnh:objectdetect.exe --cascade="tn_s_s_d_liu" tn_file3.2.2.1 i vi xe hi c nhn Th nghim trn 1 nhHnh 3.3: Minh ha qu trnh kim th c s d liu car_back.xmlKt qu cho thy xe hi trong nh c pht hin ng, xe c hnh ch nht mu xanh bao quanh. Th nghim trn nhiu nh tnhBng 3.3: Kt qu kim th c s d liu c trng xe hi c nhnTrang 45V Hng Phong Lun vn tt nghipTrang 46V Hng Phong Lun vn tt nghipTrang 47V Hng Phong Lun vn tt nghipTrang 48V Hng Phong Lun vn tt nghipTrang 49V Hng Phong Lun vn tt nghipTin hnh kim th tp c s d liu vi 150 nh tnh xe hi. Kt qu l c 142 nh c pht hin ng i tng xe trong nh, t t l95%.Trang 50V Hng Phong Lun vn tt nghip3.2.2.2 i vi xe but Th nghim trn 1 nhHnh 3.4: Minh ha qu trnh kim th c s d liu bus_vn_full_22112008.xmlKt qu cho thy xe but trong nh c pht hin ng Th nghim trn nhiu nh tnhTrang 51V Hng Phong Lun vn tt nghipBng 3.4: Kt qu kim th c s d liu c trng xe butTrang 52V Hng Phong Lun vn tt nghipTrang 53V Hng Phong Lun vn tt nghipTin hnh kim th tp c s d liu vi 180 nh tnh xe but. Kt qu l c 173 nh c pht hin ng i tng xe trong nh, t t l96%.3.2.2.3 i vi xe ti Th nghim trn 1 nhHnh 3.5: Minh ha qu trnh kim th c s d liu truck_vn_26112008.xmlKt qu trn c nh gi l thnh cng v i tng xe ti trong nh c pht hin ng. Th nghim trn nhiu nh tnhTrang 54V Hng Phong Lun vn tt nghipBng 3.5: Kt qu kim th c s d liu c trng xe tiTrang 55V Hng Phong Lun vn tt nghipTrang 56V Hng Phong Lun vn tt nghipTrang 57V Hng Phong Lun vn tt nghipTin hnh kim th c s d liu truck_vn_26112008.xmlvi hn 120 nh tnh. Kt qu c 115 nh c pht hin ng, tng ng vi t l 96%.Bng 3.6: Tng kt cc kt qu kim th CSDL c trng xeLoi xeS lng nhkim thS lng nhpht hin ngT lXe hi c nhn 150 142 95%Xe but 180 173 96%Xe ti 120 115 96%3.3 TIN HNH XY DNG THUT TON3.3.1 Thut ton pht hin xeNh vo s h tr ca cng c OpenCV version 1.0 (p dng th vin m ngun m v th gic my tnh trn nn .NET) do Intel pht trin, tc gi s dng thut ton pht hin c trng i tng l Haar-like vi cc lnh HaarClassifierCascadevcvHaarDetectObjects thc hin chc nng pht hin xe, sn sng cho bc tip theo l tin hnh nhn dng ra kiu dng xe .3.3.2 Thut ton nhn dng kiu xeTrong thc t, khi con ngi quan st mt chic xe ang lu thng trn ng, th ngay lp tc ngi s nhn bit ngay rng xe xe loi g, c th c lit k nh: xe hi c nhn, xe but, xe ti, l do qua kinh nghim, ngi ch ng nhn bit c kiu dng xe t cc ngun thng tin tin cy khc nhau trong qu kh. Qu trnh ny c th cng c coi nh l ngi c hun luyn Trang 58V Hng Phong Lun vn tt nghiptrc hnh dng c trng ca chic xe . V vy, khi quan st chic xe, lp tc ngi s bit c loi xe l g.Tuy vy, nhng my tnh th khng th ging con ngi, ngha l khng th nhn bit ngay c l c i tng xe vi hnh dng c trng cn pht hin trong vng th trng hay khng. V vy, cho my tnh bit c kiu dng ca tng loi xe, ta cn phi cho h thng bit c cc kiu dng xe t trc thng qua qu trnh hun luyn da trn cc b phn loi m hc vin thit lp qua cc mu hnh c chn lc k cng. Mi mt b phn loi cc hnh nh mu i tng , hc vin gn mt nhn tng ng vi tn ca c s d liu kiu dng xe (xe hi c nhn, xe but, xe ti, ).B phn loi kiu dng xe ny c chc nng nh l mt c s d liu cha cc c trng ca tng loi xe. V vy, sau ny khi mt chic xe bt k c pht hin trong khung hnh hay vng th trng ca camera, th lp tc n c so snh vi hnh nh v c trng c trong c s d liu ny. Nu cc c trng l ph hp vi c trng c trong c s d liu, th t mi c th xut ra c dng thng bo tn kiu dng xe c nhn dng trn tng khung ch nht bao i tng.Chng trnh nhn dng xe c th hin trong Hnh 3.6, th hin mt chu k lm vic ca h thng.Trang 59V Hng Phong Lun vn tt nghipBT ULOAD NH T CAMERATIN X LTIN LC NH& X L NHIULOAD C S D LIUD TM C TRNGTRCH XUT THNG TIN I TNGM I TNGC LNG KHONG CCHKT THCNHN DNGXEKHOANH VNGHnh 3.6: S khi ca chng trnh nhn dng xeTrang 60V Hng Phong Lun vn tt nghipM lnh chng trnh thc thi thut ton nhn dng c trnh by trong Bng 3.7.Bng 3.7: M lnh in hnh ca thut ton pht hin v nhn dng xe hiconst char* cascade_name4 = "car_front_back.xml";CvMemStorage* storage1 = cvCreateMemStorage(0);cascade1 = (CvHaarClassifierCascade*)cvLoad(cascade_name4, 0, 0, 0);CvSeq* object1 = cvHaarDetectObjects(gray7, cascade1, storage1, 1.05, 2, CV_HAAR_DO_CANNY_PRUNING, cvSize(20,16));int i1;for (i1 = 0; i1 < (object1 ? object1->total : 0); i1++){CvRect* r1 = (CvRect*)cvGetSeqElem(object1, i1);pt1.x = r1->x;pt1.y = r1->y;pt2.x = r1->x + r1->width;pt2.y = r1->y + r1->height;cvRectangle(display, pt1, pt2, CV_RGB(255,0,0), 2, 8, 0);cvPutText(display, "car", cvPoint(pt1.x, pt1.y - 4), &font, ... ... CV_RGB(255, 0, 0));}3.3.3 Thut ton c lng khong cchThut ton ny c hc vin p dng trn tng i tng xe c nhn dng, v qu trnh c din ra theo thi gian thc.Trong thc t, mt ngi khi ang quan st chic xe, th ngi s c th c lng c khong cch t ngi n chic xe da theo kinh nghim. C ngha l, mt ngi bnh thng khi quan st mt chic xe, th da vo kch thc ca hnh nh m mt thu nhn c s c lng c khong cch t ngi Trang 61V Hng Phong Lun vn tt nghipn chic xe. V d, vi cng mt loi xe, vi mt chic xa th hnh nh quan st c s nh hn so vi hnh nh ca mt chic xe gn (Hnh 3.7). Chnh v vy, vic c lng khong cch l cn thit c th p dng vo cc h thng quan st giao thng thc t. [1, phn 3.3]Hnh 3.7: M hnh ha thut ton c lng khong cchChnh v l do , nhm nng cao chc nng quan st ca camera trong cnh quang giao thng, hc vin tch hp vo h thng thut ton c lng khong cch gia camera vi chic xe ang c pht hin. Thut ton ny c dng c lng khong cch gia camera v i tng xe hi da vo thng s lin quan nh: chiuditiu c cacamera,thng squyitpixel ra milimetti mt phng tiu c v ln thc t in hnh ca xe. [2, trang 75, phn 4.5]Hnh 3.8: M hnh camera quan st trong khng gian 3-D [6, trang 27]Trang 62V Hng Phong Lun vn tt nghipTrong thc t, c lng khong cch da trn cch tnh ca th gic my tnh c ng dng rng ri v c tm quan trng trong cc h thng quan trc trc tuyn h thng giao thng nhm gip tng thm cng c h tr cho h thng gim st giao thng.C th, cng thc c lng khong cch theo l thuyt c tnh theo cng thc: [6, trang 26 28] [link 3, chapter 1-2]ZXf x xXf Z Vi,f : l chiu di tiu c ca cameraZ : l chiu di c lng (cn tm) gia camera n i tngX : l kch thc thc t ca i tng (n v chiu di)x : l kch thc nh ca i tng (pixel)Trong thc t, khong cch c lng cn cn mt thng s quy i n v pixel ra mm trong mt phng tiu c chor hoc cvert . [2, trang 75]Cng thc c lng khong cch c s dng trong lun vn l:wWf c Zhor hor (cng thc c s dng chnh)hochHf c Zvert vert Do tnh ng nht, t bin i v mt kch thc chiu ngang thc t ca mi loi xe; nn trong lun vn, hc vin ch thc hin p dng cng thc c lng khong cch da theo chiu nganghorZ.Vi,Z : (mm), l chiu di c lng (cn tm) gia camera n i tng.Trang 63V Hng Phong Lun vn tt nghipchor , cvert : l tham s chuyn i t pixel thnh milimet, theo hng ngang hoc thng ng.f : (mm), l chiu di tiu c ca camera.W, H: (m), l chiu rng ngang hoc chiu cao thc t in hnh ca loi xe quan st.w, h : (pixel) l chiu rng ngang hoc chiu cao trong nh quan st ca xe.Trong qu trnh thc hin lun vn, hc vin cng tin hnh kim chng thc nghim li cng thc ny v nhn c kt qu c lng khong cch camera n xe l kh chnh xc, vi mc sai s chp nhn c.M lnh thc thi thut ton c lng khong cch c ghi trong Bng 3.8.Bng 3.8:M lnh thc hin thut ton c lng khong cchdouble Z1;c_hor = m_chor; // m_chor nhap tu khung edit boxc_vert = m_cvert; // m_cvert nhap tu khung edit boxf = m_focal; // mm, focus length = 2mW1 = m_car_width; // mm, typical car 's widthH1 = m_car_height;w1 = pt2.x - pt1.x; // pixel, object 's widthZ1 = (c_hor * f * W1) / w1;// khoang cach tinh theo chieu ngangCString dist1;dist1.Format("%0.1f", Z1/1000);// chia 1000 doi mm->mcvPutText(display, dist1 + "m", cvPoint(pt1.x, pt2.y + 14),&font, ...... CV_RGB(255,0,0));// n v mtTrang 64V Hng Phong Lun vn tt nghipHnh 3.9: Minh ha kt qu c lng khong cchCh thch: Khong cch ca mi xe xut hin trong khung hnh c ghi ngay bn dikhung hnh ch nht bao i tng xe .3.3.4 Thut ton m s lng i tngThut ton ny c hc vin p dng cho tng khung hnh quan st cnh quang giao thng nhm m s lng tng loi mu xe c nhn dng. Phng php m ny s cho ra kt qu l s lng cc i tng tc thi c trong khung hnh nhm nh gi mc n nh ca thut ton pht hin i tng.M lnh thc thi thut ton m s lng i tng c ghi trong Bng 3.9.Trang 65V Hng Phong Lun vn tt nghipBng 3.9: M lnh thc hin thut ton m xe// m lnh thut ton m xe theo phn loiCString count1;count1.Format("%d", object1->total);cvPutText(display,count1+"cars",cvPoint(5,220),&font,CV_RGB(255,0,0));Hnh 3.10: Minh ha kt qu m s lng xe c trong khung hnhChthch: Kt qumslngmi loi xechinth trongmcCOUNTING RESULTSTrang 66V Hng Phong Lun vn tt nghip3.4 TIN HNH XY DNG PHN MM3.4.1 Chun b h thng v cc cng c lp trnh thch hpMi trng xy dng chng trnh pht hin v nhn dng l: My tnh chy trn h iu hnh Windows XP. Mytnhcci bVisual Studio2003Professional Edition, ctchhp .NET Framework version 1.1. S dng ngn ng lp trnh Visual C++, Visual C#. Ci t b ngn ng th gic my tnh OpenCV 1.0 (C++) v SharperCV (C#).Cc lnh trongca Th gic my tnh c tch hp trong chng trnh chy trn nn .NET Framework nh vo cc th vin headfile dng th vin .lib ; dng headfile .h v .hpp.3.4.2 T chc chng trnh phn mm h thngGIAO TIP CAMERAD TM XETRCH XUT THNG TINC LNG KHONG CCH, M S LNG,...CHNG TRNH H THNGHnh 3.11: S khi t chc phn mm h thngH thng chng trnh thc hin cc tc v: X l chui nh video u vo.Trang 67V Hng Phong Lun vn tt nghip Thc thi thut ton Haar pht hin xe. Tin hnh nhn dng kiu dng xe da theo c trng c trong c s d liu. Thcthi cctcvbtrkhc(mthigianphthinitng, c lng khong cch, m s lng tng loi xe, ). Hin th thng tin v cc thng s theo thi gian thc ln mn hnh v giao din.FILE VIDEO .AVICAMERACHNG TRNH H THNGTRCH XUT THNG TIN I TNG XEPHT HIN V NHN DNG XEM lnh M lnhKt qu Kt quHIN TH DNG XEHIN TH THNG SLIN QUANMy tnh PC hoc laptopHnh nhNgun hnh nh u voKt qu & thng tin ng raHnh 3.12: S khi h thng hon chnh t chc phn mm h thngH thng phn mm c thc hin da trn hai phn chnh:Trang 68V Hng Phong Lun vn tt nghip X l chui nh video nhn c v pht hin c trng i tng xe da trn thut ton Haar. Trch xut thng tin & d liu ca xe c trong nh c lng cc thng s lin quan.3.4.3 S dng thut ton Haar-like phi hp vi cc m lnh trn Visual C++Chng trnh s dng cng c OpenCV 1.0 chy trn nn Visual C++.NET 2003 pht hin xe hi trong nh c m t nh trong Hnh 3.13.Hnh 3.13: M t h thng pht hin xe dng thut ton HaarSau khipht hinxe, s tin hnh nhn dng v khoanh vng i tng xe c nhn dng. Cc xe c pht hin s c hc vin thc hin khoanh vng i tng trong hnh ch nht thun tin hn trong cc x l v sau.3.4.4 Hot ng ca phn mmTrang 69V Hng Phong Lun vn tt nghipCc bc hot ng ca chng trnh c trnh by tm tt nh sau (xem chng trnh c ghi km trong a CD thm thng tin chi tit)a) Thu nhn tn hiu hnh nh T cameracapture = cvCaptureFromCAM(CV_CAP_ANY); T file video capture = cvCaptureFromFile("MVI_1324.AVI"); b) Pht hin xeDng lnh CvHaarClassifierCascade pht hin xeconst char* cascade_name1 = "car_frontal_back.xml";cascade1 = (CvHaarClassifierCascade*)cvLoad(cascade_name1,0,0,0);CvSeq* object1 = cvHaarDetectObjects(gray4, cascade1, storage, ......1.05, 2, CV_HAAR_DO_CANNY_PRUNING, cvSize(20,20));CvRect* car = (CvRect*)cvGetSeqElem(object1, i);Vicar_frontal_back.xmll file c s d liu cha cc c trng ca nhm phn loi xe hi c nhn c hun luyn ca xe vi gc nhn pha ui xe.c) Dng khung hnh ch nht bao quanh i tng c pht hinVi mi dng xe c pht hin v nhn dng, dng hnh ch nht bao bao quanh i tng. ng vi mi dng xe th c mu sc hnh ch nht khc nhau.pt1.x = r1->x;Trang 70V Hng Phong Lun vn tt nghippt1.y = r1->y;pt2.x = r1->x + r1->width;pt2.y = r1->y + r1->height;cvRectangle(display, pt1, pt2, CV_RGB(255,0,0), 2, 8, 0);d) Hin th dng ch tn nhn dng ca phn loi xe c pht hinTn ca phn loi xe c nhn dng c ghi ngay trn khung hnh ch nht bao quanh i tng gip ngi thc hin d dng theo di.Tc v ny l quan trng gip cho ngi tc gi thy c kt qu nhn dng xe.// hin th tn nhn dng xecvPutText(display, "tn_phn_loi_xe", cvPoint(pt1.x, pt1.y), &font, ... CV_RGB(255,0,0));e) Hin th khong cch ca camera ti xeTng t nh bc hin th dng ch tn nhn dng, khong cch t camera n xe v vn tc c ghi ngay trn khung hnh ch nht bao i tng.// hin th khong cch mi xe ti camera, n v l mtcvPutText(display, dist + "m", cvPoint(pt1.x, pt2.y),&font, ...... CV_RGB(255, 0, 0));Trang 71V Hng Phong Lun vn tt nghipf) Hin th s lng cc i tng xe ring bitThng tin v s lng tc thi hin c trong khung hnh cc loi xe c m v hin th theo thi gian thc, c hin th ti mt v tr c nh trn ca s video.// hin th s lng tng loi xecvPutText(display, "obj. count = " + count, cvPoint(5,15), &font, ...... CV_RGB(255, 0, 0));3.4.5 Giao din ca chng trnh phn mm h thngGiao din ca chng trnh pht hin, nhn dng i tng xe nh trong Hnh 3.14.Hnh 3.14: Giao din chng trnh nhn dng xeTrang 72V Hng Phong Lun vn tt nghipCh thch- Mc RECOGNITION: thc hin tc v d tm v nhn dng xe.- Mc TASKS: thc hin cc tc v nh s th t cc xe cng dng, hin th thi gian nhn dng, thc hin c lng khong cch, v thc hin m s lng tng loi xe xuthin trong khung hnh.- Mc COUNTING RESULTS: hin th kt qu m xe nhn dng.- Mc CAMERA PARAMETERS: cho php iu chnh thng s ca camera hoc thng s ca file video (.AVI).- Mc DIMENSIONS: cho php iu chnh rng (hoc cao) thc t in hnh catng loi xe CAR, BUS, v TRUCK.3.5 H THNG PHN CNG V CC CNG C LIN QUAN3.5.1 CameraCamera s dng trong lun vn l camera k thut s Nikon E4300 (4 megapixel)Hnh 3.15: Mu camera c s dng trong lun vnCamera ny dng ghi hnh cnh quanggiao thng nhm h tr cho qu trnh thc hin lun vn.Ngoi ra, camera ny cng c hc vin dng chp nh tnh cc xe dng lm mu hun luyn.Trang 73V Hng Phong Lun vn tt nghip3.5.2 My tnh c nhn v cc cng c phn mm My tnh s dng trong lun vn vi mc ch lm nn tng hun luyn to dng c s d liu c trng cc i tng xe. ng thi, my tnh c ci t OpenCV, Visual Studio .NET v nn tng lp trnh .NET Framework.Trang 74V Hng Phong Lun vn tt nghipCHNG 4KT QU - NHN XT VPHN TCH4.1 KT QU V mt nh sngTrong mi trng nh sng ngoi tri ti thc a cnh quanggiao thng, bnh thng vi cng khong 300 400 lux, hiu qu pht hin xe l kh tt. V mt khng gianCc xe khi quan st vi nhiu gc khc nhau theo cc phng x, y, z trong khong t 30o vn pht hin tt. (Bng 4.1)Kt qu thc thi h thngBng 4.1: Cc kt qu x l nhn dngBng 4.1a: Kt qu x l nhn dng xe butTrang 75V Hng Phong Lun vn tt nghipTrang 76V Hng Phong Lun vn tt nghipTrang 77V Hng Phong Lun vn tt nghipTrang 78V Hng Phong Lun vn tt nghipTrang 79V Hng Phong Lun vn tt nghipTrang 80V Hng Phong Lun vn tt nghipTrang 81V Hng Phong Lun vn tt nghipTrang 82V Hng Phong Lun vn tt nghipTrang 83V Hng Phong Lun vn tt nghipBng 4.1b: Kt qu x l nhn dng xe hi c nhnTrang 84V Hng Phong Lun vn tt nghipTrang 85V Hng Phong Lun vn tt nghipTrang 86V Hng Phong Lun vn tt nghipTrang 87V Hng Phong Lun vn tt nghipTrang 88V Hng Phong Lun vn tt nghipTrang 89V Hng Phong Lun vn tt nghipTrang 90V Hng Phong Lun vn tt nghipBng 4.1 c: Kt qu x l nhn dng xe tiTrang 91V Hng Phong Lun vn tt nghipBng 4.2: Kt qu x l nhn dng xe tng hpCh thch cc hnh trong Bng 4.1a, b, c v Bng 4.2 Mi xe hi c nhn c nhn dng s c khoanh vng bng hnh ch nht mu . Tng t cho xe butvi khung ch nht mu xanh, xe tivi khung ch nhtmu vng. Cc xe xut hin trong hnh c nh s th t (0, 1, ) t thp n cao ph thuc vo th t thi gian xut hin trc sau trong khung hnh. Mi mt xe sau khi c pht hin s c c lng khong cch t xe ncameraghihnh. Khong cch c ghi bn di mi khung ch nht baoitng (n v mt). Tng s lng xe xut hin tc thi trong khung hnh c m v ghi ngay lp tc ln khung bo trn giao din (Mc COUNTING RESULTS).Do trong qu trnh su tm hnh nh giao thng ti thc a, t c cc tnh hung 2 hoc 3 loi xe xut hin cng lc trong khung hnh nn nh chp mn hnh khng th c nhiu cc tnh hung c.Trang 92V Hng Phong Lun vn tt nghipKt qu nh gi chnh xc trong nhn dng xe trong nh ng (video) dng phn mm ca lun vn so vi nhn nh cm quan ca hc vin (mt ngi) c ghi trong Bng 4.3.Bng 4.3: nh gi chnh xc trong nhn dng ca phn mm lun vnLoi xeS lng xe kim thS lng xe nhn dng ngT lXe hi c nhn 47 43 91.5%Xe but 50 48 96%Xe ti 7 5 71.4%H thng vn c th pht hin xe n khi xe cn kch thc ti thiu quy nh trong dng m lnh pht hin.4.2 NHN XT4.2.1 u im H thng vn hot ng tt iu kin th nghim cho php. Trn c s h thng hon tt, c th pht trin, m rng thm vi nhiu ng dng hu ch v l th khc phc v cng tc hc tp, nghin cu su hn v ng dng thc tin.4.2.2 Khuyt imTrong qu trnh thc hin, lun vn cng c nhng thiu st mang tnh khch quan v ch quan:4.2.2.1 Ch quanTrang 93V Hng Phong Lun vn tt nghip Do kh khn v c s d liu:T th xe trong nh cng nghing theo cc hng bt k th qu trnh xy dng c s d liu t qu trnh my tnh hc hun luyn kt qu khng tt, khin cho h thng hot ng khng n nh. H thng hin ti cha p ng c tnh chnh xc v n nh cao trong tc v pht hin i tng c s bin chuyn ca mi trng ngoi cnh, v d nh c s thay i v thuc tnh v mu sc, t th quan st ca i tng, cng sng, phc tp ca nn nh. Cn nhiu thiu st trong khu chun b nh mu nhm phc v tc v hun luyn. Tuy nhin, h thng khng trnh khi li pht hin sai i tng do b chi sng, ngc sng, xe b che khut bi cc i tng khng mong mun khc (xe my, mt phn ca xe khc, cy ci,). Thc t cho thy, hnh nh th nghim (tp tin video) c ghi hnh trong thi gian t 7 gi sng n 4 gi chiu cho kt qu nhn dng tt hn cc thi gian cn li. iu ny c gii thch t sng hoc nh nng gp phn lm r i tng hn so vi nn nh v lm tng thm c trng nhn dng.4.2.2.2 Khch quanYu t khch quan bao gm cc vn kh khn trong khi xy dng h thng.Trang 94V Hng Phong Lun vn tt nghipa) Cc kh khn v phng phpa s cc hng tip cn pht hin vt th, c bit l xe mt cch t ng hiu qu nht hin nay thng da vo vic tm ra m hnh hoc b phn lp hoc mt c s d liu c t tt nht hnh dng mt chic xe. Vic h thng c kh nng hot ng tt trong bt k tnh hung, iu kin thu nhn nh no trong bt k tnh hung no vi cc t th quan st xe khc nhau l cc k kh khn, mc d i vi con ngi, vic ny l hon ton n gin trong a s cc trng hp thng thng.T nh ngha c th cho tng kiu hnh dng ca mt chic xe cho n cch tip cn pht hin v nhn dng c xut pht t nhiu c im, vi cc l do sau y [9, trang 13 15] [12, trang 410 411]: Hnh dng xe: hnh dng xe hi c th ni l a dng cng nh phc tp i vi ngi quan st hoc i vi thut ton pht hin v nhn dng. Bn cnh s a dng v mu sc cng l mt thch thc i vi qu trnh thc hin tc v pht hin xe trong cnh quang giao thng. Ngoi ra, xe cn c tnh a dng v hnh dng bn ngoi. Cc xe c chc nng khc nhau th c hnh dng khc nhau. V d xe hi c nhn (4 hoc 6 ch ngi) c cc c trng v np cap trc v sau (c th mt s dng xe khng c cap sau), xe but th c chiu cao c trng v pha sau khng c np cap cng nh l khng c g ni c trng ging nh xe hi c nhn.Trong mt s trng hp c bit xe c thm cc chi tit mu sn, bin qung co gn thm trn xe, cc xe b bin i v mt hnh thc dn n s bin dng hoc che lp cc c im c trng ca xe u l nhng kh khn trong qu trnh x l pht hin.Trang 95V Hng Phong Lun vn tt nghip T th xe v gc quan st: h thng c th pht hin ra i tng xe trong cnh quang giao thng hay khng, cn ph thuc vo gc quan st v v tr t camera quan st xe . Xe c nhn chnh din t pha trc hoc pha sau l cc v tr cha nhiu thng tin c trng v xe nht, t camera gn vi my tnh mi thu thp nhiu thng tin c trng nht v xe v c xem l nh chun khi hun luyn to lp c s d liu hoc p dng cho tc v pht hin sau ny.Cc c im c trng ca xe hu ht nm pha trc sau v bn hng ca chic xe, ni m cc knh chn gi, ca s hng, n chiu trc sau u c mi tng quan t l v kch thc, v tr tng i ca chng vi nhau.Tuy nhin, vi t th quan st xe nhn nghing, nhn t trn xung hoc kt hp ca cc t th k trn vn cha c mt phn thng tin c trng ca i tng lm cn c cho qu trnh pht hin sau ny. S c mt ca i tng khc: cc i tng xe cn quan st khi xut hin trong nh c th b cc vt th khc che chn mt phn hoc ton phn, v d nh cy ci, cc xe khc, con ngi, lm thiu thng tin i tng, kt qu phn tch, v kt qu pht hin xe s b nh hng t nhiu. iu kin ghi nhn nh: s xut hin ca xe trong cc iu kin chiu sng khc nhau (bao gm kiu chiu sng, cng sng v mu sc ca ngun sng) cng nh cc c tnh ca h thng thu thp d liu nh (camera, my nh, h thng gng phn x, thu knh, ) gp phn nh hng khng nh n kt qu pht hin xe ca h thng.Trang 96V Hng Phong Lun vn tt nghip Nn nh v iu kin ca mi trng ghi nhn nh: hai vn ny l ng c qua tm bi s nh hng ca n n qu trnh pht hin l khng nh. Khi nn nh cng cha nhiu thnh phn (bao gm nhiu chi tit ri rm, mu sc, hnh dng phc tp ging vi i tng nhng khng phi i tng - , ) hoc mi trng khng ng nht v nh sng (ngc sng, nh b bng rm che mt phn hoc ton phn ln i tng) hoc s bin i lin tc, xut hin ri bin mt qu nhanh, nhanh hn tc ghi hnh ca camera, th vn pht hin cng thm kh khn v phc tp. Nhng yu t nu trn vn c gi tr vi trng hp nh thu c nh vo cc phng pht pht hin khc vi hng tip cn khc thu c kt qu tin cy. Khi , ph thuc v thuc tnh ring ca loi ngun sng ny m ngi ta s s dng thm cc phng php x l mi. S bin i xut hin lin tc v qu nhanh nhanh hn tc ghi hnh ca camera th vn pht hin cng thm kh khn v phc tp. Mt s xe t ngt xut hin trong khung nh cng nh bit mt khi tm th trng ca camera l mt trong nhng kh khn kh c th trnh khi trong qu trnh thc thi h thng. Trong trng hp ny, yu cu cc xe quan st phi c thi gian xut hin trong tm th trng ca camera t nht vi giy camera c th quan st tt v thc hin tc v pht hin v nhn dng.b)Cc kh khn v tc thc thi v tc h thngVic la chn cch gii quyt sao cho h thng pht hin bm theo i tng trong phm vi th trng ca camera, iu kin cho php l tt nht l mt th thch khi c nhiu cch v phng php tip cn khc nhau. Bn cnh cn phi k n s tr gi cho cng ngh (hiu qu cao nhng b li tc chm v ngc li).Trang 97V Hng Phong Lun vn tt nghip4.3 PHN TCH KT QU T CVi cc u im v khuyt im va nu, sau y l mt s hng gii quyt kh thi: Sau mt thi gian tm hiu, mt vi cch khc phc lia gc my (khi ghi hnh video) c th c khc phc bng cch b sung cc tnh nng: cn chnh biu mu histogram (x l cn bng sng) c nh thch hp ri mi cho chng trnh x l pht hin i tng trong nh. Nhng nu b sung tnh nng ny th tc p ng ca h thng s b gim r rt. c th gi l s tr gi i li cho tnh nng tt. V vn tc hot ng chung ca h thng, do ph thuc vo nhiu yu t nh: tc ca thit b thu nhn (tt nu nh tip nhn c nhiu hn 15 khung hnh trong mt giy); tc phn tch nh; tc x l v ra quyt nh v tc dch chuyn ca ca i tng cn pht hin c trong nh nn nhn chung s c nhiu vn cn xem xt thm ty vo hng pht trin v ng dng c th ca h thng. Tnh hiu qu ca h thng c th c ci thin tt hn bng cch lp trnh linh hot hn v ti u v m code, c tnh n cc u tin v x l tt cc tnh hung s c ngoi mun (ngoi cnh,), khng loi tr xt n cc s liu ghi nhn v thng k gp phn khc phc v hon thin h thng.Trang 98V Hng Phong Lun vn tt nghipCHNG 5KT LUN5.1 KT QU T C V NGHAQua qu trnh nghin cu, th nghim, v thc hin ti trong thi gian cho php vi nhng cng c lp trnh h tr, hc vin hon thnh h thng pht hin v nhn dng i tng xe vi cc kt qu c th.5.1.1 Kt qu t c La chn v thc hin thnh cng phng php pht hinv nhn dng xe vi nhiu phng php khc nhau v ang c nghin cu pht trin - vi Visual C++ l ngn ng lp trnh mi, theo xu hng pht trin phn mm trn nn tng .NET Framework phin bn 1.1 v cao hn. Phi hp tng i tt gia ngn ng lp trnh trn Visual C++ .NET ca Th gic my tnh vi l thuyt X l nh s. Tip cn thnh cng cc thut ton X l quang hc trong vic c lng v nh lng cc thng s trc tuyn ca tnh trng giao thng.Trang 99V Hng Phong Lun vn tt nghip L c hi tt m qua hc vin c nhng tm hiu thm v lnh vc x l nh s, th gic my tnh v cch ng dng vo thc t quan st i tng xe trong cnh quang giao thng.5.1.2 ngha M hnh ha c mc c s h thng quan trc trc tuyn h thng giao thng s dng camera v cc cng c lp trnh tin tin km theo. T , ngi thc hin c th d dng tip cn c phng thc qun l v hiu chnh tnh trng giao thng mc hp l, ph hp hn vi ng cnh giao thng trong nc. H thng c th c pht trin thm cp cao hn vi cch b tr lnh code hp l hn nhm tng tc cho h thng, bn cnh cng phi m botincyvchnhxcchohthng, nhmpngcnhucu nghin cu hc thut v p dng n trong thc t. H thng ha phng php pht hin v nhn dng i tng ni chung v i tng xe ni ring s to bc pht trin mi cho phng thc quan trc giaothngtheo hnghin i.C th trin khai iukin giao thng trong nc, t nng cao kh nng iu tit giao thng nh cc nc c trnh cao hn v ang thc hin. 5.2 HNG PHT TRIN C nhng i tng khc nhau trong mt s tnh hung khc nhau m ta c th chn la phng php nhn bit sao cho ph hp gia hai phng php nhn dng da trn hnh dng ca vt th hoc nhn bit theo mu sc. Tuy Trang 100V Hng Phong Lun vn tt nghipnhin, c s kt hp ph hp t hai phng php trn da vo nh thu c t camera s gip h thng ci thin ng k kh nng pht hin ng i tng, t nng cao tin cy cho h thng. Hthngcngcthphttrintheohngnhndngitng(object recognition), ngha l khi nhn dng c hnh dng xe, s tip tc hun luyn trc tuyn tip tc trch xut ra nhng c trng ch c i tng xe mi c (c th da vo bng s xe, vt li lm ring,). T tip tc quan st v nhn dng bm theo i tng xe . Vic nhn dng bm theo xe ny trong mi trng giao thng hn lon s l mt vn th v c nhiu ng dng. H thng cng c th c lp trnh theo hng tch hp trn vi mch s dng ngnnglp trnh h thngnhng, hthngtchhp trnvi mch (SoC - System on Chip), s l mt ng dng mang tnh linh hot hn. Bi v khi h thng khng cn nht thit phi chy trn nn tng my tnh -.NET Frameworks v cc my tnh na. c nh vy, th ti s c tnh ng dng linh hot cao hn vo cc lnh vc thc t cuc sng v cc hot ng m bo an ton giao thng cho c h thng giao thng cng nh tng c th xe ring bit ang tham gia lu thng trn h thng giao thng . Theo nhn nh ca bn thn hc vin, th y l mt lnh vc hay, l th, c nhiu ng dng thc t v bn cnh vn cn nhiu vn cn hon thin thm. V kh nng thc hin c hn v thi gian khng nhiu cho lun vn nn khng trnh khi s st v nhm ln. Xin Qu Thy C v cc anh ch hc vin cng nh cc bn thng cm. Mong rng vi nhng ai ham thch v c hng th vi hng nghin cu ny c th chia s vi hc vin cng nhau tip tc tm hiu, pht trin thm nng cao tnh hu dng thc t cho Trang 101V Hng Phong Lun vn tt nghip ti. cng l mt trong nhng mc tiu ch cht v l li ch ca ngnh hc ny.Li cui cng kt li ni dung quyn lun vn ny, hc vin xin chn thnh cm n n tt c cc thy c, cc anh v cc bn quan tm theo di.Trang 102V Hng Phong Lun vn tt nghipPHN CPH LCTrang 103V Hng Phong Lun vn tt nghipTI LIU THAM KHO V TRCH DN[1]Jaesik Choi. Realtime On-Road Vehicle Detection with Optical Flows and Haar-like feature detector. Computer Science Department s paper report, 2000.[2]Margrit Betke, Esin Haritaoglu.Real Time Multiple Vehicle Detection and Tracking from a moving vehicle. Machine Vision and Applications, Springer, 2000.[3]Vadim Pisarevsky. OpenCV Object Detection Theory and Practice. Intel Corporation, Software and Solutions Group.[4]Rainer Lienhart, Alexander Kuranov, VadimPisarevsky.Empirical Analysis ofDetection Cascades of Boosted Classifiers for Rapid Object Detection. MRL Technical Report, December 2002.[5]Yali Amit. 2D Object Detection and Recognition, Models, Algorithms, and Networks. The MIT Press, 306 pages, 2002.[6]Emanuele Trucco, Alessandro Verri. Introductory for Techniques for 3-D Computer Vision. Prentice Hall, 341 pages, 2002.[7]Florian Adolf. How to build a cascade of boosted classifiers based onHaar-like features. 2003.[8]Intel Corporation. OpenCV with Visual C++.NET 2003. OpenCV userguide.[9]Julien Meynet. Fast Face Detection Using AdaBoost. 95 pages, 16th July 2003.[10]Paul Viola, Michael Jones.RapidObject DetectionusingaBoostedCascadeofSimple Features . 2001[11]Qing Chen. Real-time Vision-based Hand Gesture Recognition UsingHaar-like Features - Technology Conference, IMTC 2007.[12] DavidA. Forsyth&JeanPonce.ComputerVision:AModernApproach. Prentice Hall, 693 pages, 2003.Trang 104V Hng Phong Lun vn tt nghipCC WEBSITE THAM KHO[link 1]Intel OpenCV Grouphttp://www.intel.com/research/mrl/research/opencv/[link 2]SharperCVhttp://www.cs.ru.ac.za/research/groups/SharperCV/bin/SharperCV.msi[link 3]Camera CalibrationIntroduction & Chapter 1: Camera Models and Calibrationhttp://safari.oreilly.com/9780596516130/camera_modelChapter 2: Calibrationhttp://safari.oreilly.com/9780596516130/calibrationChapter 3: Undistortionhttp://safari.oreilly.com/9780596516130/undistortionChapter 4: Putting Calibration All Togetherhttp://safari.oreilly.com/9780596516130/putting_calibration_all_togetherChapter 5: Rodrigues Transformhttp://safari.oreilly.com/9780596516130/rodrigues_transformChapter 6: Exerciseshttp://safari.oreilly.com/9780596516130/exercises-id010Trang 105