1 / 13

A MATLAB Tour of Binary Image Analysis

A MATLAB Tour of Binary Image Analysis. Image Topology: Connectivity. a and b are connected if there exists a path from a to b. How do we define the path for discrete images?. 4-neighbors. 8-neighbors. Depending on the selection of 4-neighbors or 8-neighbors,

yitro
Download Presentation

A MATLAB Tour of Binary Image Analysis

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. A MATLAB Tour of Binary Image Analysis EE465: Introduction to Digital Image Processing

  2. Image Topology: Connectivity a and b are connected if there exists a path from a to b How do we define the path for discrete images? 4-neighbors 8-neighbors Depending on the selection of 4-neighbors or 8-neighbors, we might have different connectivity result EE465: Introduction to Digital Image Processing

  3. Example q q p p p ~ q no matter 4-neighbors or 8-neighbors p ~ q only when 8-neighbors is considered EE465: Introduction to Digital Image Processing

  4. Component Labeling original binary image If 8-neighbors, two connected components If 4-neighbors, three connected components EE465: Introduction to Digital Image Processing

  5. MATLAB Function BWLABEL • >help bwlabel • BWLABEL Label connected components in binary image. • L = BWLABEL(BW,N) returns a matrix L, of the same size as BW, containing • labels for the connected components in BW. N can have a value of either • 4 or 8, where 4 specifies 4-connected objects and 8 specifies • 8-connected objects; if the argument is omitted, it defaults to 8. • The elements of L are integer values greater than or equal to 0. The • pixels labeled 0 are the background. The pixels labeled 1 make up one • object, the pixels labeled 2 make up a second object, and so on. • [L,NUM] = BWLABEL(BW,N) returns in NUM the number of connected objects found in BW. • See also bwareaopen, bweuler, bwlabeln, bwselect, label2rgb. EE465: Introduction to Digital Image Processing

  6. Checkboard Image 4-neighbors Imshow(label2rgb(bwlabel(x,4))) x 8-neighbors Imshow(label2rgb(bwlabel(x,8))) EE465: Introduction to Digital Image Processing

  7. Euler Number EN=-1 EN=0 EN=-3 Euler Number EN=number of connected components – number of holes EE465: Introduction to Digital Image Processing

  8. Chain Codes 4-directional chain code: 0033333323221211101101 8-directional chain code: 076666553321212 EE465: Introduction to Digital Image Processing

  9. MATLAB Implementation EE465: Introduction to Digital Image Processing

  10. Normalization Strategy 33001122 33001122 30011223 00112233 01122330 11223300 12233001 22330011 23300112 00112233 01122330 11223300 12233001 22330011 23300112 33001122 30011223 First row gives the normalized chain code Sort rows 00112233 MATLAB function: sortrows EE465: Introduction to Digital Image Processing

  11. Shape Numbers= Normalized Differential Chain Codes 33010122 33001212 Differential code: dk=ck-ck-1 (mod 4) differentiate differentiate 10113110 10101131 normalize normalize 01011311 01011311 MATLAB function: mod EE465: Introduction to Digital Image Processing

  12. Skeleton Finding via Distance Transform x bwdist(~x,’cityblock’); bwdist(x,’cityblock’); EE465: Introduction to Digital Image Processing

  13. MATLAB Implementation function sk=skeleton_finding(x) % calculate distance transform dt=bwdist(~x,'cityblock'); % find the local maximum n=[0 1;-1 0;0 -1;1 0]; sk=dt>0; for i=1:4 sk=sk&(dt>=circshift(dt,n(i,:))); end EE465: Introduction to Digital Image Processing

More Related