# Patent

## Title
Method and system for detecting polygon boundaries of structures in images as particle tracks through fields of corners and pixel gradients

## Abstract

A stochastic method and system for detecting polygon structures in images, by detecting a set of best matching corners of predetermined acuteness α of a polygon model from a set of similarity scores based on GDM features of corners, and tracking polygon boundaries as particle tracks using a sequential Monte Carlo approach. The tracking involves initializing polygon boundary tracking by selecting pairs of corners from the set of best matching corners to define a first side of a corresponding polygon boundary; tracking all intermediate sides of the polygon boundaries using a particle filter, and terminating polygon boundary tracking by determining the last side of the tracked polygon boundaries to close the polygon boundaries. The particle tracks are then blended to determine polygon matches, which may be made available, such as to a user, for ranking and inspection.

## Background
II. CLAIM OF PRIORITY IN PROVISIONAL APPLICATION
This application claims priority in provisional application filed on Nov. 20, 2007, entitled “Polygon Boundaries as Particle Tracks through Fields of Corners and Pixel Gradients” Ser. No. 60/989,319, by David W. Paglieroni et al, and incorporated by reference herein.


I. FEDERALLY SPONSORED RESEARCH OR DEVELOPMENT
The United States Government has rights in this invention pursuant to Contract No. DE-AC52-07NA27344 between the United States Department of Energy and Lawrence Livermore National Security, LLC for the operation of Lawrence Livermore National Laboratory.


III. FIELD OF THE INVENTION
The present invention relates to image processing methods, and more particularly to a method and system for detecting polygon structures of fixed shape and variable size in images by using particle filters and a Sequential Monte Carlo (SMC) sampling approach to stochastically track the boundaries of the polygon structures as particle tracks through fields of pixel gradients and corners detected in the images.
IV. BACKGROUND OF THE INVENTION
Many man-made objects and structures of interest in aerial/overhead images, such as for example roofs of buildings and vehicles, can be modeled with polygons. The ability to quickly and effectively match models for broad classes of polygons to such images is of great importance in semi-automatic content-based image search/database retrieval, image analysis, and image understanding applications that are throughput-intensive.
Template matching methods are sometimes used to match specific polygons. However, these methods typically cannot efficiently accommodate variations in polygon size. Polygons are thus more traditionally detected by extracting primitive features such as edges, lines or corners, and assembling collections of these features into polygons. Various methods of this type are known to handle variations in polygon size and even variations in relative side lengths, such as described, for example in “Localizing Overlapping Parts by Searching the Interpretation Tree,” by W. Grimson and T. Lozano-Perez (IEEE Trans. Pattern Anal. Mach. Intell., vol. 9, no. 4, July 1987, pp. 469-482) and “Building Detection and Description from a Single Intensity Image,” by C. Lin and R. Nevatia (Comput. Vis. Image Understanding, 72, 2, Nov. 1998, pp. 101-121.) However, such methods often miss polygons altogether even when only a few features are missing from the image. Even when partial matches to polygons can be found, they tend to be ranked much lower than complete matches of lesser quality.
What is needed therefore, is a robust method of detecting polygons in overhead imagery that is based on the modeling of polygons in a manner that accommodates whole classes of polygons (e.g. all L-shaped polygons at any position, orientation, and size, even if corner detection fails to detect or accurately localize all the required polygon corners.
V. SUMMARY OF THE INVENTION
One aspect of the present invention includes a method in a computer system for detecting polygon boundaries of structures in an image, comprising: receiving an image; detecting in said image a set of polygon corners each substantially matching one of n corner models of an n-sided polygon model based on directions of gradients in pixel gray-values of said image; initializing tracking of polygon boundaries by selecting pairs of corners from the set of detected polygon corners which match the first 0th and last (n−1)th corners models of the u-sided polygon model, wherein each selected pair defines a first 0th side of a corresponding one of the polygon boundaries; using a particle filter performing Sequential Monte Carlo sampling to track intermediate sides of the polygon boundaries after the first 0th side up to and including a penultimate (n−2)th side, wherein the particles used in the particle filter characterize the states of the polygon boundary sides, and observations used in the particle filter characterize the match similarity between the set of detected polygon corners at locations and orientations predicted by the polygon model; terminating tracking of the polygon boundaries by determining the last (n−1)th sides thereof based on specified states of the sides of the polygon boundaries for the previous n−1 sides; and blending multiple particle tracks for the same polygon into a single boundary based on importance weights that reflect particle fitness, to produce an array of polygon matches detected in said image.
Another aspect of the present invention includes a method in a computer system for detecting polygon boundaries of structures in an image, comprising: computing a set of similarity values characterizing the degree of matching between an estimated gradient direction of each of M corner orientations of each pixel to a gradient direction model of a corner of predetermined acuteness α of a polygon model; determining a set of best matching corners from the set of similarity values by finding unambiguous local maxima of predetermined sufficient magnitude in the set of similarity values; initializing tracking of polygon boundaries by selecting pairs of corners from the set of detected polygon corners which match the first 0th and last (n−1)th corners models of the n-sided polygon model, wherein each selected pair defines a first 0th side of a corresponding one of the polygon boundaries; tracking intermediate sides of the polygon boundaries using a particle filter performing SMC sampling, including a penultimate (n−2)th side; terminating polygon boundary tracking by determining the last (n−1)th side of the tracked polygon boundaries based on boundary values up to the (n−1)th side, to close the polygon boundaries; and blending the polygon boundary tracks to produce polygon match data identifying polygon structures in the image.
And another aspect of the present invention includes a computer system for detecting polygon boundaries of structures in an image, comprising: input means for receiving the image; a first data processing module for detecting in said image a set of polygon corners each substantially matching one of n corner models of an n-sided polygon model based on directions of gradients in pixel gray-values of said image; a second data processing module initializing tracking of polygon boundaries by selecting pairs of corners from the set of detected polygon corners which match the first 0th and last (n−1)th corners models of the n-sided polygon model, wherein each selected pair defines a first 0th side of a corresponding one of the polygon boundaries; a third particle filtering module for performing Sequential Monte Carlo sampling to track intermediate sides of the polygon boundaries after the first 0th side up to and including a penultimate (n−2)th side, wherein the particles used in the particle filter characterize the states of the polygon boundary sides, and observations used in the particle filter characterize the match similarity between the set of detected polygon corners at locations and orientations predicted by the polygon model; a fourth data processing module for terminating tracking of the polygon boundaries by determining the last (n−1)th sides thereof based on specified states of the sides of the polygon boundaries for the previous n−1 sides; and a fifth data processing module for blending multiple particle tracks for the same polygon into a single boundary based on importance weights that reflect particle fitness, to produce an array of detected polygon matches; output means for making the array of detected polygon matches available for use.



VI.
BRIEF DESCRIPTION OF THE DRAWINGS
The accompanying drawings, which are incorporated into and form a part of the disclosure, are as follows:
FIG. 1 is a graph illustrating a model of a corner used in the present invention.
FIG. 2 is a schematic view of a convex corner of a polygon, illustrating counter-clockwise polygon boundary traversal, as well as the geometry for computing the pointing direction φk of side k from corner acuteness αk and corner orientation θk.
FIG. 3 is a schematic view of a concave corner of a polygon, illustrating counter-clockwise polygon boundary traversal, as well as the geometry for computing the pointing direction φk of side k from corner acuteness αk and corner orientation θk.
FIG. 4 is an example overhead image of an urban area, and an example GDM surface for a block within the example overhead image with respect to a corner model for which [α, L, T]=[π/2, 6, 1], and showing unambiguous local maxima (right angle corner detections).
FIG. 5 is a graphical illustration of proposed state transition densities from which to draw samples of φk.
FIG. 6 is a graphical illustration of proposed state transition densities from which to draw samples of Lk.
FIG. 7 is a graphical illustration of proposed measurement density for the observation (measurement) zk.
FIG. 8 is a schematic view illustrating five sequential Monte Carlo (SMC) boundary tracks (shown as dashed arrows), and one blended track (shown as solid lines) for a four-sided polygon, with each dashed arrow representing one particle.
FIG. 9 is a schematic view of a discrete 3D particle tracking space for polygon boundaries, comprising pre-computed similarity values (degree of matching to a corner model) for each position (pixel column, pixel row) and corner orientation (θ).
FIG. 10 is an overview flowchart of the particle-based polygon detection method and system of the present invention.
FIG. 11 is an example overhead image of an urban area, showing matching results for polygons with constrained side lengths for I-shaped building roofs, indicated as broken lines.
FIG. 12 is an example overhead image of an urban area, showing matching results for polygons with constrained side lengths for rectangular building roofs, indicated as broken lines.



VII. DETAILED DESCRIPTION
1. Introduction
The present invention is a stochastic sampling approach using particle filters to detect polygons of fixed shape and variable size in images, especially polygon-shaped man-made structures, objects, landmarks, etc. in overhead imagery, such as for example the roofs of buildings and vehicles. In particular, a sequential Monte Carlo (SMC)) sampling approach is used to track polygon boundaries through 3D arrays of corner model similarity values/scores (and preferably 2D arrays of thresholded corner best matches derived from the 3D arrays) which are pre-computed across all possible corner/vertex locations and orientations in the image. For each polygon match, the method of the present invention combines many attempts based on SMC sampling to track a single polygon boundary, and is not based on single attempts to match polygon models to images as in other methods. This is illustrated in FIG. 8, showing five SMC boundary tracks (shown as dashed arrows), and one blended track (shown as solid lines) produced by the present invention for a four-sided polygon, with each dashed arrow representing one particle. It is notable that the SMC sampling relies on the corner similarity scores, but not the detected corners themselves. As such, this approach can detect polygons even if the corner detector failed to detect or accurately localize all the required corners (a realistic concern for most imaging applications). Undetected corners and sides are handled by adjusting the importance of missing corners relative to missing sides. It is also notable that the present invention relies on a polygon model that describes a polygon as a sequence of corners and sides. This allows polygons to be matched despite changes in position, orientation, and scale; polygons of fixed shape and size or polygons of fixed shape and variable size may be matched. In this manner, the method of the present invention is robust to real-world imaging conditions, especially for overhead images.
The method and system of the present invention may be generally characterized as having three categories of processing: (1) corner detection, (2) tracking polygon boundaries as particle tracks using a particle filter, and (3) polygon matching via blending of particle tracks. The corner detection category in particular may be decomposed into a corner model matching step which produces the 3D array of similarity scores, and a step for detecting best corner matches which produces a 2D array of best corner matches by thresholding the similarity values produced in the corner model matching step. In the corner model matching step, the selected gradient direction model of a corner is first matched against estimated pixel gray values for the various pixel positions and corner orientations of the image, to directly localize the corners in the image, and not by detecting line segments in the image followed by computing the intersections of these line segments. This produces the pre-computed similarity values/scores for all possible locations and corner orientations in the image, and shown as a 3D particle tracking space in FIG. 11.
And the tracking polygon boundaries category may be decomposed into the steps of initialization of polygon tracks, tracking boundaries, and terminating the particle tracks. Generally, particle tracks are generated through the fields of corners and pixel gradients (i.e. the array of similarity values) as attempts to match polygon boundaries. There is one state vector and one set of measurement (observation) features associated with each particle. The state vector captures geometric information about a single corner and side, and its value is influenced by the polygon model (a sequence of [corner acuteness, side length] parameter pairs). The measurement (observation) features capture photometric information about a single corner and side derived from pixel gray values in the image. The measurements have corner and edge similarity components based on gradient direction matches to the image. By adjusting weights on these components, boundary tracks may be ranked based more on evidence of polygon corners or more on evidence of polygon edges in the image.
FIG. 10 shows an example embodiment of the present invention incorporating the above steps. Upon first receiving an image and selecting an n-sided polygon model, the method steps generally include: corner model matching 100, detecting best corner matches 101, initializing polygon boundary tracks 102 (from pairs of detected best corner matches consistent with the some side in the polygon model), tracking boundaries 103 (n−2 iterations), terminating tracks 104, and blending the particle tracks 105 which produces polygon matches in the image, as previously described with respect to FIG. 8. An optional last step 106 is also shown which ranks polygon matches to produce a ranked set of polygon matches, which may be used for inspection and evaluation of the polygons.
It is appreciated, that while the polygon boundary detection method of the present invention is particularly well suited for overhead imagery applications, it may alternatively be applied in various application domains requiring polygon detection in general, such as for example circuit board inspection applications. However, the primary utility and purpose of detecting polygon structures in images as provided by the present invention may be particularly understood and appreciated as applied to such overhead imagery applications as cueing, site modeling, and classification of land development, to name a few. In the case of cueing, human attention may be focused on precise locations of certain types of buildings which are detected within overhead images of massively broad areas. In site modeling applications, site models may be generated in a semi-automatic manner from overhead images containing man-made structures. And in land development classification applications, land regions may be classified within massively broad areas based on population densities for various types of man-made structures detected in overhead images.
Furthermore, it is appreciated that the polygon matching methodology of the present invention may be implemented in a useful manner on a computer system as hardware, firmware, or software as known in the art. In such a system, overhead images are provided as data input to the method by conventional means known in the art, with detection output of the detected polygon boundaries made available for use, such as for example graphically displayed on a monitor, stored in a database for later retrieval, or otherwise made available for observation and/or use by a user.
In the following discussion, Section 2 describes the models of corners and polygons used in the present invention. Section 3 describes the gradient direction matching (GDM)-based steps employed in detecting the best polygon corner matches used in the method of the present invention. Sections 4 and 5 describe the state variables and the measurement variables, respectively, used for the polygon boundary track particles used in the boundary tracking steps. Section 6 describes the particle-based boundary tracking steps for polygons with constrained Side Lengths. And Section 7 is an appendix with example algorithms used for implementing the process steps of the present invention. The method and system of the present invention is described for polygons with constrained side lengths so as to accommodate variations in polygon position, orientation, and possibly size.
2. Models of Corners and Polygons
2.1 Polygon Model
The present invention models polygons in the image plane as sequences of corners and side lengths, with the ordering of the corners and sides chosen to follow either a clockwise or counterclockwise traversal convention along the polygon boundary. In particular, let  be a polygon with n sides (and thus n corners):

={[αk*, lk*] k=0 . . . n−1}  (2.1)

αk*ε[0,2π) is the acuteness of corner k. α<π for convex corners and α>π for concave corners (α≠π). In practice, αε(εα, π−εα)∪(π+εα, 2π−εα) for some 0<εα≦π/4. And lk*≧0 is the length parameter for side k. Side k emanates from corner (k−1) mod n and terminates on corner k. Various types of polygon models characterized by equation (2.1) may be employed in the present invention, e.g. squares, rectangles, triangles, etc. According to the chosen polygon model For each type of

Polygon models of form specified in equation (2.1) are invariant to shape position and orientation. The degree of invariance beyond position and orientation is regulated by the sequence of length parameters lk* as follows:

    
    
        1. translation-rotation invariance (absolute side length constraints)
        
            If lk*>0 for k=0 . . . n−1, then the length of side k is Lk*=lk* for k=0 . . . n−1. In this case, the exact dimensions of all sides are specified, so polygon shape and size are fixed.
        
        
        2. scale-translation-rotation invariance (relative side length constraints)
        
            Let L0 be the length of side 0 for some match to . For that match, if lk*=0 only for k=0, then the length of side k is =lk*/L0 for k=1 . . . n−1. In this case, the relative dimensions of all sides are specified, so polygon shape is fixed but size can vary.

2.2 Geometric Model for Polygon Corners

        
        
    
    


FIG. 1 shows a geometric model of a polygon corner k having several attributes: (1) vertex at column and row pixel location [ck, rk] (shown as [0,0]), (2) corner acuteness αkε(0,2π)≠π (shown as α=90°), (3) corner orientation θkε(0,2π) defined such that the corner bisector points into the interior of the polygon (shown as θ=−30°), (4) corner leg length Lk>0 (shown as L=8), and (5) corner leg thickness Tk>0. The corner k and its vertex having pixel coordinates are used interchangeably herein. And FIGS. 2 and 3 illustrate the corner model as a convex corner and a concave corner, respectively, as indicated by the location of the “polygon interior” label. In either case, the angle φkε(0,2π) is defined as the pointing direction for side k (which terminates at vertex k at pixel location [ck, rk]) can be expressed in terms of θk and αk as:

φk=(θk−αk/2+π) mod 2π  (2.2)

or

θk=(φk+αk/2−π) mod 2π  (2.3)

2.3 Gradient Direction Model for Polygon Corners

Furthermore, and building upon the geometric model for polygon corners, a gradient direction model for a corner k is described here for use in computing the gradient direction matching (GDM) feature for corners (i.e. corner similarity values) in section 3. The gradient direction model for corners is defined by the set  of pixels on the corner legs (the shaded pixels in FIG. 1), a gradient direction β(c,r), and a weight w(c,r) ∀ [c,r]ε. (The gradient direction model for the side of a polygon is similar, except one leg is missing. This is discussed in section 5.2) For the gradient direction model for corners, let us assume for convenience that [c,r]=[0,0] for the vertex. β(c,r)ε[−π,π) is the direction of the normal to the leg or side that contains pixel [c,r]. All pixels [c,r] on the same leg or polygon side have the same β(c,r) value. For corner models, we exclude the vertex from  (its β value is ambiguous because it lies on both legs). For each (c,r)ε, the weights of the model pixels decrease linearly from 1 to 0 as the distance to the ideal leg or line segment  that contains them increases from 0 to T, and they remain at 0 beyond T:

w(c,r)=max[0, 1−d([c,r], )/T]ε[0,1]  (3.2)

Also, the weights are normalized so that they sum to one:





  
    
      
        
          w
          ⁡
          
            (
            
              c
              ,
              r
            
            )
          
        
        ←
        
          
            w
            ⁡
            
              (
              
                c
                ,
                r
              
              )
            
          
          /
          
            
              ∑
              
                
                  (
                  
                    
                      c
                      ′
                    
                    ,
                    
                      r
                      ′
                    
                  
                  )
                
                ∈
                P
              
            
            ⁢
            
              w
              ⁡
              
                (
                
                  
                    c
                    ′
                  
                  ,
                  
                    r
                    ′
                  
                
                )
              
            
          
        
      
    
    
      
        (
        3.3
        )
      
    
  




3. Polygon Corner Detection Based on Similarity Scores/Values of Gradient Direction Model of a Corner to Estimated Pixel Gradient Directions of the Image

A feature based on pixel gradient directions θ(c,r) that is sensitive to corners of prescribed acuteness α is called a gradient direction matching (GDAM) feature for corners, which is an observation or measurement made directly from pixel gray values. The GDM feature for corners represents the degree of match or similarity between gradient directions θ(c,r) estimated from pixel gray values (Section 3.1) and the gradient direction model of a corner (acuteness α, orientation θ) at pixel [column, row] location [c,r] (Section 2.3). The gradient direction model for a polygon corner described in section 2.3 is applied against an image (which may be, for example, received in real-time or made available from data storage) to detect the best matching corners of polygon structure in the image. In particular, the corner detection is based on computing similarity values (degree of matching) of the gradient direction model of a corner to estimated pixel gradient direction of the image.
Use of gradient directions is motivated by the desire to develop a corner detector that is robust to variations in image acquisition conditions, imaging sensor, and scene content. For example, it has been demonstrated that pixel gradient directions are more robust than features based on edges or pixel contrast for matching 3D edge models of objects to overhead images. As suggested in the publication, “Signal-to-Noise Behavior for Matches to Gradient Direction Models of Corners in Images,” by D. Paglieroni and S. Manay, SPIE Defense & Security Symposium, 9-13 Apr. 2007”, incorporated by reference herein, the same is likely to be true for corner detection.
As discussed previously, 0<α<π for convex corners, and π<α<2π for concave corners. Since corner detectors cannot in general distinguish convexity from concavity, the corner models matched to arrays of pixel gradient directions can be restricted to acuteness values α between 0 and π. Corner concavities and convexities are determined not when corners are detected, but rather as polygon boundaries are being tracked.
3.1 Pixel Gradient Estimation
Let u(c,r) be the gray value in an image u for the pixel at column and row [c,r]. The direction of gradients {dot over (u)}(c,r) in pixel value can be estimated as a weighted sum of direction vectors from the center of pixel [c,r] to the centers of neighbor pixels [c′,r′]. Weights on these direction vectors are based on differences in pixel values and distances between [c,r] and [c′,r′]:




  
    
      
        
          
            u
            .
          
          ⁡
          
            (
            
              c
              ,
              r
            
            )
          
        
        ⁢
        
          =
          Δ
        
        ⁢
        
          
            
              A
              ⁡
              
                (
                
                  c
                  ,
                  r
                
                )
              
            
            ⁢
            
              e
              
                j
                ⁢
                
                  
                
                ⁢
                
                  θ
                  ⁡
                  
                    (
                    
                      c
                      ,
                      r
                    
                    )
                  
                
              
            
          
          ≈
          
            
              ∑
              
                
                  (
                  
                    
                      c
                      ′
                    
                    ,
                    
                      r
                      ′
                    
                  
                  )
                
                ∈
                
                  R
                  ⁡
                  
                    (
                    
                      c
                      ,
                      
                        r
                        /
                        ρ
                      
                    
                    )
                  
                
              
            
            ⁢
            
              
                [
                
                  
                    u
                    ⁡
                    
                      (
                      
                        
                          c
                          ′
                        
                        ,
                        
                          r
                          ′
                        
                      
                      )
                    
                  
                  -
                  
                    u
                    ⁡
                    
                      (
                      
                        c
                        ,
                        r
                      
                      )
                    
                  
                
                ]
              
              ·
              
                
                  
                    (
                    
                      
                        c
                        ′
                      
                      -
                      c
                    
                    )
                  
                  +
                  
                    j
                    ⁡
                    
                      (
                      
                        
                          r
                          ′
                        
                        -
                        r
                      
                      )
                    
                  
                
                
                  
                    [
                    
                      
                        
                          (
                          
                            
                              c
                              ′
                            
                            -
                            c
                          
                          )
                        
                        2
                      
                      +
                      
                        
                          (
                          
                            
                              r
                              ′
                            
                            -
                            r
                          
                          )
                        
                        2
                      
                    
                    ]
                  
                  
                    k
                    /
                    2
                  
                
              
            
          
        
      
    
    
      
        (
        3.1
        )
      
    
  




In equation (3.1), A(c,r) represents gradient magnitude, and θ(c,r) represents gradient direction. The gradient estimates are based on pixels that lie in a region R(c,r|ρ) of radius ρ centered on [c,r]. The power k≧0 on Euclidean distance d from [c′,r′] to [c,r] regulates how the weight assigned to a neighbor [c′,r′] varies with d. For a fixed value of d>1, the reduction in weight becomes more drastic as k increases. Typical values of ρ and k are (ρ, k)=(1,0) for Prewitt estimates and (ρ, k)=(1,2) for Sobel estimates of gradient direction.

3.2 Gradient Direction Matching (GDM) Feature for Corners of Polygons: Creation of the 3D Particle Tracking Space for Polygon Boundaries

Let (θ,α) be the set of pixels on the legs of a corner of acuteness α at orientation θ (excluding the vertex). The GDM feature for polygon corner k is




  
    
      
        
          
            s
            C
          
          ⁡
          
            (
            
              
                c
                k
              
              ,
              
                r
                k
              
              ,
              
                
                  θ
                  k
                
                |
                
                  α
                  k
                
              
            
            )
          
        
        =
        
          
            ∑
            
              
                (
                
                  c
                  ,
                  r
                
                )
              
              ∈
              
                e
                ⁡
                
                  (
                  
                    
                      θ
                      k
                    
                    ,
                    
                      α
                      k
                    
                  
                  )
                
              
            
          
          ⁢
          
            
              a
              ⁡
              
                (
                
                  
                    c
                    +
                    
                      c
                      k
                    
                  
                  ,
                  
                    r
                    +
                    
                      r
                      k
                    
                  
                
                )
              
            
            ·
            
              w
              ⁡
              
                (
                
                  c
                  ,
                  r
                
                )
              
            
            ·
            
              
                cos
                2
              
              ⁡
              
                [
                
                  
                    θ
                    ⁡
                    
                      (
                      
                        
                          c
                          +
                          
                            c
                            k
                          
                        
                        ,
                        
                          r
                          +
                          
                            r
                            k
                          
                        
                      
                      )
                    
                  
                  -
                  
                    β
                    ⁡
                    
                      (
                      
                        c
                        ,
                        r
                      
                      )
                    
                  
                
                ]
              
            
          
        
      
    
    
      
        (
        3.4
        )
      
    
  




where





  
    
      
        
          a
          ⁡
          
            (
            
              c
              ,
              r
            
            )
          
        
        =
        
          {
          
            
              
                1
              
              
                
                  
                    A
                    ⁡
                    
                      (
                      
                        c
                        ,
                        r
                      
                      )
                    
                  
                  ≥
                  
                    A
                    contrast
                  
                
              
            
            
              
                0
              
              
                
                  otherwise
                  ⁢
                  
                    
                  
                
              
            
          
        
      
    
    
      
        (
        3.5
        )
      
    
  




is used to mask out gradient direction estimates for low-contrast pixels, which tend to be noisy (say Acontrast≈12). Equation 3.4 is the similarity value, score, or measurement of the particular position and corner orientation to the gradient direction model for the corner. In this manner, corner similarity values are computed for all positions in the image and associated corner orientations. As illustrated in FIG. 9, the values sC(c, r, θ|α) (which are indexed by column, row, and orientation) comprise a discretized 3D data space, which is used as a particle tracking space. For each distinct value of corner acuteness α represented in polygon model , the GDM algorithm generates one corner similarity field {sC(c, r, θ|α)} from gradient image {dot over (u)}(c,r) for each of M corner orientations θk, k=0 . . . M−1. When fully correlated, the model and pixel gradient directions are the same or opposite everywhere, and sC(c, r, θ|α)=1. When fully anti-correlated, the model and pixel gradient directions are orthogonal everywhere, and sC(c, r, θ|α)=0. When a structured model is matched to an unstructured (random) gradient direction field, one can expect sC(c, r, θ|α)≈0.5. Corner matching efficiency improves significantly when gradient direction models of corners are rasterized and sC(c, r, θ|α) is computed in the Fourier domain using the FFT.

3.3 Detection of Best Matching Corners from the Corner Similarity Measurements

For a corner model with legs of length L pixels, it has been demonstrated empirically that it is sufficient to choose M close to πL (half the circumference of a circle with a radius of L pixels). By choosing the number of model orientations to be the multiple of 8 closest to πL, i.e.,




  
    
      
        M
        =
        
          8
          ·
          
            int
            ⁡
            
              [
              
                
                  
                    π
                    ⁢
                    
                      
                    
                    ⁢
                    L
                  
                  8
                
                +
                0.5
              
              ]
            
          
        
      
    
    
      
        (
        3.6
        )
      
    
  




the number of corner models whose legs occur at orientations of kπ/4, k=0 . . . 7 is maximized (these are the legs that map most cleanly to the pixel grid). Note that because our detector is not invariant to corner orientation, the number of corner model orientations to match, and thus the computational complexity of corner detection, increase linearly with leg length. Also, since the detector is not invariant to corner acuteness, multiple models are needed for multiple corner acutenesses, although in practice, each model can be used for a range of acutenesses. The orientations of the corner models are





  
    
      
        
          
            θ
            k
          
          =
          
            
              
                2
                ⁢
                π
                ⁢
                
                  
                
                ⁢
                k
              
              M
            
            +
            
              α
              2
            
          
        
        ,
        
          k
          =
          
            
              0
              ⁢
              
                
              
              ⁢
              ...
              ⁢
              
                
              
              ⁢
              M
            
            -
            1
          
        
      
    
    
      
        (
        3.7
        )
      
    
  




For a specific corner acuteness αε[0,π), the corner similarity





  
    
      
        
          
            s
            C
            *
          
          ⁡
          
            (
            
              c
              ,
              
                r
                |
                α
              
            
            )
          
        
        ⁢
        
          =
          Δ
        
        ⁢
        
          
            max
            θ
          
          ⁢
          
            
              s
              C
            
            ⁡
            
              (
              
                c
                ,
                r
                ,
                
                  θ
                  |
                  α
                
              
              )
            
          
        
      
    
    
      
        (
        3.8
        )
      
    
  




corresponding to the best match over all corner orientations can be computed on a per-pixel basis. It is notable that this step transforms the 3D space of FIG. 9 into a 2D array {sC*(c, r|α)}.

Best matching corners {[ck, rk, θk, α]} of acuteness α are detected by finding unambiguous local maxima of sufficient magnitude in the 2D array {sC*(c, r|α)} of optimal GDM feature values. The detection rule for corners requires the model match to exceed some critical value scrit>0.5 and to be an unambiguous local maximum within a neighborhood of radius Δ (the disambiguation distance):




  
    
      
        
          
            
              s
              C
              *
            
            ⁡
            
              (
              
                c
                ,
                
                  r
                  |
                  α
                
              
              )
            
          
          ≥
          
            
              s
              crit
            
            ⁢
            
              
            
            ⁢
            and
            ⁢
            
              
            
            ⁢
            
              
                s
                C
                *
              
              ⁡
              
                (
                
                  c
                  ,
                  
                    r
                    |
                    α
                  
                
                )
              
            
          
        
        =
        
          
            max
            
              
                (
                
                  
                    c
                    ′
                  
                  ,
                  
                    r
                    ′
                  
                
                )
              
              ∈
              
                R
                ⁡
                
                  (
                  
                    c
                    ,
                    
                      r
                      |
                      Δ
                    
                  
                  )
                
              
            
          
          ⁢
          
            
              s
              C
              *
            
            ⁡
            
              (
              
                
                  c
                  ′
                
                ,
                
                  
                    r
                    ′
                  
                  |
                  α
                
              
              )
            
          
        
      
    
    
      
        (
        3.9
        )
      
    
  




{C*(c,r|α)} can be partially disambiguated in one pass using the idea that no pixels within a circle of radius Δ/2 are separated by more than Δ. Each pixel [c,r] in {sC*(c,r|α)} is visited in row order. If pixel [c,r] has not yet been eliminated as a redundant match, search R(c,r|Δ/2) for the largest s value (smax), and eliminate all [c′,r′] εR(c,r|Δ/2) for which s(c′,r′)<smax.

Partial disambiguation quickly eliminates most, but not necessarily all redundant matches. The exhaustive algorithm for disambiguating a list of m partially disambiguated matches is simple, has worstcase O(m2) complexity, and minimal memory requirements. Each match i=0 . . . m−1, is compared only to matches i+1 . . . m−1 further down the list that have not yet been flagged as ambiguous. Matches further down the list are flagged once found to be ambiguous. Complexity can be reduced to O(m) by dividing the image into adjacent virtual blocks (bins) of widths Δ. The binning algorithm works in two passes. In a first pass through the list, the match of largest s value is assigned to each bin that contains at least one match, and in the process, some matches are flagged as ambiguous. In a second pass through the list, the ambiguity status of matches not previously flagged as ambiguous is determined by comparing them to all un-flagged matches that lie within 3×3 bin neighborhoods. An example of corner detection is provided in FIG. 4.
4. State Variables for Polygon Boundary Track Particles
The particle filter used in the present invention for polygon boundary tracking uses a state vector xk that characterizes the state of side k (as opposed to just the state of corner k). In this state definition, side k is defined by the location [ck, rk] of corner k, and the ray [φk, Lk] that emanates from corner (k−1) mod n and terminates at corner k along side k of the polygon:

xk=[ck, rk, φk, Lk]T  (4.1)

This state vector captures geometric information about polygon corners and sides. Note that φk and θk are related by the polygon model according to equation (2.2). In particular, for k=0 (i.e. the initial side 0) the initial state vector x0=[c0, r0, φ0, L0]T associated with side 0 of a polygon whose boundary is to be tracked is specified by a pair of corners [c0, r0] and [cn−1, rn−1] drawn from the field of corners detected as unambiguous matches to corners 0 and n−1 in the polygon model. (See section 6.1). For k=n−1, (i.e. the last (n−1)th side) see section 6.2. And for 0<k<n−1 (i.e. the intermediate sides of the polygon track) and given side k−1, side k must satisfy general constraints imposed by polygon model :





  
    
      
        
          L
          k
        
        ≈
        
          {
          
            
              
                
                  l
                  k
                  *
                
              
              
                
                  
                    l
                    0
                    *
                  
                  >
                  0
                  ⁢
                  
                    (
                    
                      absolute
                      ⁢
                      
                        
                      
                      ⁢
                      side
                      ⁢
                      
                        
                      
                      ⁢
                      length
                      ⁢
                      
                        
                      
                      ⁢
                      constraints
                    
                    )
                  
                
              
            
            
              
                
                  
                    l
                    k
                    *
                  
                  ⁢
                  
                    L
                    0
                  
                
              
              
                
                  
                    l
                    0
                    *
                  
                  =
                  
                    0
                    ⁢
                    
                      (
                      
                        relative
                        ⁢
                        
                          
                        
                        ⁢
                        side
                        ⁢
                        
                          
                        
                        ⁢
                        length
                        ⁢
                        
                          
                        
                        ⁢
                        constraints
                      
                      )
                    
                  
                
              
            
          
        
      
    
    
      
        (
        4.3
        )
      
    
  
  
    
      
        
          φ
          k
        
        ≈
        
          
            φ
            
              k
              -
              1
            
          
          -
          π
          +
          
            α
            
              k
              -
              1
            
            *
          
        
      
    
    
      
        (
        4.4
        )
      
    
  




4.1 State Transition Density

For each particle i=1 . . . N and for all but the first and last side of the polygon (i.e. 0<k<n−1, but not for k=0 or k=n−1), particle filters generate a new particle xik by sampling the state transition density p(xk|xik−1) once. In our case, for some polygon, given the state xik−1 of side k−1, p(xk|xik−1) physically represents the density associated with the state of side k. The state transition density will now be discussed in detail. In the initial absence of training data, we replace the state transition density p(xk|xk−1) with a proposed state transition density q(xk|xk−1) designed to be suitable for polygon boundary tracking. The random state variables ck, rk, φk, and Lk can be sampled independently if q(xk|xk−1) is factored into four marginal univariate densities, namely p(ck|•), p(rk|•), q(φk|•), and q(Lk|•).
According to equation (4.4) and as illustrated in FIG. 5, the pointing direction φk of side k depends on the pointing direction of side k−1 and the acuteness of corner k:




  
    
      
        
          q
          ⁡
          
            (
            
              
                φ
                k
              
              |
              
                φ
                
                  k
                  -
                  1
                
              
            
            )
          
        
        =
        
          
            w
            
              Δ
              φ
            
          
          ·
          
            ψ
            ⁡
            
              (
              
                
                  
                    φ
                    k
                  
                  -
                  
                    φ
                    
                      k
                      -
                      1
                    
                  
                  +
                  π
                  -
                  
                    α
                    
                      k
                      -
                      1
                    
                    *
                  
                
                
                  
                    Δ
                    φ
                  
                  /
                  w
                
              
              )
            
          
        
      
    
    
      
        (
        4.8
        )
      
    
  




In equation (4.8), ψ(x) is a symmetric unimodal kernel function with mode at x=0 and domain xε(−w,w) (width 2w) that integrates to one. Examples of such kernel functions are the triangular pulse function of width 2, and the bicubic spline function





  
    
      
        
          ψ
          ⁡
          
            (
            x
            )
          
        
        =
        
          {
          
            
              
                
                  
                    
                      
                        x
                        3
                      
                      /
                      2
                    
                    -
                    
                      x
                      2
                    
                    +
                    
                      2
                      /
                      3
                    
                  
                  ⁢
                  
                    
                  
                
              
              
                
                  
                    
                      
                      x
                      
                    
                    ≤
                    1
                  
                  ⁢
                  
                    
                  
                
              
            
            
              
                
                  
                    
                      -
                      
                        x
                        3
                      
                    
                    /
                    6
                  
                  +
                  
                    x
                    2
                  
                  -
                  
                    2
                    ⁢
                    x
                  
                  +
                  
                    4
                    /
                    3
                  
                
              
              
                
                  1
                  <
                  
                    
                    x
                    
                  
                  <
                  2
                
              
            
            
              
                
                  0
                  ⁢
                  
                    
                  
                
              
              
                otherwise
              
            
          
        
      
    
    
      
        (
        4.9
        )
      
    
  




of width 4. In any case, ψ(x) can be converted into a function with domain xε(−wΔx,wΔx):





  
    
      
        
          
            ∫
            
              
                -
                w
              
              ⁢
              
                
              
              ⁢
              
                Δ
                x
              
            
            
              w
              ⁢
              
                
              
              ⁢
              
                
                  Δ
                  ⁢
                  
                    
                  
                
                x
              
            
          
          ⁢
          
            
              1
              
                Δ
                x
              
            
            ⁢
            
              ψ
              ⁡
              
                (
                
                  x
                  
                    Δ
                    x
                  
                
                )
              
            
            ⁢
            
              d
              x
            
          
        
        =
        1
      
    
    
      
        (
        4.10
        )
      
    
  




Δφ≧0 expresses allowable uncertainty in the pointing direction. Note that





  
    
      
        
          
            lim
            
              
                Δ
                φ
              
              ->
              0
            
          
          ⁢
          
            q
            ⁡
            
              (
              
                
                  φ
                  k
                
                |
                
                  φ
                  
                    k
                    -
                    1
                  
                
              
              )
            
          
        
        =
        
          δ
          ⁡
          
            (
            
              
                φ
                k
              
              -
              
                φ
                
                  k
                  -
                  1
                
              
              +
              π
              -
              
                α
                
                  k
                  -
                  1
                
                *
              
            
            )
          
        
      
    
    
      
        (
        4.11
        )
      
    
  




As illustrated in FIG. 6, when the polygon model imposes constraints on side length, the length Lk of side k is prescribed by the polygon model.





  
    
      
        
          q
          ⁡
          
            (
            
              L
              k
            
            )
          
        
        =
        
          {
          
            
              
                
                  
                    A
                    L
                  
                  ·
                  
                    ψ
                    ⁡
                    
                      (
                      
                        
                          
                            L
                            k
                          
                          -
                          
                            L
                            k
                            *
                          
                        
                        
                          
                            ɛ
                            L
                          
                          ⁢
                          
                            
                              L
                              k
                              *
                            
                            /
                            w
                          
                        
                      
                      )
                    
                  
                
              
              
                
                  
                    L
                    k
                  
                  ≥
                  1
                
              
            
            
              
                
                  0
                  ⁢
                  
                    
                  
                
              
              
                
                  
                    L
                    k
                  
                  <
                  1
                
              
            
          
        
      
    
    
      
        (
        
          4.12
          ⁢
          a
        
        )
      
    
  




In equation (4.12a), AL insures that q(Lk) integrates to one. εL≧0 expresses allowable uncertainty in polygon side length as a fraction of the side length constraint Lk*. Note that





  
    
      
        
          
            
              lim
              
                
                  ɛ
                  L
                
                ->
                0
              
            
            ⁢
            
              q
              ⁡
              
                (
                
                  L
                  k
                
                )
              
            
          
          =
          
            δ
            ⁡
            
              (
              
                
                  L
                  k
                
                -
                
                  L
                  k
                  *
                
              
              )
            
          
        
        ,
      
    
    
      
        (
        4.13
        )
      
    
  




The proposed state transition densities q(φk|φk−1) and q(Lk) in equations (4.8) and (4.12a) have only two parameters, namely Δφ and εL respectively. Over time, nominal values for these parameters could be replaced by estimates derived from ensembles of previously matched polygons.
Given side k−1, φk, and Lk, the location [ck, rk] of corner k is known deterministically, so p(ck|•) and p(rk|•) are expressed in terms of Dirac delta functions:

p(ck|ck−1, Lk, φk)=δ(ck−[ck−1+Lk cos φk]  (4.5)

p(rk|rk−1, Lk, φk)=δ(rk−[rk−1+Lk sin φk]  (4.6)

5. Measurement Variables for Polygon Boundary Track Particles

Our particle filter for polygon boundary tracking also uses an observation zk (potentially a vector) of measurements made directly from pixel gray values that relate to corner k and side k of the polygon model match. Our observation zk has two components:

zk=z(xk)=v·sC(xk)+(1−v)·sE(xk)ε[0,1], 0≧v≧1   (5.1)

In Eq. (5.1) the corner similarity measurement component sC(xk) characterizes the degree of GDM similarity between corner k in the polygon match and the field {θ(c,r)} of pixel gradient directions. And the edge similarity component sE(xk) characterizes the degree of GDM similarity between side k in the polygon match (a linear edge terminating at corner k) and the gradient direction field {θ(c,r)} from equation (3.1). Special cases of zk include sC(xk) when v=1, sE(xk) when v=0, and the mean of sC(xk) and sE(xk) when v=1⁄2. Unlike the state vector in equation (4.1) which captures geometric information about polygon corners and sides, the measurement components in equation (5.1) capture photometric information about polygon corners and sides derived from pixel gray values in the image.

5.1 Corner Similarity Measurement

As previously discussed, corner similarities can easily be pre-computed and stored at each vertex pixel location over all corner orientations prior to boundary tracking because corner position and orientation are the only degrees of freedom. The corner similarity measurement is a GDM feature extracted from a corner similarity field computed prior to boundary tracking:

sC(xk)=sC(ck, rk, θk|αk)ε[0,1]  (5.2a)

αk=min(αk*, 2π−αk*)ε(0,π), θk: equation (2.2) is satisfied   (5.2b)

Equation (5.2b) leads to an acuteness value a for a convex corner, which in turn dictates the field {sC(c, r, θ|α)}, k=0 . . . M−1 of pre-computed corner similarities to draw measurements sC(xk) from.

5.2 Edge Similarity Measurement

The side or edge similarity measurement sE(xk) is a GDM feature computed from the gradient direction field {θ(c,r)} (equation (3.1)) in the spatial domain as the boundary is being tracked. For a polygon side xk=[ck, rk, φk, Lk], sE(xk) is similar to equation (3.4) except (θ, α) is replaced by ε(φk,Lk) (the set of all pixels on the model of a polygon side of length L and thickness T with an endpoint at [0,0] pointing in direction φ) and β(c,r) is replaced by φk+π/2:




  
    
      
        
          
            s
            E
          
          ⁡
          
            (
            
              x
              k
            
            )
          
        
        =
        
          
            ∑
            
              
                (
                
                  c
                  ,
                  r
                
                )
              
              ∈
              
                ɛ
                ⁡
                
                  (
                  
                    
                      φ
                      k
                    
                    ,
                    
                      L
                      k
                    
                  
                  )
                
              
            
          
          ⁢
          
            
              a
              ⁡
              
                (
                
                  
                    c
                    +
                    
                      c
                      k
                    
                  
                  ,
                  
                    r
                    +
                    
                      r
                      k
                    
                  
                
                )
              
            
            ·
            
              w
              ⁡
              
                (
                
                  c
                  ,
                  r
                
                )
              
            
            ·
            
              
                sin
                2
              
              ⁡
              
                [
                
                  
                    θ
                    ⁡
                    
                      (
                      
                        
                          c
                          +
                          
                            c
                            k
                          
                        
                        ,
                        
                          r
                          +
                          
                            r
                            k
                          
                        
                      
                      )
                    
                  
                  -
                  
                    φ
                    k
                  
                
                ]
              
            
          
        
      
    
    
      
        (
        5.3
        )
      
    
  




Edge similarities (i.e. GDM feature for polygon sides) are computed as the boundary is being tracked because the degrees of freedom include not only line segment position and orientation, but also line segment length. For an image with m pixels, extraction of GDM features for corners is an O(m) proposition, whereas extraction of GDM features for polygon sides is an




  O
  ⁡
  
    (
    
      (
      
        
          
            m
          
        
        
          
            2
          
        
      
      )
    
    )
  




proposition, which is computationally prohibitive. GDM features for polygon sides are instead computed on-demand as polygon boundaries are being tracked.

5.3 Measurement Density

For each particle i=1 . . . N and for all but the first and last side of the polygon, particle filters generate a new particle xik by sampling the state transition density p(xk|xik−1) once. The weight wik assigned to particle xik is related to the value of the measurements density p(zk|xik). In our case, p(zk|xik) physically represents the density of measurements associated with side k (or any side) of a polygon.
The measurements density will now be discussed in detail. Following the definition of the observation zk in equation (5.1), the measurements density can be expressed as

p(zk|xk)=p(z(xk))=p(v·sC(xk)+(1−v)·sE(xk))   (5.4)

In the initial absence of training data, we replace the measurements density p(z(xk)) with a proposed measurements density q(z(xk)) designed to be suitable for polygon boundary tracking. As illustrated in FIG. 7, for any k, an appropriate proposed density for zk is





  
    
      
        
          q
          ⁡
          
            (
            z
            )
          
        
        =
        
          {
          
            
              
                
                  
                    
                      2
                      ⁢
                      w
                    
                    
                      Δ
                      z
                    
                  
                  ·
                  
                    ψ
                    ⁡
                    
                      (
                      
                        
                          
                            z
                            k
                          
                          -
                          1
                        
                        
                          
                            Δ
                            z
                          
                          /
                          w
                        
                      
                      )
                    
                  
                
              
              
                
                  
                    z
                    k
                  
                  ≤
                  1
                
              
            
            
              
                0
              
              
                
                  
                    z
                    k
                  
                  >
                  1
                
              
            
          
        
      
    
    
      
        (
        5.5
        )
      
    
  




where 0<Δz<0.5 is used to derive a lower bound >0.5 on an allowable value for z. This density has only one parameter, Δz. Over time, the nominal value for this parameter could be replaced by an estimate derived from ensembles of previously matched polygons.

6. Boundary Tracking for Polygons with Constrained Side Lengths

After the steps corner model matching and detecting corner best matches, the particle filtering approach to tracking polygon boundaries of the present invention performs three steps: (1) track initialization, which establishes the initial side k=0, (2) tracking polygon boundaries for intermediate sides 0<k<n−1, and (3) track termination which establishes the last side k=n−1.
6.1 Track Initialization: k=0
Track initialization occurs on step k=0 with the purpose of matching the initial side 0 of the polygon model. As mentioned in Section 4, the initial state x0=[c0, r0, φ0, L0]T associated with side 0 of a polygon whose boundary is to be tracked is specified by a pair of corners [ca, ra, αa, θa] and [cb, rb, ab, θb] drawn from the field of corners detected in the image as unambiguous matches to corners 0 and n−1 in the polygon model. The state variables are computed:




  
    
      
        
          
            [
            
              
                c
                0
              
              ,
              
                r
                0
              
              ,
              
                φ
                0
              
              ,
              
                L
                0
              
            
            ]
          
          T
        
        =
        
          
            [
            
              
                c
                b
              
              ,
              
                r
                b
              
              ,
              
                
                  φ
                  0
                
                =
                
                  
                    tan
                    
                      -
                      1
                    
                  
                  ⁢
                  
                    
                      
                        r
                        b
                      
                      -
                      
                        r
                        a
                      
                    
                    
                      
                        c
                        b
                      
                      -
                      
                        c
                        a
                      
                    
                  
                
              
              ,
              
                
                  L
                  0
                
                =
                
                  
                  
                    [
                    
                      
                        
                          c
                          b
                        
                        -
                        
                          c
                          a
                        
                      
                      ,
                      
                        
                          r
                          b
                        
                        -
                        
                          r
                          a
                        
                      
                    
                    ]
                  
                  
                
              
            
            ]
          
          T
        
      
    
    
      
        (
        6.1
        )
      
    
  




The constraints on corners a and b are

corner acuteness: αb=min(α0*, 2π−α0*)ε(0,π)  (6.2)

side length: (1−εL)L0*≦L0≦(1+εL)L0* if L0* is defined  (6.3)

side pointing directions: (θa−Δφ−αa/2+π)≦φ0≦(θa+Δφ−αa/2+π)

(θb−Δφ−αb/2+π)≦−φ0≦(θb+Δφ−αb/2+π)  (6.4)

Δφand εL are tolerances on side length and pointing direction (Δφ=3° and εL=0.1 in our studies). The state vectors {xi0}Ni=1 for the N initial particles are obtained by sampling from tight uniform distributions centered on x0:





  
    
      
        
          x
          0
          i
        
        =
        
          [
          
            
              
                
                  
                    c
                    0
                    i
                  
                  ∼
                  
                    U
                    (
                    
                      
                        
                          c
                          0
                        
                        -
                        Δ
                      
                      ,
                      
                        
                          c
                          0
                        
                        +
                        Δ
                      
                    
                    )
                  
                
              
            
            
              
                
                  
                    r
                    0
                    i
                  
                  ∼
                  
                    U
                    (
                    
                      
                        
                          r
                          0
                        
                        -
                        Δ
                      
                      ,
                      
                        
                          r
                          0
                        
                        +
                        Δ
                      
                    
                    )
                  
                
              
            
            
              
                
                  
                    φ
                    0
                    i
                  
                  ∼
                  
                    U
                    (
                    
                      
                        
                          φ
                          0
                        
                        -
                        
                          Δ
                          φ
                        
                      
                      ,
                      
                        
                          φ
                          0
                        
                        +
                        
                          Δ
                          φ
                        
                      
                    
                    )
                  
                
              
            
            
              
                
                  
                    L
                    0
                    i
                  
                  ∼
                  
                    U
                    ⁡
                    
                      (
                      
                        
                          
                            (
                            
                              1
                              -
                              
                                ɛ
                                L
                              
                            
                            )
                          
                          ⁢
                          
                            L
                            0
                          
                        
                        ,
                        
                          
                            (
                            
                              1
                              +
                              
                                ɛ
                                L
                              
                            
                            )
                          
                          ⁢
                          
                            L
                            0
                          
                        
                      
                      )
                    
                  
                
              
            
          
          ]
        
      
    
    
      
        (
        6.5
        )
      
    
  




Δ is tolerance in corner location (Δ=3 in our studies).

This initialization procedure will track polygon boundaries in all matches for which side 0 is represented in the field of detected corners. It will not track polygon boundaries for matches in which side 0 is missing from the field of detected corners (because either corner 0 or corner 1 are missing). Thus the number of polygon matches is the number of distinct pairs of corners (consistent with sides of the polygon model) that can be drawn from the field of detected corners.
In the alternative, a more rigorous initialization procedure applies expressions (6.2)-(6.4) to n left cyclic shifts of the polygon model (equation (2.1)) by one. For instance, consider an n-sided polygon model with corners {0,1,2,3}. For a polygon in the image, if the corner corresponding to model corner 0 is not detected in the image, then the polygon cannot be initialized even if corners 1 and 2 are detected. However, by shifting the model (creating a model with corners {1,2,3,0}), the polygon can be initialized. Although this procedure can introduce match redundancy, no polygon match will be missed due to the fact that a particular side is missing from the field of detected corners.
6.2 Track Termination: k=n−1
Track termination occurs on step k=n−1 with the purpose of closing (completing) the polygon boundary with the last side n−1. The terminal state vector xn−1=[cn−1, rn−1, αn−1, φn−1, Ln−1]T associated with the last side of the tracked polygon boundary is completely specified once the previous n−1 sides are specified:




  
    
      
        
          [
          
            
              c
              
                n
                -
                1
              
              i
            
            ,
            
              r
              
                n
                -
                1
              
              i
            
          
          ]
        
        =
        
          [
          
            
              
                c
                0
                i
              
              -
              
                
                  L
                  0
                  i
                
                ⁢
                cos
                ⁢
                
                  
                
                ⁢
                
                  φ
                  0
                  i
                
              
            
            ,
            
              
                r
                0
                i
              
              -
              
                
                  L
                  0
                  i
                
                ⁢
                sin
                ⁢
                
                  
                
                ⁢
                
                  φ
                  0
                  i
                
              
            
          
          ]
        
      
    
    
      
        (
        6.6
        )
      
    
  
  
    
      
        
          φ
          
            n
            -
            1
          
          i
        
        =
        
          
            tan
            
              -
              1
            
          
          ⁢
          
            
              
                r
                
                  n
                  -
                  1
                
                i
              
              -
              
                r
                
                  n
                  -
                  2
                
                i
              
            
            
              
                c
                
                  n
                  -
                  1
                
                i
              
              -
              
                c
                
                  n
                  -
                  2
                
                i
              
            
          
        
      
    
    
      
        (
        6.7
        )
      
    
  
  
    
      
        
          L
          
            n
            -
            1
          
          i
        
        =
        
          
          
            [
            
              
                
                  c
                  
                    n
                    -
                    1
                  
                  i
                
                -
                
                  c
                  
                    n
                    -
                    2
                  
                  i
                
              
              ,
              
                
                  r
                  
                    n
                    -
                    1
                  
                  i
                
                -
                
                  r
                  
                    n
                    -
                    2
                  
                  i
                
              
            
            ]
          
          
        
      
    
    
      
        (
        6.8
        )
      
    
  




6.3 Tracking with the SIR Particle Filter: 0<k<n−1

The tracking step finds all but the first and last sides of the polygon match, i.e. it track sides 1 to n−2 of the polygon boundary. As such, it involves n−2 iterations k=1 . . . n−2, one for each of the n−2 intervening polygon sides (iteration k=0 refers to initialization). Particle filters for polygon boundaries track N random samples or particles xik, i=1 . . . N of the state vector xk across iterations k=1 . . . n−2 to produce N particle tracks




  
    
      x
      
        0
        :
        
          n
          -
          1
        
      
      i
    
    ⁢
    
      =
      Δ
    
    ⁢
    
      {
      
        
          x
          k
          i
        
        ,
        
          k
          =
          
            
              0
              ⁢
              
                
              
              ⁢
              ...
              ⁢
              
                
              
              ⁢
              n
            
            -
            1
          
        
      
      }
    
  
  ,
  
    i
    =
    
      1
      ⁢
      
        
      
      ⁢
      ...
      ⁢
      
        
      
      ⁢
      
        N
        .
      
    
  




The initial state vector xi0=[ci0, ri0, φi0, Li0]T is obtained as described in Section 6.1. Then, on each iteration k=1 . . . n−2, a set of N new particles xik, i=1 . . . N is generated by sampling the state transition density:





  
    
      
        
          
            x
            k
            i
          
          ~
          
            p
            ⁡
            
              (
              
                
                  x
                  k
                
                ❘
                
                  x
                  
                    k
                    -
                    1
                  
                  i
                
              
              )
            
          
        
        ,
        
          k
          =
          
            
              1
              ⁢
              
                
              
              ⁢
              ...
              ⁢
              
                
              
              ⁢
              n
            
            -
            2
          
        
        ,
        
          i
          =
          
            1
            ⁢
            
              
            
            ⁢
            ...
            ⁢
            
              
            
            ⁢
            N
          
        
      
    
    
      
        (
        6.9
        )
      
    
  




as shown in Section 4.1. On iteration n−1 (the termination step) and for i=1 . . . N, the state vector xin−1 is computed from xin−2 and the polygon model  using equations (6.6 to 6.8).

In our case, given measurements




  
    z
    
      0
      :
      k
    
  
  ⁢
  
    =
    Δ
  
  ⁢
  
    {
    
      
        z
        j
      
      ,
      
        j
        =
        
          0
          ⁢
          
            
          
          ⁢
          ...
          ⁢
          
            
          
          ⁢
          k
        
      
    
    }
  




for sides 0 through k of a polygon boundary track, the posterior density p(xi0:k|z0:k) physically represents the joint density of states for sides 0 through k of a true polygon match. The weight wik≧0 associated with particle xik is related to p(xi0:k|z0:k). The weights are normalized so that they sum to one:





  
    
      
        
          w
          k
          i
        
        =
        
          
            w
            k
            i
          
          /
          
            
              ∑
              
                j
                =
                1
              
              N
            
            ⁢
            
              
            
            ⁢
            
              w
              k
              j
            
          
        
      
    
    
      
        (
        6.10
        )
      
    
  




The sample-importance-resample (SIR) or bootstrap particle filter (See the Sample-Importance-Resample Particle Filter Iteration Algorithm in Section 7.2 of Appendix) uses a popular sub-optimal choice for particle weights

wik∝p(zk|xik)

where the expression for wi0 applies to polygon side 0, and has been added for the special case of polygon boundary tracking.

A key feature of the SIR filter is a resampling step on each iteration that prevents particle weights from degenerating into a single dominant value as iterations progress. On each iteration, N resampled particles {{tilde over (x)}ik}Ni=1 with normalized weights {{tilde over (w)}ik}Ni=1 are drawn from the original set of particles {xik}Ni=1 with normalized weights {wik}Ni=1 using the Particle Resampling Algorithm described in Section 7.1 of the Appendix. The idea is to select samples with higher weights more often than samples with lower weights. Samples with higher weights are often selected multiple times by the resampler, whereas samples with lower weights are often not selected at all (i.e., they are often eliminated by the resampler).
Resampling involves a staircase distribution formed by integrating a 1D density composed of N impulses with weights wik, i=1 . . . N. Resampled particles are obtained by sampling the range [0,1] of distribution values uniformly N times. Thus for SIR filters, wik−1=1 in expression (6.11), which gives rise to the modified expression

wik=p(zk|xik), k=0 . . . n−1, i=1 . . . N  (6.12)

followed by weight normalization according to equation (6.10). Also, on iteration k, original particles xjk (and their parents from previous iterations) with indices j=jk(i) are mapped to resampled particles {tilde over (x)}ik with indices i, i.e.,





  
    
      
        
          
            
              x
              ~
            
            g
            i
          
          =
          
            x
            g
            
              
                j
                k
              
              ⁡
              
                (
                i
                )
              
            
          
        
        ,
        
          g
          =
          
            
              0
              ⁢
              
                
              
              ⁢
              ...
              ⁢
              
                
              
              ⁢
              k
            
            -
            1
          
        
      
    
    
      
        (
        6.13
        )
      
    
  




where jk(i) is the index of the original particle mapped to the resampled particle with index i on iteration k. The weights assigned to resampled particles are all equal, {tilde over (w)}ik=1/N

The resampled particles can be much less diverse than the input particles. This can potentially result in another problem known as sample impoverishment, which leads to a condition in which all particles collapse into a single point within a few iterations. Sample impoverishment is not likely to be a problem for us since the number of tracking iterations (the number of polygon sides) is typically small, and we use proposed state transition densities with non-negligible uncertainties.
6.4 Exemplary Embodiment of Polygon Boundary Tracking Methodology for Constrained Side Lengths
To illustrate the polygon boundary tracking method of the present invention, suppose two corners [c0,r0] and [c1,r1] compliant with the first side in some cyclic shift of  have been drawn from a field of corners previously detected in an image {u(c,r)} as described in Section 3.3, as a preliminary step. The algorithm for polygon boundary tracking with particle filters shown in Section 7.3 of the Appendix then proceeds with an initialization step, a tracking step, and a termination step. The tracking step in particular involves the SIR Particle Filter Algorithm of Section 7.2 of the Appendix, as well as the Particle Resampling Algorithm of Section 7.1 of the Appendix.
FIGS. 11 and 12 show the results of an example of boundary tracking for polygons with constrained side lengths using the methodology of the present invention. As can be seen, the results of the particle filter approach to polygon boundary tracking of the present invention can be produced in graphic form on a display, together with the original image, so as that the detected polygon structures/objects in the image may be identified.
6.5 Track Blending
For polygon models with absolute or relative side length constraints, tracks i=1 . . . N all attempt to track the same polygon boundary. Each attempt xi0:n−1 i=1 . . . N is a sequence of n states that can be viewed as a sample of some random vector X0:n−1 of states representing the true polygon boundary. The true boundary can be modeled as the expectation E[X0:n−1] of this random vector. The polygon match is an estimate Ê[X0:n−1] of the true boundary. The blended track Ê[X0:n−1]=X0:n−1={xk=[ck, rk, φk, Lk]T, k=0 . . . n−1} (a sequence of n states) can be formed as a weighted average of tracks i=1 . . . N:




  
    
      
        
          
            
              [
              
                
                  c
                  k
                
                ,
                
                  r
                  k
                
              
              ]
            
            =
            
              
                ∑
                
                  i
                  =
                  1
                
                N
              
              ⁢
              
                
              
              ⁢
              
                
                  q
                  ⁡
                  
                    (
                    
                      z
                      ⁡
                      
                        (
                        
                          x
                          k
                          i
                        
                        )
                      
                    
                    )
                  
                
                ·
                
                  
                    [
                    
                      
                        c
                        k
                        i
                      
                      ,
                      
                        r
                        k
                        i
                      
                    
                    ]
                  
                  /
                  
                    
                      ∑
                      
                        i
                        =
                        1
                      
                      N
                    
                    ⁢
                    
                      q
                      ⁡
                      
                        (
                        
                          z
                          ⁡
                          
                            (
                            
                              x
                              k
                              i
                            
                            )
                          
                        
                        )
                      
                    
                  
                
              
            
          
          ,
          
            

          
          ⁢
          
            k
            =
            
              
                0
                ⁢
                
                  
                
                ⁢
                ...
                ⁢
                
                  
                
                ⁢
                n
              
              -
              1
            
          
        
        ⁢
        
          
        
      
    
    
      
        (
        6.15
        )
      
    
  
  
    
      
        
          [
          
            
              φ
              k
            
            ,
            
              L
              k
            
          
          ]
        
        =
        
          [
          
            
              
                tan
                
                  -
                  1
                
              
              ⁢
              
                
                  
                    r
                    k
                  
                  -
                  
                    r
                    
                      k
                      -
                      1
                    
                  
                
                
                  
                    c
                    k
                  
                  -
                  
                    c
                    
                      k
                      -
                      1
                    
                  
                
              
            
            ,
            
              
              
                
                  
                    c
                    k
                  
                  -
                  
                    c
                    
                      k
                      -
                      1
                    
                  
                
                ,
                
                  
                    r
                    k
                  
                  -
                  
                    r
                    
                      k
                      -
                      1
                    
                  
                
              
              
            
          
          ]
        
      
    
    
      
        (
        6.16
        )
      
    
  




where [cn, rn]=[c0, r0]. There is exactly one blended particle track for each detected polygon. Initialization sides that correspond to a previously blended track can be ignored.

6.6 Ranking of Blended Tracks

Motivated by equation (5.1), one intuitive ranking measure for the blended track is




  
    
      
        
          w
          
            0
            :
            
              n
              -
              1
            
          
        
        =
        
          
            
              v
              
                n
                ·
                
                  max
                  ⁡
                  
                    (
                    
                      q
                      ⁡
                      
                        (
                        z
                        )
                      
                    
                    )
                  
                
              
            
            ⁢
            
              
                ∑
                
                  k
                  =
                  0
                
                
                  n
                  -
                  1
                
              
              ⁢
              
                
              
              ⁢
              
                q
                ⁡
                
                  (
                  
                    z
                    =
                    
                      
                        s
                        C
                      
                      ⁡
                      
                        (
                        
                          x
                          k
                        
                        )
                      
                    
                  
                  )
                
              
            
          
          +
          
            
              
                1
                -
                v
              
              
                max
                ⁡
                
                  (
                  
                    q
                    ⁡
                    
                      (
                      z
                      )
                    
                  
                  )
                
              
            
            ⁢
            
              
                
                  ∑
                  
                    k
                    =
                    0
                  
                  
                    n
                    -
                    1
                  
                
                ⁢
                
                  
                
                ⁢
                
                  
                    L
                    k
                  
                  ·
                  
                    q
                    ⁡
                    
                      (
                      
                        z
                        =
                        
                          
                            s
                            E
                          
                          ⁡
                          
                            (
                            
                              x
                              k
                            
                            )
                          
                        
                      
                      )
                    
                  
                
              
              
                
                  ∑
                  
                    k
                    =
                    0
                  
                  
                    n
                    -
                    1
                  
                
                ⁢
                
                  
                
                ⁢
                
                  L
                  k
                
              
            
          
        
      
    
    
      
        (
        6.17
        )
      
    
  




w0:n−1ε[0,1] calculates contributions from corner and edge similarities separately. The contribution from corner similarities is averaged evenly across all sides. The contribution from edge similarities is a weighted average across all sides in which the weight associated with a particular side is proportional to its length. w0:n−1 allows different matches to the same polygon model  to be ranked relative to one-another. It has several advantages:

    
    
        (1) The importance of corners relative to sides can be specified:
        
            As v increases, w0:n−1 becomes more sensitive to missing corners and less sensitive to missing sides.
        
        
        (2) Undetected corners and sides are handled:
        
            Our measure seeks states xk for which sC(xk) and sE(xk) are large. It thus copes with corners that cannot necessarily be found with a corner detector because sC(xk) can be large even if no corner is detected at xk. It also copes with sides that cannot necessarily be found with an edge detector because sE(xk) can be large even if no edge is detected along the side emanating from xk.

6.7 Complexity Minimization for Edge Matching

        
        
    
    


The cost of polygon matching is dominated by the cost of computing edge similarities sE(xik) over all sides k=1 . . . n−2 and all particles i=1 . . . N as the boundary is being tracked. By brute force, nN edge similarity calculations are required in order to generate a single polygon match. The number of edge similarity calculations per polygon match can be reduced by a factor of N to only n by recognizing that for polygon models with constrained side lengths and for any side k: 0<k<n−1, one can expect sE(xik) to be relatively constant for i=1 . . . N. In this case, if v is not too close to 0, the measurement variable z(xik) in equation (5.1) can be replaced by

z′(xik)=sC(xik)  (6.18)

which is pre-computed prior to boundary tracking. However, when the rank w0:n−1 in equation (6.10) is computed for the blended track, it is important to revert back to the measurement variable z(xk) in equation (5.1) (which explicitly takes sE(xk) into account) so that different polygon matches can be accurately compared. Fortunately, this process requires only n edge similarity calculations.

6.8 Track Redundancy

For models of polygons with constrained side lengths, our particle tracking approach produces exactly one blended boundary track (i.e., one polygon match) for each pair of detected corners that is geometrically consistent with some side of the polygon model. Since tests for geometrical consistency are applied to all n sides of the polygon model (Section 4.1), it is possible to match a single polygon in the image multiple times. Redundant boundary tracks can be prevented by ignoring pairs of model-consistent corners that are also geometrically consistent with some side of a blended boundary track that already exists. Mathematically, a pair of detected corners [c0,r0,α0,φ0] and [c1,r1,α1,φ1] is geometrically consistent with the first two corners {[ca,ra,αa,φa], [cb,rb,αb,φb]} of a pre-existing blended boundary track if the locations, orientations, and acutenesses are sufficiently close:

α0=αa, α1=αb  (6.19)

|φ0−φa|+|φ1−φb|<εφ  (6.20)

∥[c0−ca, r0−ra]∥+∥[c1−cb, r1−rb]∥<εd   (6.21)

7. Appendix

7.1 Particle Resampling Algorithm

{{tilde over (x)}ik, {tilde over (w)}ik}Ni=1=particleFilterResample ({xik, wik}Ni=1)

1. Generate a staircase distribution from particles:

    
    
        Pk(0)=0
        for i=1 . . . N
        
            Pk(i)=Pk(i−1)+wik 
        
        
    
    


2. Sample the staircase distribution using a transformational method:

    
    
        for i=1 . . . N
        
            y ̃U(0.1)
            resample: jkk(i)=x(i): Pk(x(i))≦y<Pk(x(i)+1)
            {tilde over (x)}ig=xgjk(i), g=0 . . . k−1. {tilde over (w)}ik=1/N

7.2 Sample-Importance-Resample Particle Filter Iteration Algorithm

{xik, wik}Ni=1=SIRparticleFilterIteration ({xik−1, wik−1}Ni=1, {u(c,r)}, ) (k>0)

        
        
    
    


1. Sample and compute importance weights:

    
    
        for i=1 . . . N
        
            sample: draw xik ̃p(xk|xik−1) (requires )
            compute importance weights: wik=p(zk|xik) (requires {u(c,r)}, )
        
        
    
    


2. Normalize importance weights:




  
    
      ·
      
        
      
      ⁢
      for
    
    ⁢
    
      
    
    ⁢
    i
  
  =
  
    
      1
      ⁢
      
        
      
      ⁢
      ...
      ⁢
      
        
      
      ⁢
      
        N
        ⁢
        
          

        
        ·
        
          
        
        ⁢
        
          w
          k
          i
        
      
    
    =
    
      
        w
        k
        i
      
      /
      
        
          ∑
          
            j
            =
            1
          
          N
        
        ⁢
        
          
        
        ⁢
        
          w
          k
          j
        
      
    
  




3. Resample:




  
    
      
        {
        
          
            x
            k
            i
          
          ,
          
            w
            k
            i
          
        
        }
      
      
        i
        =
        1
      
      N
    
    ←
    
      
        {
        
          
            
              x
              ~
            
            k
            i
          
          ,
          
            
              w
              ~
            
            k
            i
          
        
        }
      
      
        i
        =
        1
      
      N
    
  
  =
  
    particleFilterResample
    ⁢
    
      
        
      
      ⁢
      
        
      
    
    (
    
      
        {
        
          
            x
            k
            i
          
          ,
          
            w
            k
            i
          
        
        }
      
      
        i
        =
        1
      
      N
    
    )
  




7.3 Polygon Boundary Tracking Algorithm

{xi0:n−1, wi0:n−1}Ni=1=polygonBoundaryTrack ([ca,ra], [cb,rb], {u(c,r)}, )

1. Initialize:




  
    
      ·
      
        
      
      ⁢
      
        x
        0
      
    
    =
    
      
        
          
            
              [
              
                
                  
                    c
                    b
                  
                  ⁢
                  
                    r
                    b
                  
                  ⁢
                  
                    φ
                    0
                  
                
                =
                
                  
                    
                      tan
                      
                        -
                        1
                      
                    
                    ⁢
                    
                      
                        
                          r
                          b
                        
                        -
                        
                          r
                          a
                        
                      
                      
                        
                          c
                          b
                        
                        -
                        
                          c
                          a
                        
                      
                    
                    ⁢
                    
                      L
                      0
                    
                  
                  =
                  
                    
                    
                      [
                      
                        
                          
                            c
                            b
                          
                          -
                          
                            c
                            a
                          
                        
                        ,
                        
                          
                            r
                            b
                          
                          -
                          
                            r
                            a
                          
                        
                      
                      ]
                    
                    
                  
                
              
              ]
            
            T
          
          ⁢
          
            

          
          ·
          
            
          
          ⁢
          for
        
        ⁢
        
          
        
        ⁢
        i
      
      =
      
        
          1
          ⁢
          
            
          
          ⁢
          ...
          ⁢
          
            
          
          ⁢
          
            N
            ⁢
            
              

            
            ·
            
              
            
            ⁢
            
              x
              0
              i
            
          
        
        =
        
          [
          
            
              
                
                  
                    
                      
                        
                          
                            
                              
                                c
                                0
                                i
                              
                              ~
                              
                                U
                                (
                                
                                  
                                    
                                      c
                                      0
                                    
                                    -
                                    Δ
                                  
                                  ,
                                  
                                    
                                      c
                                      0
                                    
                                    +
                                    Δ
                                  
                                
                                )
                              
                            
                          
                        
                        
                          
                            
                              
                                r
                                0
                                i
                              
                              ~
                              
                                U
                                (
                                
                                  
                                    
                                      r
                                      0
                                    
                                    -
                                    Δ
                                  
                                  ,
                                  
                                    
                                      r
                                      0
                                    
                                    +
                                    Δ
                                  
                                
                                )
                              
                            
                          
                        
                      
                    
                  
                  
                    
                      
                        
                          φ
                          0
                          i
                        
                        ~
                        
                          U
                          ⁡
                          
                            (
                            
                              
                                
                                  φ
                                  0
                                
                                -
                                
                                  Δ
                                  φ
                                
                              
                              ,
                              
                                
                                  φ
                                  0
                                
                                +
                                
                                  Δ
                                  φ
                                
                              
                            
                            )
                          
                        
                      
                    
                  
                
              
            
            
              
                
                  
                    L
                    0
                    i
                  
                  ~
                  
                    U
                    ⁡
                    
                      (
                      
                        
                          
                            (
                            
                              1
                              -
                              
                                ɛ
                                L
                              
                            
                            )
                          
                          ⁢
                          
                            L
                            0
                          
                        
                        ,
                        
                          
                            (
                            
                              1
                              +
                              
                                ɛ
                                L
                              
                            
                            )
                          
                          ⁢
                          
                            L
                            0
                          
                        
                      
                      )
                    
                  
                
              
            
          
          ]
        
      
    
  
  ,
  
    
  
  ⁢
  
    
      w
      0
      i
    
    =
    
      1
      /
      N
    
  




2. Track:

    
    
        for k=1 . . . n−2
        
            {xik, wik}Ni=1=SIRparticleFilterIteration ({xik−1, wik−1}Ni=1, {u(c,r)}, )
        
        
    
    


3. Terminate:




  
    
      ·
      
        
      
      ⁢
      for
    
    ⁢
    
      
    
    ⁢
    i
  
  =
  
    
      1
      ⁢
      
        
      
      ⁢
      ...
      ⁢
      
        
      
      ⁢
      
        N
        ⁢
        
          

        
        ·
        
          
        
        ⁢
        
          x
          
            n
            -
            1
          
          i
        
      
    
    =
    
      [
      
        
          
            
              
                
                  
                    
                      
                        
                          
                            c
                            
                              n
                              -
                              1
                            
                            i
                          
                          =
                          
                            
                              c
                              0
                              i
                            
                            -
                            
                              
                                L
                                0
                                i
                              
                              ⁢
                              cos
                              ⁢
                              
                                
                              
                              ⁢
                              
                                φ
                                0
                                i
                              
                            
                          
                        
                      
                    
                    
                      
                        
                          
                            r
                            
                              n
                              -
                              1
                            
                            i
                          
                          =
                          
                            
                              r
                              0
                              i
                            
                            -
                            
                              
                                L
                                0
                                i
                              
                              ⁢
                              sin
                              ⁢
                              
                                
                              
                              ⁢
                              
                                φ
                                0
                                i
                              
                            
                          
                        
                      
                    
                  
                
              
              
                
                  
                    
                      φ
                      
                        n
                        -
                        1
                      
                      i
                    
                    =
                    
                      
                        tan
                        
                          -
                          1
                        
                      
                      ⁢
                      
                        
                          
                            r
                            
                              n
                              -
                              1
                            
                          
                          -
                          
                            r
                            
                              n
                              -
                              2
                            
                            i
                          
                        
                        
                          
                            c
                            
                              n
                              -
                              1
                            
                          
                          -
                          
                            c
                            
                              n
                              -
                              2
                            
                            i
                          
                        
                      
                    
                  
                
              
            
          
        
        
          
            
              
                L
                
                  n
                  -
                  1
                
                i
              
              =
              
                
                
                  [
                  
                    
                      
                        c
                        
                          n
                          -
                          1
                        
                      
                      -
                      
                        c
                        
                          n
                          -
                          2
                        
                        i
                      
                    
                    ,
                    
                      
                        r
                        
                          n
                          -
                          1
                        
                      
                      -
                      
                        r
                        
                          n
                          -
                          2
                        
                        i
                      
                    
                  
                  ]
                
                
              
            
          
        
      
      ]
    
  




While particular operational sequences, materials, parameters, and particular embodiments have been described and or illustrated, such are not intended to be limiting. Modifications and changes may become apparent to those skilled in the art, and it is intended that the invention be limited only by the scope of the appended claims.

## Claims

1. A method in a computer system for detecting polygon boundaries of structures in an image, comprising:
receiving an image;
detecting in said image a set of polygon corners each substantially matching one of n corner models of an n-sided polygon model based on directions of gradients in pixel gray-values of said image;
initializing tracking of polygon boundaries by selecting pairs of corners from the set of detected polygon corners which match the first 0th and last (n−1)th corners models of the n-sided polygon model, wherein each selected pair defines a first 0th side of a corresponding one of the polygon boundaries;
using a particle filter performing Sequential Monte Carlo sampling to track intermediate sides of the polygon boundaries after the first 0th side up to and including a penultimate (n−2)th side, wherein the particles used in the particle filter characterize the states of the polygon boundary sides, and observations used in the particle filter characterize the match similarity between the set of detected polygon corners at locations and orientations predicted by the polygon model;
terminating tracking of the polygon boundaries by determining the last (n−1)th sides thereof based on specified states of the sides of the polygon boundaries for the previous n−1 sides; and
blending multiple particle tracks for the same polygon into a single boundary based on importance weights that reflect particle fitness, to produce an array of polygon matches detected in said image.

2. The method of claim 1,
further comprising ranking the blended particle tracks based on corner fitness contributions and edge fitness contributions in user-specified proportions.

3. The method of claim 1,
wherein the corner models are gradient direction corner models, and the step of detecting the set of polygon corners comprises: for each of M corner model orientations per pixel in said image, determining n corner similarity values as a gradient direction matching (GDM) feature between the direction of the gradient in the pixel gray-value and the n gradient direction corner models; and determining as polygon corners those pixels satisfying predetermined GDM feature thresholds.

4. The method of claim 2,
wherein the predetermined GDM feature thresholds include those pixels determined to be unambiguous local maxima above a threshold magnitude in a set of optimal GDM feature values.

5. The method of claim 1,
wherein in the initialization step, the selection of the pairs of corners are based on each of n cyclic shifts of the n-sided polygon model.

6. The method of claim 1,
further comprising providing the array of polygon matches for use by a user.

7. The method of claim 6,
wherein the array of polygon matches is graphically rendered for display.

8. A method in a computer system for detecting polygon boundaries of structures in an image, comprising:
computing a set of similarity values characterizing the degree of matching between an estimated gradient direction of each of M corner orientations of each pixel to a gradient direction model of a corner of predetermined acuteness α of a polygon model;
determining a set of best matching corners from the set of similarity values by finding unambiguous local maxima of predetermined sufficient magnitude in the set of similarity values;
initializing tracking of polygon boundaries by selecting pairs of corners from the set of detected polygon corners which match the first 0th and last (n−1)th corners models of the n-sided polygon model, wherein each selected pair defines a first 0th side of a corresponding one of the polygon boundaries;
tracking intermediate sides of the polygon boundaries using a particle filter performing SMC sampling, including a penultimate (n−2)th side;
terminating polygon boundary tracking by determining the last (n−1)th side of the tracked polygon boundaries based on boundary values up to the (n−1)th side, to close the polygon boundaries; and
blending the polygon boundary tracks to produce polygon match data identifying polygon structures in the image.

9. A computer system for detecting polygon boundaries of structures in an image, comprising:
input means for receiving the image;
a first data processing module for detecting in said image a set of polygon corners each substantially matching one of n corner models of an n-sided polygon model based on directions of gradients in pixel gray-values of said image;
a second data processing module initializing tracking of polygon boundaries by selecting pairs of corners from the set of detected polygon corners which match the first 0th and last (n−1)th corners models of the n-sided polygon model, wherein each selected pair defines a first 0th side of a corresponding one of the polygon boundaries;
a third particle filtering module for performing Sequential Monte Carlo sampling to track intermediate sides of the polygon boundaries after the first 0th side up to and including a penultimate (n−2)th side, wherein the particles used in the particle filter characterize the states of the polygon boundary sides, and observations used in the particle filter characterize the match similarity between the set of detected polygon corners at locations and orientations predicted by the polygon model;
a fourth data processing module for terminating tracking of the polygon boundaries by determining the last (n−1)th sides thereof based on specified states of the sides of the polygon boundaries for the previous n−1 sides; and
a fifth data processing module for blending multiple particle tracks for the same polygon into a single boundary based on importance weights that reflect particle fitness, to produce an array of detected polygon matches;
output means for making the array of detected polygon matches available for use.