# Patent

## Title
Implementation of Hough transform and its application in line detection and video motion analysis

## Abstract

An implementation of Hough transform is described. According to one aspect, the Hough transform is used for line detection in an image based on a one-dimensional voting array.

## Background
CROSS-REFERENCE TO RELATED APPLICATIONS
This application claims the benefit of U.S. Provisional Application No. 60/340,499, filed Dec. 12, 2001.
This application is related to copending patent application Ser. No. 10/318,697, entitled “Implementation of Hough Transform and Its Application in Video Motion Analysis”, filed Dec. 12, 2004, and patent application Ser. No. 10/318,857, entitled “implementation of Hough Transform and Its Application in Video Motion Analysis”, filed Dec. 12, 2004, each commonly assigned with the present invention.


FIELD OF THE INVENTION
In general, the invention relates to the field of image processing in motion-based video systems. More specifically, the invention relates to pattern detection and analysis based on the Hough transform.
COPYRIGHT NOTICE 
A portion of the disclosure of this patent document contains material which is subject to copyright protection. The copyright owner has no objection to the facsimile reproduction by anyone of the patent document or the patent disclosure as it appears in the Patent and Trademark Office patent file or records, but otherwise reserves all copyright rights whatsoever. The following notice applies to the software and data as described below and in the drawings hereto: Copyright ©2001, Sony Electronics, Inc., All Rights Reserved.
BACKGROUND OF THE INVENTION
Traditional effectiveness of motion-based video segmentation systems depends on the quality of the motion analysis, which is performed to estimate the motion models between a pair of consecutive frames. That is, a process of determining the corresponding relationship between the locations of a scene point in two consecutive frames. However, in real imagery, it is difficult to determine the multiple motion models because the different objects in a scene have different motions. Traditional, optical flow techniques usually do not work well because the intervals between image acquisitions are not small enough in many applications.
Although estimation techniques based on texture point correspondence do not fail in such applications, it is still difficult to extract multiple global motion models due to the mismatches in point correspondences. These mismatches originate from the image noise, as well as the matching uncertainty, commonly referred to as the “aperture problem.”
Variations of Hough transform (HT) have been used to solve the problem of video motion analysis using four-dimensional voting arrays for video motion analysis, under the same conventional principle of using two-dimensional voting arrays for straight line detection. Along with the problem of being insensitive to the imperfect data or noise, using conventional implementations of Hough transform comes at the cost of storage (due in part to the size of the voting arrays) and extensive computation. In addition, these memory and computational consumption problems drastically increase if the number of model parameters increase as is the case of motion analysis.
BRIEF SUMMARY OF EMBODIMENTS OF THE INVENTION
An implementation of Hough transform is described. According to one aspect, the Hough transform is used for line detection in an image based on a one-dimensional voting array.



BRIEF DESCRIPTION OF THE DRAWINGS
The invention may best be understood by referring to the following description and accompanying drawings that are used to illustrate embodiments of the invention. In the drawings:
FIGS. 1A and 1B illustrate a process flow for detecting lines or motion models in a recursive fashion according to one embodiment of the invention;
FIGS. 2A and 2B illustrate a process flow for performing motion analysis on video frames according to an embodiment of the invention;
FIG. 3A illustrates feature points that form lines in an image space according to one embodiment of the invention;
FIG. 3B illustrates a feature points' corresponding P-lines in the parameter space according to one embodiment of the invention;
FIG. 3C illustrates voting array values before and after filtering according to one embodiment of the invention;
FIG. 3D illustrates a P-line corresponding to a second PDI, according to one embodiment of the invention; and
FIG. 4 illustrates a computer system for performing the embodiments of the implementations of the Hough transform.



DETAILED DESCRIPTION
In the following description, numerous specific details are set forth to provide a thorough understanding of embodiments the invention. However, it is understood that the invention may be practiced without these specific details. In other instances, well-known circuits, structures and techniques have not been shown in detail in order not to obscure the invention. An implementation of Hough transform is described for detecting hidden patterns from corrupted data in an image or video. In general, a pattern is identified when a low-dimensional solution subspace (LDSS) in a parameter space is mapped on a voting array where the maximum voting cell is identified as a new LDSS repeatedly until the slot of the maximum voting cell converges to a point in the parameter space. This point revealing the pattern to be detected.
To facilitate an understanding of this implementation, embodiments of the implementation of Hough transform are disclosed for detecting lines in an image, and performing motion analysis on video frames. However, one of ordinary skill in the art will appreciate that there are alternative ways of using the implementation of Hough transform and that the invention is not limited to the embodiments described herein.
FIG. 1A illustrates a process flow for detecting lines in an image according to one embodiment of the invention, or a process flow for detecting motion models from video frames, according to another embodiment of the invention. For the implementation of line detection, at block 110, a pool of feature points is collected. A feature point (x, y) in an image space defines a line (α,h) (e.g., a P-line) in a parameter space. At block 120, an I-line from the collected feature points is located. The I-line is a line formed by many feature points in the image space. Here, any one of the existing I-lines may be detected. For example, the most prominent lines (e.g., in terms of the shape and supporting feature points) may be detected. At block 130, all of the feature points fitting that I-line are removed. This detecting-removing procedure is repeated (140) on the rest of the feature points, until all the I-lines are detected (150). In one embodiment, a termination criterion may be specified, such as, for example, the specific number of lines to be detected, or a percentage of the feature points to be removed, among other examples.
FIG. 1B illustrates a process flow of the line detection of block 120 according to one embodiment (or the motion model detection according to another embodiment). For the implementation of line detection, at block 210, a feature point (xk, yk) is randomly chosen. This feature point is designated a primary data item (PDI). FIG. 3(a) illustrates an example of feature points in an image space. At block 220, a P-line is quantized in the parameter space defined by the PDI, within the limits of α and h. The P-line is a line in the (α, h) parameter space (where h is the length of a normal from the origin to this line and α is the angle with the normal). FIG. 3(b) illustrates the P-line in a parameter space defined by the PDI. In addition, at block 220, a one-dimensional voting array V(d) is formed mapping the quantization, having all elements set to zero. At block 230, in the parameter space, the intersection of the PDI's P-line and the P-line of every other feature point is calculated. Furthermore, at block 230, the intersection (α, h) found is converted into a one-dimensional coordinate d and a corresponding unfiltered vote is generated at cell d (FIG. 3(c) Top). The vote is weighted by the angle θ between the intersecting P-lines. In one embodiment, the vote is weighed more if θ is closer to right angle: V(d)=V(d)+w(θ). It should be understood that the final value of cell d reflects the density and the orthogonality of the intersections at location d. At block 240, the voting array is filtered and the global maximum d* is located (FIG. 3(c) Bottom). In addition, the d*'s two-dimensional corresponding (α*, h*) is computed. At block 250, each feature point, other than the PDI, is rechecked, and another feature point is identified whose corresponding P-line is substantially perpendicular to the line of the PDI, and has the intersection closest to d*, (FIG. 3(d)). If a termination criterion is satisfied, the feature point in the parameter space is returned (at block 270) as a located line in the image space. If a termination criterion is not satisfied, the feature point, at block 250, is selected as the new PDI. The process returns to block 220 with the new PDI and iterates until (α*, h*) converge to a point in the parameter space, which is an I-line formed by the feature points (at block 250) in the image space.
It is well known to those of ordinary skill in the art that a cluster of feature points form an I-line if their corresponding P-lines in the parameter space go through a focus point as shown in FIG. 3(b). The d* in block 240 can be seen as an approximation of the projection of a nearby focus point onto the PDI P-line, where the density and the orthogonality of the intersections tend to be high. It should be understood that, in block 250, the new PDI is chosen, whose corresponding P-line satisfies the following condition

e<D tan(θ/2), θ∈[0, π/2]  (1)

where e is the distance between the focus point's projection and the intersection of the corresponding P-lines of the new and the old PDI. θ is the angle between these two P-lines. D is the distance between the old PDI's P-line and the focus point. It should be appreciated that if this condition is satisfied, the new PDI's corresponding P-line is closer to the focus point. After a few iterations, the PDI P-lines are attracted to the focus point, and (α*, h*) converge to the solution defined by the focus point.

It should be appreciated that this embodiment of an implementation of Hough transform for line detection uses a one-dimensional voting array, and not a two-dimensional voting array as used in conventional line detection techniques, such as, forward projection, backward projection, and feature point pairs implementation of Hough transform well known in the art. Assuming that all of the feature points form m straight lines, and each line has about equal number of supporting feature points, without taking the voting array filtering operations into account, the computational cost is roughly O(mM). It should be understood that in one embodiment, the new Hough transform implementation for line detection could be applied together with a random subset scheme, and thereby cut the computational cost further. That is, this scheme may randomly pick a subset of the feature points (e.g., ten percent) as the input of detection, and thereby computation time is saved because less input data are processed.
The image and the parameter space of the Hough transform using the process flow implementation as described in FIGS. 1A and B, can be expanded to estimate global motions in video frames. Video motion analysis involves estimating the scene motion among each pair of consecutive frames from an input video. In this embodiment, a data pool of data items is collected at block 110 of FIG. 1A. A data item is a set of two equations with four unknowns, which correspond to the pan, tilt, zoom, and rotate of the scene, respectively. Usually, frames have a data item pool of thousands of data items. At block 120, a motion model is located and, at block 130, the data items fitting the motion model are removed from the data pool. This locating and removing process is repeated on the rest of the data items in the data pool, until all the motion models are detected. Again, the termination criteria may be specified, for example, as the number of prominent motion model to be detected, or the percentage of the data items to be removed, among other examples. The task of the Hough transform is to determine the most popular solutions (e.g., the internal coordinates having the most votes, as will be described) supported by the data item equations. The process described in FIG. 1B determines a popular solution.
In one embodiment, a motion model detection problem (and also the straight-line detection problem) can be stated as having the data pool, defined by a set of equations:




   
  
    
      
        
          
            
              
                
                  
                    B
                    1
                  
                  =
                  
                  ⁢
                  
                    
                      A
                      1
                      T
                    
                    ⁢
                    X
                  
                
                ,
              
            
          
          
            
              
                
                  
                    B
                    2
                  
                  =
                  
                  ⁢
                  
                    
                      A
                      2
                      T
                    
                    ⁢
                    X
                  
                
                ,
              
            
          
          
            
              
                
                ⁢
                ⋮
              
            
          
          
            
              
                
                  
                    B
                    M
                  
                  ⁢
                  
                  ⁢
                  
                    A
                    M
                    T
                  
                  ⁢
                  X
                
                ,
                .
              
            
          
        
      
      
        
          
            (
            2
            )
          
          ⁢
          
            
          
        
      
    
  




The task is to determine the most popular solutions Xi, X2, . . . , supported by the data item equations. In the case of line detection, these are the feature points P-line equations,

B1=y1,A1=[x11], B2=y2, A2=[x21], . . . ,

and the solution X is[αh]T. 

In the domain of motion detection, Bs are 2×1 vectors, Xs are 4×1 vectors, As are 4×2 matrices with full rank, and every data item provides two equations, B1, B2, . . . , taking the form of [u1v1]T, [u2v2]T, . . . This input data are the pixel motion vectors. In one embodiment, the pixel motion vectors may be determined by preprocessing operations such as edge detection and intensity matching of the edge pixels. For example, the analysis for each frame pair may start by matching edge pixels in a pair of consecutive frames, whereby each edge pixel match contributes a data item in the data item pool. The data pool could be corrupted by a large proportion of mismatches that originate from image noises, as well as the matching uncertainty well known to those of ordinary skill in the art.
Here, A1T, A2Ttake the form of




  
    
      
        
          [
          
            
              
                1
              
              
                0
              
              
                
                  p
                  
                    x
                    ,
                    1
                  
                
              
              
                
                  p
                  
                    y
                    ,
                    1
                  
                
              
            
            
              
                0
              
              
                1
              
              
                
                  p
                  
                    y
                    ,
                    1
                  
                
              
              
                
                  -
                  
                    p
                    
                      x
                      ,
                      1
                    
                  
                
              
            
          
          ]
        
        ,
        
          [
          
            
              
                1
              
              
                0
              
              
                
                  p
                  
                    x
                    ,
                    2
                  
                
              
              
                
                  p
                  
                    y
                    ,
                    2
                  
                
              
            
            
              
                0
              
              
                1
              
              
                
                  p
                  
                    y
                    ,
                    2
                  
                
              
              
                
                  -
                  
                    p
                    
                      x
                      ,
                      2
                    
                  
                
              
            
          
          ]
        
      
    
    
      
        (
        3
        )
      
    
  




where the (px,py) are the image coordinates of the edge pixels. The solution Xis a four-dimensional global motion vector [T1T2T3T4]T that describes the horizontal and vertical shifting, scaling and rotating motion of components of a motion model.

FIG. 1B illustrates a process flow to determine the solution X according to one embodiment. At block 210, a data item is randomly chosen. This data item is designated as a two-dimensional plane primary data item i.e., Bk=AkT X. At block 220, the solution subspace in the parameter domain corresponding to the PDI is a two-dimensional plane. Therefore, a two-dimensional voting array is formed having the elements set to zero. At block 230, the intersections are computed between the PDI and every other data item (e.g., B1=A1TX). The intersection X may be defined as:




  
    
      
        X
        =
        
          
            
              
                [
                
                  
                    
                      
                        A
                        k
                        T
                      
                    
                  
                  
                    
                      
                        A
                        l
                        T
                      
                    
                  
                
                ]
              
              
                -
                1
              
            
            ⁡
            
              [
              
                
                  
                    
                      B
                      k
                    
                  
                
                
                  
                    
                      B
                      l
                    
                  
                
              
              ]
            
          
          .
        
      
    
    
      
        (
        4
        )
      
    
  




Also, computed, at block 230, are the internal coordinates of the intersections in the two-dimensional solution subspace defined by the PDI. Again, the internal coordinates are computed from the four-dimensional point, X, which is an intersection between the PDI and another data item, and X is in the two-dimensional plane defined by the PDI equation Bk=AkTX, (because X is an intersection involving this PDI). The internal two-dimensional coordinate x may be obtained by calculating:

x=F+CTX,   (5)

where F is a 2×1 vector, and C is a 4×2 matrix that is given by the right half of the S matrix of the singular value decomposition of Ak defined as:





  
    
      
        
          A
          k
        
        =
        
          
            svd
            ⁡
            
              (
              
                A
                k
              
              )
            
          
          =
          
            
              SVD
              t
            
            =
            
              
                
                  [
                  
                    
                      C
                      1
                    
                    ⁢
                    C
                  
                  ]
                
                ⁡
                
                  [
                  
                    
                      
                        v
                      
                    
                    
                      
                        0
                      
                    
                  
                  ]
                
              
              ⁢
              
                D
                T
              
            
          
        
      
    
    
      
        (
        6
        )
      
    
  




where C1 is a 4×2 matrix that is given by the left half of the S matrix, and V is an orthogonal 4×2 matrix with v being a 2×2 diagonal matrix of the singular values of Ak.

In one embodiment, for computational convenience, F is chosen so that the two-dimensional internal coordinate of the projection of




  
    [
    
      
        
          0
        
      
      
        
          0
        
      
      
        
          0
        
      
      
        
          0
        
      
    
    ]
  
  ⁢
  
    
  
  ⁢
  
    
      is
      ⁢
      
        
      
      [
      
        
          
            0
          
        
        
          
            0
          
        
      
      ]
    
    .
  




Accordingly, F is chosen as





  
    [
    
      
        
          0
        
      
      
        
          0
        
      
    
    ]
  
  .




In one embodiment, equation (5) generates internal coordinates because its results satisfy the following condition:

(X1−X2)T(X1−X2)=(x1−x2)T(x1−x2),  (7)

where X1 and X2 are arbitrary four-dimensional points that both satisfy Bk=AkTX.

Each intersection between the PDI and another data item generates a vote. Each vote is weighted by the orthogonality of the intersection that is a function of the intersection angle between the intersecting data items. The votes occur to the internal coordinates in the two-dimensional voting array.
In one embodiment, the votes of the more perpendicular intersections are weighed more. The weight of the intersection between the PDI, Bk=AkTX and another data item, Bl=AlTX is given by the absolute value of the determinant of the matrix




  
    [
    
      
        
          
            A
            k
            T
          
        
      
      
        
          
            A
            l
            T
          
        
      
    
    ]
  
   




defined as:





  
    
      
        weight
        =
        
          
            
            
              det
              ⁡
              
                [
                
                  
                    
                      
                        A
                        k
                        T
                      
                    
                  
                  
                    
                      
                        A
                        l
                        T
                      
                    
                  
                
                ]
              
            
            
          
          .
        
      
    
    
      
        (
        8
        )
      
    
  




Therefore, by combining equations (4) and (5), x may be defined as:




  
    
      
        x
        =
        
          F
          +
          
            
              
                
                  
                    C
                    T
                  
                  ⁡
                  
                    [
                    
                      
                        
                          
                            A
                            k
                            T
                          
                        
                      
                      
                        
                          
                            A
                            l
                            T
                          
                        
                      
                    
                    ]
                  
                
                
                  -
                  1
                
              
              ⁡
              
                [
                
                  
                    
                      
                        B
                        k
                      
                    
                  
                  
                    
                      
                        B
                        l
                      
                    
                  
                
                ]
              
            
            .
          
        
      
    
    
      
        (
        9
        )
      
    
  




which is used to calculate the internal two-dimensional coordinate for every data item except the PDI.

At block 240, the voting array is filtered and the global maximum is located. The global maximum being the coordinates of the slot that collects the most votes. The global maximum is converted to the four-dimensional solution X.
In one embodiment, converting two-dimensional internal coordinates into four-dimensional coordinates assume that {circumflex over (x)} is the two-dimensional set of the slot that collects the most votes, where the corresponding four-dimensional coordinate {circumflex over (X)} is given by solving the equations:




  
    
      
        {
        
          
            
              
                
                  x
                  ^
                
                =
                
                  F
                  +
                  
                    
                      C
                      
                        
                          
                        
                        ⁢
                        T
                      
                    
                    ⁢
                    
                      X
                      ^
                    
                  
                
              
            
          
          
            
              
                
                  
                    B
                    k
                  
                  =
                  
                    
                      A
                      k
                      T
                    
                    ⁢
                    
                      X
                      ^
                    
                  
                
                ⁢
                
                  
                
              
            
          
        
      
    
    
      
        (
        10
        )
      
    
  








  
    
      
        
          X
          ^
        
        =
        
          
            
              
                [
                
                  
                    
                      
                        C
                        T
                      
                    
                  
                  
                    
                      
                        A
                        k
                        T
                      
                    
                  
                
                ]
              
              
                -
                1
              
            
            ⁡
            
              [
              
                
                  
                    
                      
                        x
                        ^
                      
                      -
                      F
                    
                  
                
                
                  
                    
                      B
                      
                        k
                        ⁢
                        
                          
                        
                      
                    
                  
                
              
              ]
            
          
          .
        
      
    
    
      
        (
        11
        )
      
    
  




At block 250, the data item, which is substaintually perpendicular to the PDI, and whose intersection is closest to the global maximum point, is chosen as the next PDI (at block 260). The process iterates until maximum points converge to a popular solution in the parameter space.
It should be appreciated that since the dimensions of the data items and the solutions are doubled compared to the implementation for line-detection, the solution subspace in the parameter domain corresponding to a PDI is a two-dimensional plane. Therefore, a two-dimensional voting array may be used to perform motion analysis in video, and not a four-dimensional voting array as used by conventional applications of video motion analysis.
Furthermore, an alternative embodiment to the process flow implementation to estimate global motions, as described above, may define simplified equations for C, x, weight, and X, given the A matrices in equation (2) are defined with the format of




  
    [
    
      
        
          1
        
        
          0
        
      
      
        
          0
        
        
          1
        
      
      
        
          
            p
            x
          
        
        
          
            p
            y
          
        
      
      
        
          
            p
            y
          
        
        
          
            -
            
              p
              x
            
          
        
      
    
    ]
  
  .




The top half is a 2×2 identity matrix, the bottom half is created by two variables, px and py. Assuming that the PDI equation is Bk=AkTX, where





  
    
      (
      
        
          A
          k
        
        =
        
          [
          
            I
            ⁢
            
              
            
            ⁢
            
              
                A
                ~
              
              k
            
          
          ]
        
      
      )
    
    T
  
  ,
  
    i
    .
    e
    .
  
  ,
  
    
  
  ⁢
  
    
      
        A
        ~
      
      k
    
    =
    
      
        [
        
          
            
              
                p
                
                  x
                  ,
                  k
                
              
            
            
              
                p
                
                  y
                  ,
                  k
                
              
            
          
          
            
              
                p
                
                  y
                  ,
                  k
                
              
            
            
              
                -
                
                  p
                  
                    x
                    ,
                    k
                  
                
              
            
          
        
        ]
      
      .
    
  




(px,k,py,k) is the location of PDI's corresponding edge pixel, for example. This alternative embodiment also assumes that the other data item's equation is B1=A1TX, where A1=[IÃ1]T and





  
    
      A
      ~
    
    t
  
  =
  
    
      [
      
        
          
            
              p
              
                x
                ,
                l
              
            
          
          
            
              p
              
                y
                ,
                l
              
            
          
        
        
          
            
              p
              
                y
                ,
                l
              
            
          
          
            
              -
              
                p
                
                  x
                  ,
                  l
                
              
            
          
        
      
      ]
    
    .
  




Given these assumptions in this alternative embodiment, the C matrix in equations (5), (9), and (11) may be alternatively redefined as:





  
    
      
        C
        =
        
          
            1
            
              
                a
                k
              
            
          
          ⁡
          
            [
            
              
                
                  
                    -
                    
                      
                        A
                        ~
                      
                      k
                    
                  
                
              
              
                
                  
                    I
                    ⁢
                    
                      
                    
                  
                
              
            
            ]
          
        
      
    
    
      
        (
        12
        )
      
    
  




where ak=1+px,k2+py,k2. Accordingly, equation (5) may be alternatively redefined as:





  
    
      
        x
        =
        
          F
          +
          
            
              
                1
                
                  
                    a
                  
                  k
                
              
              ⁡
              
                [
                
                  
                    
                      
                        -
                        
                          
                            A
                            ~
                          
                          k
                        
                      
                    
                  
                  
                    
                      
                        I
                        ⁢
                        
                          
                        
                      
                    
                  
                
                ]
              
            
            ⁢
            
              X
              .
            
          
        
      
    
    
      
        (
        13
        )
      
    
  




In addition, when setting F as




  
    [
    
      
        
          0
        
      
      
        
          0
        
      
    
    ]
  
  ,




equation (9) may be alternatively redefined as:





  
    
      
        
          x
          =
          
            
              1
              
                
                  a
                
                k
              
            
            ⁡
            
              [
              
                
                  
                    
                      a
                      k
                    
                    
                      b
                      
                        k
                        ,
                        l
                      
                    
                  
                  ⁢
                  
                    (
                    
                      
                        
                          A
                          ~
                        
                        k
                      
                      -
                      
                        
                          A
                          ~
                        
                        l
                      
                    
                    )
                  
                  ⁢
                  
                    (
                    
                      
                        B
                        k
                      
                      -
                      
                        B
                        l
                      
                    
                    )
                  
                
                -
                
                  
                    
                      A
                      ~
                    
                    k
                  
                  ⁢
                  
                    B
                    k
                  
                
              
              ]
            
          
        
        ,
      
    
    
      
        (
        14
        )
      
    
  




where bk,l=(px,k−px,l)2+(py,k−py,l)2.

Furthermore, equation (8) may also be alternatively redefined as,

weight=bk,l.  (15)

Therefore, equation (11) may also be alternatively redefined as,




  
    
      
        
          X
          ^
        
        =
        
          
            [
            
              
                
                  
                    
                      
                        
                          -
                          
                            
                              A
                              ~
                            
                            k
                            T
                          
                        
                        ⁢
                        
                          x
                          ^
                        
                      
                      
                        
                          a
                        
                        k
                      
                    
                    +
                    
                      
                        B
                        k
                      
                      
                        a
                        k
                      
                    
                  
                
              
              
                
                  
                    
                      
                        x
                        ^
                      
                      
                        
                          a
                        
                        k
                      
                    
                    +
                    
                      
                        
                          
                            A
                            ~
                          
                          k
                          T
                        
                        ⁢
                        
                          B
                          k
                        
                      
                      
                        a
                        k
                      
                    
                  
                
              
            
            ]
          
          .
        
      
    
    
      
        (
        16
        )
      
    
  




It should be appreciated that equation (16) does not have a 4×4 matrix operation. Therefore, the most complex operation in calculating the popular solution is merely the multiplication of a 2×2 matrix and a 2×1 vector, according to one embodiment.
FIGS. 2A and 2B illustrate yet another embodiment of motion analysis of video frames using an implementation of Hough transform. Comparing FIGS. 1A–B with FIGS. 2A–B illustrate that in this embodiment the primary data items as shown in FIGS. 1A–B are replaced with detectors as shown in FIGS. 2A–B. Furthermore, instead of computing intersections as in FIG. 1B, in this embodiment, projections of the data items on the detector are computed in FIG. 2B. Therefore, detectors are attracted to a solution, as will be described.
As in the previously described approach, the motion analysis problem can be generalized. Given a data pool:




   
  
    
      
        
          
            
              
                
                  B
                  1
                
                =
                
                ⁢
                
                  
                    A
                    1
                    T
                  
                  ⁢
                  X
                
              
            
          
          
            
              
                
                  B
                  2
                
                =
                
                ⁢
                
                  
                    A
                    2
                    T
                  
                  ⁢
                  X
                
              
            
          
          
            
              
                
                ⁢
                ⋮
              
            
          
          
            
              
                
                  B
                  N
                
                =
                
                ⁢
                
                  
                    A
                    N
                    T
                  
                  ⁢
                  X
                
              
            
          
        
      
      
        
          (
          17
          )
        
      
    
  




where Bs are 2×1 vectors, Xs are 4×1 vectors, and As are 4×2 matrices with full rank, the detection problem is to determine the most popular solutions X1, X2, . . . supported by the data item equations (17). A video motion analysis data pool consists of thousands of two equation/four-unknown data items. In the four-dimensional parameter space, each data item defines a two-dimensional plane. Again, the task is to find the most popular intersection points of these two-dimensional planes. However, in this embodiment, one-dimensional straight lines are used instead of the two-dimensional PDI plane as described in the previous embodiment. A one-dimensional straight line like this is called a detector.

FIG. 2A illustrates a process flow for performing motion analysis on video frames according to one embodiment. In FIG. 2A, given a set of data items (at block 310), a motion model is located in a video frame (at block 320). At block 330, the data items fitting the motion model are removed. This locating and removing process is repeated until the last motion model has been found (block 340). It may be assumed that all the motion models have been found if the termination criterion is satisfied. For example, the termination criteria may be specified as the number of prominent motion model to be detected, or the percentage of the data items to be removed, among other examples.
FIG. 2B illustrates a process flow for locating a motion model in video frames (as in block 320), according to one embodiment. In FIG. 2B, at block 410, three non-parallel straight lines are randomly chosen and the third line is selected as the current detector. At block 420, a one-dimensional voting array is generated to map the solution subspace defined by the detector. This procedure assumes that the detector is described by a straight line X0+x{right arrow over (O)}, where X0 is a fixed point the line goes through, {right arrow over (O)} is the orientation of the line, which is a normalized four-dimensional vector, and x is a varying scalar that can be seen as the internal coordinate of each point on the detector. For example, the internal coordinate x of X0 is 0.
Given a data item corresponds to a two-dimensional plane defined by the equations Bk=AkTX, the internal coordinate x of its projection on the detector may be obtained by calculating

x=[{right arrow over (O)}TAk(AkTAk)−1AkT{right arrow over (O)}]−1[{right arrow over (O)}TAk(AkTAk)−1(Bk−AkTX0)]  (18)

At block 430, data item projections are computed by equation 18, and used for voting. Unlike the previous embodiment, an intersection point may not be found in the four-dimensional parameter space between the one-dimensional detector and a data item because a one-dimensional straight line provides three equations. Together with the two equations given by the data item, a total of five equations over-constraint a solution in a four-dimensional space. Therefore, the data item's projection on the detector is computed instead of the intersection. That is, a point on the detector needs to be found that is closest to the data item two-dimensional plane. The vote is weighed by the angle between the data item Bk=AkTX and the detector X0+x{right arrow over (O)}. Here, more weight is put on the data item with an angle closer to a right angle.
In this embodiment, the angle θ is computed as:

θ=arccos ({right arrow over (O)}TC2C2T{right arrow over (O)}),  (19)

where C2 is the right half of S matrix that is produced by the singular value decomposition of AkT.

In addition, a vote cast by each data item is weighed by the distance between the data item and the detector. Here, more weight is put on the data item with the shorter distance. In one embodiment, this distance is defined as the shortest distance between an arbitrary point in the data item (a two-dimensional plane) Bk=AkTX and an arbitrary point in the detector (a one-dimensional line) X0+x{right arrow over (O)}.
In this embodiment, a distance r is computed as:

r={[Bk−Ak(X0+x{right arrow over (O)})]T(AkTAk)−1[Bk−Ak(X0+x{right arrow over (O)}]}1/2  (20)

where, x is given by equation (18).

At block 440, the global maximum in the voting array is located. The maximum in the voting array reveals the place on the detector where the data item projections are dense.
Until the motion model is located in the image space (at block 450), a new detector is chosen at the end of each iteration (at block 460), that goes through the point of the densest data item projection on the old detector, and is substantially perpendicular to the old detector. This problem can be stated as, given a fixed point X0,new and three old detectors, X0,a+x{right arrow over (O)}a, X0,b+x{right arrow over (O)}b, and X0,c+x{right arrow over (O)}c; where a new detector needs to be found, X0,new+x{right arrow over (O)}new, so that {right arrow over (O)}new is perpendicular to {right arrow over (O)}a, {right arrow over (O)}b, and {right arrow over (O)}c. It is assumed that {right arrow over (O)}a, {right arrow over (O)}b, and {right arrow over (O)}c are non-paralleled orientations. Here, two different equations may be used to compute {right arrow over (O)}new.
Performing a singular value decomposition on the matrix └{right arrow over (O)}a {right arrow over (O)}b {right arrow over (O)}c┘ forms a 4×3 matrix using the first equation as,

SVDT=svd([{right arrow over (O)}a{right arrow over (O)}b{right arrow over (O)}c])  (21)

where {right arrow over (O)}new can be chosen as the left most column of the S matrix.

Alternatively, a second equation may be used to compute {right arrow over (O)}new. Removing the first row of [{right arrow over (O)}a {right arrow over (O)}b {right arrow over (O)}c] gives a 3×3 matrix Θ1; removing the second row, instead of the first row, gives a 3×3 matrix Θ2; Similarly, removing only the third row gives a matrix Θ3; and finally by removing only the fourth row, one has a matrix Θ4. Computing the determinants of these 3×3 matrices produces a vector:




  
    
      
        
          
            O
            ~
          
          new
        
        =
        
          
            [
            
              
                
                  
                    det
                    ⁢
                    
                      
                    
                    ⁢
                    
                      (
                      
                        Θ
                        1
                      
                      )
                    
                  
                
              
              
                
                  
                    det
                    ⁢
                    
                      
                    
                    ⁢
                    
                      (
                      
                        Θ
                        2
                      
                      )
                    
                  
                
              
              
                
                  
                    det
                    ⁢
                    
                      
                    
                    ⁢
                    
                      (
                      
                        Θ
                        3
                      
                      )
                    
                  
                
              
              
                
                  
                    det
                    ⁢
                    
                      
                    
                    ⁢
                    
                      (
                      
                        Θ
                        4
                      
                      )
                    
                  
                
              
            
            ]
          
          .
        
      
    
    
      
        (
        22
        )
      
    
  




where {right arrow over (O)}new is determined by normalizing Õnew:

{right arrow over (O)}new=Õnew/(ÕnewTÕnew)1/2.  (23)

It is well known that in the four-dimensional space, up to three unparallel orientations are needed to define a unique perpendicular orientation. In this embodiment, the three most recent detectors are used in choosing the new detector. For example, before the first iteration, three non-parallel straight lines, A, B and C are randomly chosen. C is used as the first detector in the first iteration. At the end of the iteration, a new detector, D is chosen which is perpendicular to A, B and C. At the end of second iteration, the new detector E is chosen that is perpendicular to B, C and D. Similarly, the third iterations yield a new detector F that is perpendicular to C, D and E. Hence, the iterations are repeated using a new detector each time that is perpendicular to the three most recent detectors.
In the motion analysis problem, computations for video motion analysis may be simplified, given the matrices in the data pool (17) having the format of




  
    [
    
      
        
          1
        
        
          0
        
      
      
        
          0
        
        
          1
        
      
      
        
          
            p
            x
          
        
        
          
            p
            y
          
        
      
      
        
          
            p
            y
          
        
        
          
            -
            
              p
              x
            
          
        
      
    
    ]
  
  .




The top half being a 2×2 identity matrix, the bottom half created by only two variables, px and py. Taking this format into account, the computations of x, r and θ, as discussed may be simplified, where the elements in vector Bk, X0 and {right arrow over (O)} are defined as:





  
    
      
        
          
            B
            k
          
          =
          
            [
            
              
                
                  
                    b
                    
                      k
                      ,
                      1
                    
                  
                
              
              
                
                  
                    b
                    
                      k
                      ,
                      2
                    
                  
                
              
            
            ]
          
        
        ,
        
          
            X
            o
          
          =
          
            
              
                [
                
                  
                    
                      
                        x
                        
                          0
                          ,
                          1
                        
                      
                    
                  
                  
                    
                      
                        x
                        
                          0
                          ,
                          2
                        
                      
                    
                  
                  
                    
                      
                        
                          
                        
                        ⁢
                        
                          x
                          
                            0
                            ,
                            3
                          
                        
                      
                    
                  
                  
                    
                      
                        x
                        
                          0
                          ,
                          4
                        
                      
                    
                  
                
                ]
              
              ⁢
              
                
              
              ⁢
              and
              ⁢
              
                
              
              ⁢
              
                O
                ⇀
              
            
            =
            
              [
              
                
                  
                    
                      o
                      1
                    
                  
                
                
                  
                    
                      o
                      2
                    
                  
                
                
                  
                    
                      o
                      3
                    
                  
                
                
                  
                    
                      o
                      4
                    
                  
                
              
              ]
            
          
        
      
    
    
      
        (
        24
        )
      
    
  




and seven temporary variables are defined as:

d0=1+px2+py2,

d1=o1+pxo3+pyo4,

d2=o2+pyo3−pxo4,

d3=bk,1−x0,1−pxx0,3−pyx0,4,

d4=bk,2−x0,2−pyx0,3+pxx0,4,

d5=−pxo1−pyo2+o3,

d6=−pyo1+pxo2+o4.  (25)

Therefore, x in equation (18) is defined by:





  
    
      
        x
        =
        
          
            
              
                d
                1
              
              ⁢
              
                d
                3
              
            
            +
            
              
                d
                2
              
              ⁢
              
                d
                4
              
            
          
          
            
              d
              1
              2
            
            +
            
              d
              2
              2
            
          
        
      
    
    
      
        (
        26
        )
      
    
  




r in equation (20) is defined by:





  
    
      
        r
        =
        
          
            [
            
              
                
                  
                    (
                    
                      
                        d
                        3
                      
                      -
                      
                        xd
                        1
                      
                    
                    )
                  
                  2
                
                +
                
                  
                    (
                    
                      
                        d
                        4
                      
                      -
                      
                        xd
                        2
                      
                    
                    )
                  
                  2
                
              
              
                d
                0
              
            
            ]
          
          
            1
            /
            2
          
        
      
    
    
      
        (
        27
        )
      
    
  




and, θ in equation (19) is defined by:





  
    
      
        θ
        =
        
          arccos
          ⁡
          
            (
            
              
                
                  d
                  5
                  2
                
                +
                
                  d
                  6
                  2
                
              
              
                d
                0
              
            
            )
          
        
      
    
    
      
        (
        28
        )
      
    
  




Thus, an alternative implementation of Hough transform to perform motion analysis on video frames is described using one-dimensional detectors instead of four-dimensional primary data items. In this way, additional memory is further saved in this implementation, because the one-dimensional memory array is used to map a detector, instead of the two-dimensional voting array for a PDI or the four-dimensional voting array in conventional implementations. It should also be appreciated that since the voting array is one-dimensional, the filtering, and maximum locating operations are simpler. That is, since the filtering and maximum locating are performed on a one-dimensional voting array, rather than a two-dimensional voting array as in the previous embodiment, the computation is simpler.
One embodiment of a computer system suitable for performing the implementations of Hough transform disclosed above is illustrated in FIG. 4. The computer system 640, includes a processor 650, memory 655 and input/output capability 660 coupled to a system bus 665. The memory 655 is configured to store instructions which, when executed by the processor 650, perform the methods described herein. The memory 655 may also store the one-dimensional voting arrays, one-dimensional detectors, and two-dimensional primary data items, as disclosed. Input/output 660 provides for the delivery and display of the video content or portions or representations thereof. Input/output 660 also encompasses various types of computer-readable media, including any type of storage device that is accessible by the processor 650. One of skill in the art will immediately recognize that the term “computer-readable medium/media” further encompasses a carrier wave that encodes a data signal. It will also be appreciated that the computer system 640 is controlled by operating system software executing in memory 655.
It should be appreciated that more or fewer processes may be incorporated into the method(s) illustrated in FIGS. 1A–B and 2A–B without departing from the scope of the invention and that no particular order is implied by the arrangement of blocks shown and described herein. It should be further appreciated that the method(s) described in conjunction with FIGS. 1A–B and 2A–B may be embodied in machine-executable instructions, e.g. software. The instructions can be used to cause a general-purpose or special-purpose processor that is programmed with the instructions to perform the operations described. Alternatively, the operations might be performed by specific hardware components that contain hardwired logic for performing the operations, or by any combination of programmed computer components and custom hardware components. The methods may be provided as a computer program product that may include a machine-readable medium having stored thereon instructions which may be used to program a computer (or other electronic devices) to perform the methods. For the purposes of this specification, the terms “machine-readable medium” shall be taken to include any medium that is capable of storing or encoding a sequence of instructions for execution by the machine and that cause the machine to perform any one of the methodologies of the present invention. The term “machine-readable medium” shall accordingly be taken to included, but not be limited to, solid-state memories, optical and magnetic disks, and carrier wave signals. Furthermore, it is common in the art to speak of software, in one form or another (e.g., program, procedure, process, application, module, logic . . . ), as taking an action or causing a result. Such expressions are merely a shorthand way of saying that execution of the software by a computer causes the processor of the computer to perform an action or produce a result.
It should be appreciated by one of ordinary skill in the art that in the process flow of FIGS. 1A–B and 2A–B, once a motion model is found in a frame, it may be saved for comparison with a subsequent frame to perform motion analysis. Furthermore, it should also be understood that although the invention has been described to perform line detection, and motion analysis, for the purpose of detecting lines in an image, or finding global motion models for motion-based video segmentation, alternative embodiments of the described implementation of Hough transform may be applied in tasks such as MPEG4 video compression (Motion Picture Experts Group video compression), robotic vision, image comparing and object recognition, as well as other applications well known to those of ordinary skill in the art, which may use a parameter estimator for multi-dimensional features.
While the invention has been described in terms of several embodiments, those skilled in the art will recognize that the invention is not limited to the embodiments described. The method and apparatus of the invention can be practiced with modification and alteration within the scope of the appended claims. The description is thus to be regarded instead of limiting on the invention.

## Claims

1. A method of detecting one or more lines in an image comprising:
selecting a primary data item from feature points in an image space, the feature points defining one-dimensional P-lines in a corresponding parameter space;
mapping the P-line of the primary data item with a one-dimensional voting array in the parameter space;
locating one or more intersections between the P-line corresponding to the primary data item and P-lines corresponding to the other feature points, each intersection represented by a cell in the voting array;
establishing an I-line in the image space corresponding to a location in the parameter space where the intersections substantially converge; and
identifying, as a subsequent primary data item, a feature point corresponding to a P-line that is substantially perpendicular to the P-line of a current primary data item and further intersects the P-line of the current primary data item substantially close to a cell in the voting array associated with a global maximum vote.

2. The method of claim 1, wherein the establishing the I-line in the image space includes identifying a location in the parameter space where the intersections substantially converge with a cell in the voting array associated with a global maximum vote.

3. The method of claim 1, further comprising:
removing the feature points from the image space fitting the I-line.

4. A system comprising:
a processor coupled to a memory through a bus; and
a detection process executed from the memory by the processor to cause the processor to select a primary data item from feature points in an image space, the feature points defining one-dimensional P-lines in a corresponding parameter space, map the P-line of the primary data item with a one-dimensional voting array in the parameter space, locate one or more intersections between the P-line corresponding to the primary data item and P-lines corresponding to the other feature points, each intersection represented by a cell in the voting array, establish an I-line in the image space corresponding to a location in the parameter space where the intersections substantially converge, and identify, as a subsequent primary data item, a feature point corresponding to a P-line that is substantially perpendicular to the P-line of a current primary data item and further intersects the P-line of the current primary data item substantially close to a cell in the voting array associated with a global maximum vote.

5. The system of claim 4, wherein the detection process further causes the processor, when establishing the I-line in the image space, to identify a location in the parameter space where the intersections substantially converge with a cell in the voting array associated with a global maximum vote.

6. The system of claim 4, wherein the detection process further causes the processor to remove the feature points from the image space fitting the I-line.

7. A system comprising:
a means for processing coupled to a means for storing instructions for the means for processing through a means for communicating; and
a detection process executed from the means for storing by the means for processing to cause the means for processing to select a primary data item from feature points in an image space, the feature points defining one-dimensional P-lines in a corresponding parameter space, map the P-line of the primary data item with a one-dimensional voting array in the parameter space, locate one or more intersections between the P-line corresponding to the primary data item and P-lines corresponding to the other feature points, each intersection represented by a cell in the voting array, establish an I-line in the image space corresponding to a location in the parameter space where the intersections substantially converge, and identify, as a subsequent primary data item, a feature point corresponding to a P-line that is substantially perpendicular to the P-line of a current primary data item and further intersects the P-line of the current primary data item substantially close to a cell in the voting array associated with a global maximum vote.

8. The system of claim 7, wherein the detection process further causes the means for processing, when establishing the I-line in the image space, to identify a location in the parameter space where the intersections substantially converge with a cell in the voting array associated with a global maximum vote.

9. The system of claim 7, wherein the detection process further causes the means for processing to remove the feature points from the image space fitting the I-line.

10. A computer-readable medium encoded with computer-executable instructions to cause a computer to perform a method of detecting one or more lines in an image, the method comprising:
selecting a primary data item from feature points in an image space, the feature points defining one-dimensional P-lines in a corresponding parameter space;
mapping the P-line of the primary data item with a one-dimensional voting array in the parameter space;
locating one or more intersections between the P-line corresponding to the primary data item and P-lines corresponding to the other feature points, each intersection represented by a cell in the voting array;
establishing an I-line in the image space corresponding to a location in the parameter space where the intersections substantially converge; and
identifying, as a subsequent primary data item, a feature point corresponding to a P-line that is substantially perpendicular to the P-line of a current primary data item and further intersects the P-line of the current primary data item substantially close to a cell in the voting array associated with a global maximum vote.

11. The computer-readable medium of claim 10, wherein the establishing the I-line in the image space includes identifying a location in the parameter space where the intersections substantially converge with a cell in the voting array associated with a global maximum vote.

12. The computer readable medium of claim 10, further comprising: removing the feature points from the image space fitting the I-line.