数字图像处理第十一章

合集下载
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

© Mingyan Jiang, SDU, Copyright Reserved
7 / 81
11.1.3 Some Basic Utility MFunctions
• Suppose that we want to find the boundary of the object with the longest boundary in image f: >>B=boundaries(f); >>d=cellfun(‘length’, B); >>[max_d, k]=max(d); >>v=B{k(1)};
• The goal of a polygonal approximation is to use the fewest possible to capture the “essence” of the boundary shape. • A particularly attractive approach to polygonal approximation is to find the minimum-perimeter polygon (MPP) of a region or boundary.
Chapter 11
Representation and Description
江铭炎 教授/博导
网址: 信息学院=> 精品课程=> 数字图像处理
© Mingyan Jiang, SDU, Copyright Reserved
1 / 81
preview
• Representing a region involves two basic choices:(1)external characteristics (selected when interest is on shape characteristics ); (2)internal characteristics (selected when interest is on regional properties). • In either case, the features selected as descriptors should be as insensitive as possible to variations in region size, translation, and rotation.
© Mingyan Jiang, SDU, Copyright Reserved 16 / 81
© Mingyan Jiang, SDU, Copyright Reserved
17 / 81
11.2.2 Polygonal Approximations Using Minimum-Perimeter Polygons
© Mingyan Jiang, SDU, Copyright Reserved
2 / 81
11.1 Background
• A region is a connected component, and the boundary (border or contour) of a region is the set of pixels in the region that have one or more neighbors that are not in the region. • We allow pixels to have gray-scale or multispectral values. • Boundary is a connected set of points. If the points form a clockwise or counterclockwise sequence we say to be ordered.
Βιβλιοθήκη Baidu
© Mingyan Jiang, SDU, Copyright Reserved
5 / 81
• function s=image_stats(f) s.dim=size(f); s.AI=mean(f); s.AIrows=mean(f); s.AIcols=mean(f);
s is a structure. AI (a scalar), dim(a 1*2 vector), AIrows(an M*1 vector), Aicols(a 1*N).
© Mingyan Jiang, SDU, Copyright Reserved
13 / 81
• The output c is a structure with the following fields c.fcc=Freeman chain code (1*np) c.diff=First difference of code c.fcc (1*np) c.mm=Integer of minimum magnitude (1*np) c.diffmm=First difference of code c.mm(1*np) c.x0y0=Coordinates where the code starts (1*2)
© Mingyan Jiang, SDU, Copyright Reserved 18 / 81
© Mingyan Jiang, SDU, Copyright Reserved
10 / 81
11.2.1 Chain Codes
• Chain codes are used to represent a boundary by a connected sequence of straight-line segments of specified length and direction. The direction of each segment is coded by using a numbering scheme such as the ones shown in Figs. 11.1(a) and (b).
Notes the use of a dot to separate the structure from its
various fields. The field names arbitrary, but they must begin with a nonnumeric character.
© Mingyan Jiang, SDU, Copyright Reserved
6 / 81
11.1.2 Some Additional MATLAB and IPT Function Used in This Chapter
• • • • • • • • • fB、fI represent binary and intensity images. gB: binary output images . gB=imfill(fB, locations, conn) gB=imfill(fB, conn, ‘holes’) G=imfill(fI, conn, ‘holes’) [r,c]=find(g==2) z=sortrows(S) [z, m, n]=unique(s, ’rows’) Z=circshift(s, [ud lr]) Z=circshift(s, ud)
© Mingyan Jiang, SDU, Copyright Reserved 3 / 81
11.1.1 Cell Arrays and Structures
• Cell Arrays
Cell Arrays provide a way to combine a mixed set of objects under one variable name. A single variable C C={f, b, char_array} Here f , an uint8 image of size 512*512; b, a sequence of 2-D coordinates in the form of rows of a 188*2 array char_array, a cell array containing two character name.
© Mingyan Jiang, SDU, Copyright Reserved
8 / 81
• • • • • • •
b8=boundary2eight(b) b4=boundary2four(b) G=boundary2im(b, M, N, x0, y0) b=cat(1,B{:}) [s, su]=bsubsamp(b,gridsep) Z=connectpoly(s(:,1), s(:, 2)) [x, y]=intline(x1, x2, y1, y2)
© Mingyan Jiang, SDU, Copyright Reserved
14 / 81
Example 11.3 Freeman chain code and some of its variations
• >>h=fspecial(‘average’, 9); >>g=imfilter(f, h, ‘replicate’); • >>g=im2bw(g, 0.5); >>B=boundaries(g); >>d=cellfun(‘length’, B); >>[max_d, k]=max(d); >>b=B{1};
© Mingyan Jiang, SDU, Copyright Reserved
11 / 81
© Mingyan Jiang, SDU, Copyright Reserved
12 / 81
• The chain code of a boundary depends on the starting point. • Function fchcode c=fchcode(b, conn, dir) Computes the Freeman chain code of an np*2 set of ordered boundary points stored in array b.
© Mingyan Jiang, SDU, Copyright Reserved
15 / 81
• >>[M N]=size(g); >>g=bound2im(b, M, N, min(b(:, 1)), min(b(:, 2))); >>[s,su]=bsubsamp(b,50); • >>g2=bound2im(s, M, N, min(s(:, 1)), min(s(:, 2))); • >>cn=connectpoly(s(:, 1), s(:, 2)); >>g2=bound2im(cn, M ,N min(cn(:, 1)), min(cn(:, 2))); >>c=fchcode(su);
© Mingyan Jiang, SDU, Copyright Reserved
9 / 81
11.2 Representation
• Standard practice is to use schemes that compact the data into representations that are considerably more useful in the computation of descriptors.
© Mingyan Jiang, SDU, Copyright Reserved
4 / 81
Structures
• Structures are similar to cell arrays in the sense that they allow grouping of a collection of dissimilar data into a single variable. However cells are addressed by numbers, the elements of structures are addressed by names called fields.
相关文档
最新文档