1 / 9

Image Representation

Image Representation. Comp344 Tutorial Kai Zhang. Boundary representation. Chain codes Fourier Descriptor. Chain code. Represent a boundary by a connected sequence of straight-line segments of specified length and direction Freeman chain codes

billf
Télécharger la présentation

Image Representation

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Image Representation Comp344 Tutorial Kai Zhang

  2. Boundary representation • Chain codes • Fourier Descriptor

  3. Chain code • Represent a boundary by a connected sequence of straight-line segments of specified length and direction • Freeman chain codes • numbering schemes for directions are 4-neighbor or 8-neighbor connection

  4. Illustration

  5. codes • a = double(imread('deer.bmp')); • [m,n] = size(a); • b = boundaries(a); • b = b{1}; • bim = bound2im(b,m,n); • figure,imshow(bim); • [s, su] = bsubsamp(b,4); • g2 = bound2im(s); • figure,imshow(g2); • cn = connectpoly(s(:,1),s(:,2)); • g2 = bound2im(cn); • figure,imshow(g2);

  6. functions • B = boundaries(f,conn,dir): traces exterior boundaries in the binary image f. conn and dir is for connectivity (4/8) and direction(clock/counterclock wise). B contains the coordinates of the boundary points found. • In case there are multiple closed boundaries, B is a cell each element of which contains the p-by-2 coordinate matrix. • Example • B = boundaries(f); • d = cellfun('length',B); • [max_d, idx] = max(d); • V = B{idx(1)}; • plot(V(:,2),-V(:,1),'b.');

  7. Fourier Descriptor • Given a set of 2-d coordinates (xk,yk)’s on a boundary • Staring from arbitrary point, traverse the boundary, and obtain a sequence (x1,y1), (x2,y2),…. • Deem this a s a sequence of complex numbers, S • Compute DFT of F = DFT(S) • Cut off frequency components in F with small magnitude • Perform inverse transform IDFT(F) to recover the original boundary

  8. Example

  9. Codes • a = double(imread('deer.bmp')); • [m,n] = size(a); • b = boundaries(a); %detect boundary • b = b{1}; %suppose there is only one boundary • bim = bound2im(b);% turn boundary into image • figure,imshow(bim); • z = frdescp(b); • z1 = ifrdescp(z,20); • bim = bound2im(z1,m,n); • figure,imshow(bim);

More Related