You are on page 1of 11
swsi2017 ‘Tai ligu xi nh ~ Contour, moments — Univ Tech hon et thye han Univ.Tech hon ca thurc hanh Tai liéu xt ly Anh — Contour, moments 1. Muc tiéu iiéu V8 thuat todn contour, moment va ting dung trong xtr ly anh sé. 2. Thuat toan contour 2.1. Gidi thiéu Contour 1a thuat toan dugc sir dung trong xtr ly anh nhim tach, trich xuat cdc déi trong, tao diéu kign dé cac xir ly sau duge chinh xéc. Nén threshold or canny edge detection truéc khi str dung thuat toan nay. Hinh 1: Vi du vé thuat ton contour ich trong viée shape analysis and object detection and recognition. 2.2. Mét sd khai niém hitpeunivtechnews.comy2017/04/17ita-eu-xu-y-ant-contour-moments! mt swsi2017 ‘Tai ligu xi nh ~ Contour, moments — Univ Tech hon et thye han Neighbor: 2 pixel dugc goi lA neighbor néu 2 pixel dé chung mét canh. Thanh phan connected: gid sit trong anh binary, cdc pixel thudc 1 déi tuong cé gid tri 1 con cdc pixel thudc nén thi 6 gid trj 0. Lic nay néu gitta 2 pixel bat ki thudc déi tugng, chudi cdc pixel théa man: © Tat cd déu thudc déi tong, titc 1a cdc pixel nay 6 gid tri bing 1. pixel thugc chudi déu phai neighbor véi pixel trudc va ké tigp trong ch thi chudi pixel dé duge goi 18 mét thanh phn connected. 4-connectivity: xem hinh 2, P véi P2 1a m6t 4-connectivity, tuong ty P véi P4, P véi P6 hay P véi P8 déu 1a mét 4-connectivity. 4-connected: mot déi tuong duge goi la 4-connected néu théa man: bat ky 2 pixel lign Ké nhau 4-Connectivity 4-Connected Not 4-Connected S:Connectivity 8-Connected Not &-Connected Hinh 2: Vi du vé 4-connectivity va 8-connectivi S-connectivity: xem hinh 2, P véi bat ki pixel nao xung quanh né déu tao nén mét 8- connectivity. 8-connected: mét déi tugng dugc goi la 8-connected khi théa man: bat ky 2 pixel lign ké nhau thude déi trong 1a mét 8-connectivi 2.3. Contour Tracing Algorithms hitpeunivtechnews.comy2017/04/17ita-eu-xu-y-ant-contour-moments! am swsi2017 ‘Tai ligu xi nh ~ Contour, moments — Univ Tech hon et thye han Cé 4 thuat ton théng dung nhat duge str dung trong contour tracking, gdm: © Square Tracing Algorithm. © Moore - Neighbor Tracing. © Radial Sweep. © Theo Pavlidis’ Algorithm. Trong sé dé, Square Tracing Algorithm va Moore — Neighbor Tracing dé trién khai nén duge sir dung phé bign hon ca, 2.3.1. | Square Tracing algorithm Thudt toan: Duyét tir pixel ngoai cing bén tréi pha duéi, di lén cho t6i khi gp pixel c6 gid tri bang 1 (pixel nay sé dug goi la pixel start) thi bat du di chuyén theo quy tac sau: © Néu gap Pixel cé gid tr) bing 1 thi ré trai © Néu gap Pixel cé gid tri bang 0 thi ré phai. © Di chuyén cho téi khi quay lai pixel start thi dimg lai. Hinh sau mé ta cach hoat déng cita thuat toan; hitpeunivtechnews.comy2017/04/17ita-eu-xu-y-ant-contour-moments! wsre017 ‘Tai igu x nh — Contour, moments — Univ Tech hon thy han Bi B3 B4 Hinh 3: M6 ta qué trinh tim contour cia thugt toan Square Tracing, Didu kign két thc: ‘Thuat toan két thie khi gap mét trong hai diéu kign sau: © Di chuyén vao pixel start Ian thts 2 sau khi di qua n pixel khéc. Néu digu kién nay xay ra, c6 nghia rang thuat toan chay sai, xem vi dy nhu hinh 4. bitps:univtechnes.com/2017104/17ita-leu-xuy-anh-contour-moments! an ai2017 ‘Tai ligu xj rh ~ Contour, moments Univ Tech hone thye han Hinh 4: Vi du trudng hop thuat toan chay sai © Di chuyén vao pixel start Ian thit 2 sau khi di qua n pixel khdc va theo ding huéng di vao pixel start Ian dau tién, diéu kién nay cdn dugc goi 1a Jacob’s stopping criterion. Digu kign nay xy ra nghia 1a thuat toan da chay ding, nhu vi du 6 hinh 5. Vay thuat toan chi chay diing trén déi tuong 4-connected Hinh 5: Vi dy trudng hop thuat toan chay ding 2.3.2. | Moore — Neighbor Tracing Thuit toan: Moore - Neighbor tracking cé chiit khdc biét s6 véi thuat todn Square Tracking, cu thé: khi gap pixel cé gid tri bang 1 dau tién (pixel start) thi ta sé quay lai pixel truéc dé, sau dd di ving qua céc pixel thudc 8-connected theo chiéu kim ding hd cho t6i khi gap pixel khde 06 gid tri bang 1 hitpeunivtechnews.comy2017/04/17ita-eu-xu-y-ant-contour-moments! am wsre017 ‘Tai igu xij ann — Contour, moments — Univ Tech hon thy han BL B2 B3 B4 Hinh 6: M6 td qué trinh tim contour cia thuat todn Moore-Neighbor Tracking Dibu kign két thc: Gidng véi thudt toan Square Tracking. 2.3.3. Radial Sweep ‘Thu8t toan: Ciing giding voi Moore - Neighbor Tracking, sau khi gap pixel cé gid tri bang 1 dau tién (Start pixel), ta sé quay lai pixel trudc dé va di vong theo chiéu kim dng hé cho t6i Khi gp pixel cé gid tri bing 1 tiép theo, lic nay Radial Sweep sé khéng thyc hién nhu Moore-Neighbor Tracking, ma thay vao dé, né tao ra mét doan thang ao ndi pixel hién tai vai pixel cé gid tri bang 1 da di qua gan nht. Va doan thing nay dugc xoay cho téi khi gap mét pixel khdc c6 gid tri bang 1. Xem hinh 7 dé hiéu r hon vé thuat toan. bitps:univtechnes.com/2017104/17ita-leu-xuy-anh-contour-moments! ent wsre017 ‘Tai igu x ann Contour, moments — Univ Tech hon thy han BL B3 Ba Hinh 7: Mé ta qué trinh tim contour cua thuat ton Radial Sweep Diu kign két thie: Gidng véi thudt ton Square Tracking. 2.3.4. Theo Pavlidis’ Algorithm ‘Thuit toan: Tai pixel start, 3 diém P1, P2, P3 dugc dinh nghia nhu hinh 8a. Lic nay viée Ia chon P1, P2, hay P3 lim diém dén tip theo duge xét nhur sau: © Néu Pl cé gid tri bang 1 thi P1 duge chon la dim ké tigp, qua trinh di chuyén duge mé ta nhu hinh 8b. © Néu Pl cé gid tri bing 0, thi P2 diroc xét, néu P2 cé gid tri bing 1 thi P2 dugc chon va qua trinh di chuyén durge mé ta nhu hinh 8c. N@u PI, P2 du cé gia tri bing 0 thi P3 duge xét, néu P3 cé gid tri bing 1 thi P3 duge chon va qua trinh di chuyén dugc mé ta nhur hinh 8d. Néu cé P1, P2 va P3 déu khong théa man thi ta sé quay 90° theo chiéu kim déng ho dé duge 3 vi tri PI, P2 va P3 méi. bitps:univtechnes.com/2017104/17ita-leu-xuy-anh-contour-moments! mm swsi2017 ‘Tai igu xi dh ~ Contour, moments — Univ Tech hon et the han P3 PL PI Pr | B2 c d Hinh 8: M6 ta qua trinh tim contour ciza thuat toan Theo Pavlidis’ Algorithm Didu kién két thac: ‘Thuat toan két thiic khi gp mét trong 2 diéu kién sau: © Di chuyén toi start pixel Tan thi 2. © Khi chuyén hudng 3 fan ma van khéng tim dugc pixel théa man. 3. Thuat toan moment 3.1. Gidi thiéu Moment 1a thuat toan gitip anh gid sw gidng nhau cua 2 déi tuong; sir dung trong céc phép bign déi translate, scaling hay rotate; hay str dung céc khdi hinh hoc dé tai xay dung lai déi tuong. 3.2. Thuat toan hitpeunivtechnews.comy2017/04/17ita-eu-xu-y-ant-contour-moments! am swsi2017 ‘Tai ligu xi nh ~ Contour, moments — Univ Tech hon et thye han Céng thttc xéc dinh moment nhu sau: ay ‘Trong dé: © pq=01, © f(x, y) Ia gid tri tai pixel c6 toa d6 (x, y). Moment dugc phan biét nho vao 2 tham sé p va q, gid tri (p + q) 1a thit ty cla moment dé va dug ky higu 1a mp,q. Cu thé mét sé moment duge dinh nghia nhw sau: © mo, duge goi la zero order moment, moment nay chinh la dign tich cua déi tugng © mo, hay my, dugc goi Ia first order moments, contain information about the center of gravity of the object © m2,9, mp,2 hay my,1 duge goi 12 second order moments. 3.2.1. | Moment Invariants Translate, rotation and scaling (TRS) la nhiing phép bién déi don gian trong khdng gian. TRS thinh thoang dugc goi la bign déi similarity, gdm 4 tham s6 dugc biéu dién bing cng thiic sau: ss (a2) Trong dé: © tla translate vector. © 5 1a positive scaling factor (note that here we consider uniform scaling only, s is the same, both in horizontal and vertical direction). © Ra rotate matrix (cosa -sna’) } (13) =| (sina cosee ) R Voi a a géc quay. Bat bign trong TRS 1a mét yéu cau quan trong trong moi ting dung. Boi vi déi tugng nén duge xc dinh chinh xéc vi tri trong bite anh. Vi vay TRS invariants tro nén quan trong. Translation and scaling invariants cé thé kha trac quan nhung invariants to rotation thi phtic tap hon. Invariants to translation: hitpeunivtechnews.comy2017/04/17ita-eu-xu-y-ant-contour-moments! om swsi2017 ‘Tai ligu xi nh ~ Contour, moments — Univ Tech hon et thye han Jfo-u IS f@.y)dxdy (4) Trong 46: ~ x.=Mmq/ mo. ¥. =I / Maoare the coordinates of the object centroid. Note that it always holds 4 ), and joo = moo. Invariants to uniform scaling: Normalized central geometric moment v,, ee (5) Sau khi scaling b@i factor s, central moments in the new coordinates change as VES (xy aay" (1.6) Moment sit dung trong scaling normalization khéng con duge sit dung trong nhan dang vi gid tri ciia the corresponding normalized moment luén IuGn bang 1(in the above normalization, voo =1). Traditional invariants to rotation: Duoc gidi thigu [an dau vao ném 1962 béi Hu, éng da dinh nghia ra 7 cong thite sau A= Mga = (ma—m,F 44m, » ~3miz ) +(3ms,—s Img +m.) +(M+Mas)- Mimo +m) 3 (m+ J) +(B7ms = (ms, —37 ((ma-+ms (3(m5+mz)¥—(ma +e). an gM (Mo +s Hitty, (Pap + Mz )( Maa + Mes). $ ~ (37a, — Ms (mg + (maa +a 3M es) hitpeunivtechnews.comy2017/04/17ita-eu-xu-y-ant-contour-moments! son swsi2017 ‘Tai ligu xi nh ~ Contour, moments — Univ Tech hon et thye han 3.2.2. Complex moment Céng thite: (8) Trong mién toa dé cuc, cong thitc cé thé viét lai nhu sau: ile pte? *® £( pcosé,psin@) dpa (19) Néu complex moment cia anh géc véi complex moment cia anh rotate duge ky higu Tan lugt 1a CLval (1.10) Published by NgocNT 1 View all posts by NgocNT | 17 Apr 2017 Xirly anh BLOG AT WORDPRESS.COM. uPt hitpeunivtechnews.comy2017/04/17ita-eu-xu-y-ant-contour-moments! wnt

You might also like