Abstract:
A method of determining an edge of an object on a digital image sequence comprising the step of determining a first gradient direction profile of a first image in the digital image sequence; determining a second gradient direction profile of a second image in the digital image sequence; computing a differential profile based on the first gradient direction profile and the second gradient direction profile; and determining the edge of the object based on the differential profile wherein the differential profile registers gradient magnitudes of the second gradient direction profile and angular differences between the first gradient direction profile and the second gradient direction profile. A system thereof is also disclosed.

Description:
FIELD OF INVENTION 
     This invention relates to the field of detection, particularly detecting an edge of an object in a digital image. 
     BACKGROUND OF INVENTION 
     Edge detection is a basic but important procedure in computer graphics and image processing. It is used to detect the boundaries of an object in a digital image. Hence a reliable edge detection algorithm is much needed for any high level object recognition or similar image processing tasks. Almost all edge detection methods are essentially differential operators. They compute the intensity difference along a certain direction within a small neighborhood surrounding a pixel, and declare that an edge is found if the absolute difference exceeds a certain threshold. In many image processing/object recognition tasks, one side of the edge boundary is usually the background lighting while the other side is an object to be detected. When the background light intensity varies, it will affect the absolute difference. If the absolute difference is below the threshold, then the valid edge of the object will not be detected. If it is above the threshold, noisy signals will be detected as edges, creating many false edges. Hence it is technically challenging to develop a reliable edge detection algorithm under non-uniform background lighting condition. 
     One approach is to neutralize the background intensity variation by, for example, obtaining a profile of the non-uniform background intensity and then performing some sort of ‘equalizer’ operation to counter the non-uniformity effect. However, when the background light intensity varies over time and/or is not under the control of the image processing system, such approach would require re-calibrating the background intensity periodically. This is clearly not desirable. 
     SUMMARY OF INVENTION 
     In the light of the foregoing background, it is an object of the present invention to provide an alternative method and a system for detecting an edge of an object on a screen that is immune from background intensity changes. The method and system of the present invention is simple, accurate and easy to be implemented. 
     Accordingly, the present invention, in one aspect, is a method of determining an edge of an object on a digital image sequence comprising the steps of determining a first gradient direction profile of a first image in the digital image sequence; determining a second gradient direction profile of a second image in the digital image sequence; computing a differential profile based on the first gradient direction profile and the second gradient direction profile; and determining the edge of the object based on the differential profile wherein the differential profile registers gradient magnitudes of the second gradient direction profile and angular differences between the first gradient direction profile and the second gradient direction profile. The physical meaning of this method is to detect edge of the object in the direction with least possible background edge. 
     In one embodiment, the method further comprises the steps of capturing the first image wherein the object is not present in the digital image and capturing the second image wherein the object is present in the digital image. 
     In another embodiment, the first gradient direction profile and the second gradient direction profile are determined by computing a first gradient vector indicating a change of intensity for each pixel in the first image and a second gradient vector indicating a change of intensity for each pixel in the second image respectively. 
     In another embodiment, the step of computing the first gradient vector and the second gradient vector further comprises a step of obtaining a vector sum of a first directional derivative of intensity and a second directional derivative of intensity for each of the pixel in corresponding image; wherein the first directional derivative of intensity and the second directional derivative of intensity are perpendicular to each other. 
     In another embodiment, the first directional derivative of intensity is computed by convolving a first edge operator with each of the pixel in the corresponding image and the second directional derivative of intensity is computed by convolving a second edge operator with each of the pixel of the corresponding image. 
     In another embodiment, the first directional derivative of intensity is an x-directional derivative and the first edge operator is an x-direction edge detector; and the second directional derivative of intensity is a y-directional derivative and the second edge operator is a y-direction edge detector. 
     In another embodiment, the step of obtaining the differential profile further comprises the steps of computing a tangent of the first gradient vector; projecting the second gradient vector to the tangent; and calculating an absolute magnitude of the projection on the tangent. 
     In another embodiment, the projecting step further comprises the steps of finding a first component value by projecting an x-component of the second gradient vector onto the tangent; and finding a second component value by projecting a y-component of the second gradient vector onto the tangent wherein the absolute magnitude is calculated by computing an absolute difference of the first component value and the second component value. 
     In another embodiment, the edge of the object comprises a plurality of edge-pixels and the step of determining the edge of the object further comprises a step of declaring each pixel in the second image being an edge-pixel if the absolute magnitude calculated at that pixel is higher than a predefined threshold. 
     In another embodiment, the predefined threshold is one eighth of the mean intensity of all pixels in the second image. 
     In another embodiment, the method further comprising the steps of correcting geometric distortions of the first image and the second image; and downsampling the first image and the second image. 
     According to another aspect of the present invention is an interactive projection system comprising at least one light source configured to illuminate a surface; an optical detector configured to capture at least one image of the surface; a microprocessor coupled to the optical detector; and a non-transitory computer-readable storage medium coupled to the microprocessor. The non-transitory computer-readable storage medium encoded with computer-readable instructions for causing the microprocessor to execute the following steps: capturing a first image and a second image using the optical detector; determining a first gradient direction profile of the first image; determining a second gradient direction profile of the second image; computing a differential profile based on the first gradient direction profile and the second gradient direction profile; and determining the edge of the object based on the differential profile wherein the differential profile registers gradient magnitudes of the second gradient direction profile and angular differences between the first gradient direction profile and the second gradient direction profile. 
     In one embodiment, the interactive projection system further comprising a projection module configured to project a display on the surface. 
     In another embodiment, the at least one light source is an infrared light emitting diode configured to emit an infrared light to illuminate the surface. 
     In another embodiment, the wavelength of the infrared light is in the range of 845 nm to 855 nm. 
     In another embodiment, the optical detector further comprises an infrared bandpass filter. 
     In another embodiment, the infrared bandpass filter is configured to allow light with wavelength of 845 nm to 855 nm to pass through. 
     In another embodiment, the first image comprises a background and the second image comprises the background and the object. 
     In another embodiment, the non-transitory computer-readable storage medium is further encoded with computer-readable instructions for causing the microprocessor to execute the following steps: correcting geometric distortions of the first image and the second image; and downsampling the first image and the second image. 
     In another embodiment, the light source and the optical detector are substantially adjacent to each other. 
     There are many advantages to the present invention. In particular, the present invention is self-adapting to background light intensity variation. For example, the change of illumination may be caused by the drastic temperature increase or decrease of the system for automotive application. With the present invention, the need for periodic re-calibration is eliminated. Furthermore, the computation is much simplified, freeing up valuable computation resources to subsequent, high level tasks. Last but not least, the present edge detection algorithm yields better accuracy in detecting valid edge boundaries. There is hardly any need to perform any erosion and/or dilation operations afterwards to smooth out the edge boundaries or eliminate false detections. 
    
    
     
       BRIEF DESCRIPTION OF FIGURES 
         FIG. 1  is a schematic diagram of the edge detection system according to one of the embodiments of the present invention. 
         FIG. 2  shows a flow chart of an initialization step in the method of detecting an edge of the object on the surface according to one embodiment of the present invention. 
         FIG. 3 a    shows a background image captured by the optical detector at the initialization step according to one of the embodiments of the present invention. 
         FIG. 3 b    is a contour map showing the light intensity variation across the background image according to one of embodiment of the present invention. 
         FIG. 4 a    shows the background gradient direction N and the background tangent direction T of a pixel in the background image according to one embodiment of the present invention. 
         FIG. 4 b    is a contour map showing the background gradient direction N and background tangent direction T of a pixel in the background image according to one embodiment of the present invention. 
         FIG. 5  is a background gradient direction profile showing background gradient directions N and background tangent directions T of a plurality of pixels in the background image according to one embodiment of the present invention. 
         FIG. 6  shows a flow chart of an online step in the method of detecting the edge of the object on the surface according to the first embodiment of the present invention. 
         FIG. 7  is a schematic diagram of a foreground gradient direction at the edge of the object in a foreground image compared to the background gradient direction in a corresponding pixel of the background image according to one of the embodiments of the present invention. 
         FIG. 8 a    is a diagram showing the relationship between a foreground gradient direction vector G f , the background gradient direction vector N and the tangent direction vector T of the same pixel at an edge of the object. 
         FIG. 8 b    is another diagram showing a different relationship between a foreground gradient direction vector G f , the background gradient direction vector N and the tangent direction vector T of the same pixel at an edge of the object. The foreground gradient direction vector G f , is on the other side of the background gradient direction vector N compared to  FIG. 8   a.    
         FIG. 9  shows another flow chart of the online step in the method of detecting an edge of the object on the surface according to second embodiment of the present invention. 
         FIG. 10 a    shows the difference of foreground gradient direction profiles of the background images at different light intensity according to one embodiment of the present invention. 
         FIG. 10 b    shows the difference of background gradient directions of a pixel in the background images taken at different light intensity according to one embodiment of the present invention. 
         FIG. 11  is a schematic diagram of the edge detection system showing different modules according to one of the embodiments of the present invention. 
         FIG. 12  is a schematic diagram of an image projector with the object detection system installed. In particular, the image projector is an interactive projector which has a finger touch detection system installed. 
         FIG. 13 a    shows an image whereby the background image is dim but the light intensity suddenly increases when a finger is presented and  FIG. 13 b    is the corresponding edge boundary profile performed by the edge detection system of the present invention on  FIG. 13   a.    
         FIG. 13 c    shows another image whereby the background image is bright but the light intensity suddenly decreases when a finger is presented and  FIG. 13 d    is the corresponding edge boundary profile performed by the edge detection system of the present invention on  FIG. 13   c.    
     
    
    
     DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS 
     This invention discloses an image processing system capable of identifying the edge boundary of an object in a digital image sequence which is captured from the same view angle. The digital image sequence comprises at least two categories of images. The first category is the background images where the object is not at the scene and is referred to as the first images. The second category is images with the object appeared at the scene and is referred to as the second images or the foreground images. In one embodiment, the background is a surface and the object is on top of the surface. Furthermore, the object may or may not touch the object. 
       FIG. 1  shows a schematic diagram of the edge detection system  20  according to one of the embodiments of the present invention. The edge detection system  20  comprises a light source  22  configured to illuminate a surface  24 , an optical detector  26  configured to capture at least one image of the surface  24 , and a microcomputer  28  connected to the light source  22  and the optical detector  26 . Since the distance between the light source  22  and each point on the surface  24  is different, the light intensity across the surface  24  varies. The microcomputer  28  further comprises a microprocessor  28   a  and a non-transitory computer-readable storage medium  28   b . The microcomputer  28  is configured to control the light source  22  and the optical detector  26  via the microprocessor  28   a  according to the computer-readable instructions encoded in a non-transitory computer-readable storage medium  28   b . The instructions cause the microprocessor  28   a  and thus the microcomputer  28  to execute the steps to be discussed in detail in the edge detection method below. In one embodiment, the light source  22  is an Infrared (IR) light source and the optical detector  26  is a camera that captures infrared (IR) light illuminated on and reflected from the surface  24 . In one further embodiment, the infrared light is in the range of 845 nm to 855 nm and the optical detector  26  comprises an infrared bandpass filter configured to allow light with wavelength of 845 nm to 855 nm to pass through. In another embodiment, the edge detection system  20  comprises a plurality of light sources. In yet another embodiment, the light source  22  and the optical detector  26  are substantially adjacent to each other. 
     Now turning to the operation of the edge detection system  20  described above. It should be noted that the edge detection algorithm disclosed here can accommodate any non-uniform background light intensity. However, in order to simplify the discussion, a single light source is used below that provides an intensity profile as shown in  FIGS. 3 a  and 3 b   . There are two main steps in detecting an edge of an object on a surface, which are the initialization step  100  and the online step  200 . The initialization step  100  is performed once during system initialization time. Its objective is to obtain the background intensity gradient (detailed discussion below) and is performed before the online step  200  commences.  FIG. 2  shows a flow chart of the initialization step  100  which starts from capturing a background image of the surface  24  with non-uniform light intensity in step  30 . After that, a background gradient direction (or gradient vector) N and a background tangent direction (or tangent vector) T are found for each pixel in step  32 . This will be described in detail below. 
       FIGS. 3 a  and 3 b    show the background image captured by the optical detector  26  and a contour map showing the variation of the light intensity across the background image on the surface  24  respectively in step  30 . In this embodiment where there is a single light source  22 , the highest light intensity is located at the upper center part of the background image/surface  24 . This is because that part of the surface  24  has the shortest distance to the light source  22  compared to the other parts of the surface  24 . The light intensity on the background image/surface  24  decreases steadily towards the edges of the background image/surface  24 . All the gradient direction, tangent direction, x-directional derivative and y-directional derivative described herein are based on the light intensity. 
     After the capturing step in step  30 , a background x-directional derivative of intensity G xb  and a background y-directional derivative G yb  of intensity for each pixel are computed. The x-coordinate and the y-coordinate in  FIG. 4 a    are extended along the vertical direction of the image and along the horizontal direction of the background image respectively. The background x-directional derivative G xb  of an interested pixel is determined by convoluting the interested pixel with the pixels immediately surrounding the interested pixel in step  32   a . In one embodiment, it is determined by convoluting the interested pixel with 8 pixels immediately surrounding it. In one further embodiment, the background x-directional derivative G xb  of the interested pixel is obtained by using the following Equation (1): 
     
       
         
           
             
               
                 
                   
                     G 
                     
                       x 
                       ⁡ 
                       
                         ( 
                         
                           i 
                           , 
                           j 
                         
                         ) 
                       
                     
                   
                   = 
                   
                     
                       ( 
                       
                         
                           
                             
                               - 
                               a 
                             
                           
                           
                             
                               - 
                               b 
                             
                           
                           
                             
                               - 
                               a 
                             
                           
                         
                         
                           
                             0 
                           
                           
                             0 
                           
                           
                             0 
                           
                         
                         
                           
                             a 
                           
                           
                             b 
                           
                           
                             a 
                           
                         
                       
                       ) 
                     
                     * 
                     
                       ( 
                       
                         
                           
                             
                               p 
                               
                                 
                                   i 
                                   - 
                                   1 
                                 
                                 , 
                                 
                                   j 
                                   - 
                                   1 
                                 
                               
                             
                           
                           
                             
                               p 
                               
                                 
                                   i 
                                   - 
                                   1 
                                 
                                 , 
                                 j 
                               
                             
                           
                           
                             
                               p 
                               
                                 
                                   i 
                                   - 
                                   1 
                                 
                                 , 
                                 
                                   j 
                                   + 
                                   1 
                                 
                               
                             
                           
                         
                         
                           
                             
                               p 
                               
                                 i 
                                 , 
                                 
                                   j 
                                   - 
                                   1 
                                 
                               
                             
                           
                           
                             
                               p 
                               
                                 i 
                                 , 
                                 j 
                               
                             
                           
                           
                             
                               p 
                               
                                 i 
                                 , 
                                 
                                   j 
                                   + 
                                   1 
                                 
                               
                             
                           
                         
                         
                           
                             
                               p 
                               
                                 
                                   i 
                                   + 
                                   1 
                                 
                                 , 
                                 
                                   j 
                                   - 
                                   1 
                                 
                               
                             
                           
                           
                             
                               p 
                               
                                 
                                   i 
                                   + 
                                   1 
                                 
                                 , 
                                 j 
                               
                             
                           
                           
                             
                               p 
                               
                                 
                                   i 
                                   + 
                                   1 
                                 
                                 , 
                                 
                                   j 
                                   + 
                                   1 
                                 
                               
                             
                           
                         
                       
                       ) 
                     
                   
                 
               
               
                 
                   ( 
                   1 
                   ) 
                 
               
             
           
         
       
         
         
           
             where a and b can be any integer. In another further embodiment, a and b is 1 and 2 respectively. The first matrix on the right side of Equation (1) is generally referred to as an x-direction edge detector. Also P i,j  is the interested pixel and P i−1,j−1 , P i−1,j , P i−1,j+1 , P i,j−1 , P i,j+1 , P i+1,j−1 , P i+1,j  and P i+1,j+1  are the pixels immediately surrounding the interested pixel P i,j . 
           
         
       
    
     Similarly, the background y-directional derivative G yb  of each pixel is determined by convoluting each pixel with the pixels immediately surrounding it in step  32   b . In one embodiment, it is determined by convoluting the interested pixel with 8 pixels immediately surrounding it. In one further embodiment, the background y-directional derivative G yb  of the interested pixel is obtained by using the following Equation (2): 
     
       
         
           
             
               
                 
                   
                     G 
                     
                       y 
                       ⁡ 
                       
                         ( 
                         
                           i 
                           , 
                           j 
                         
                         ) 
                       
                     
                   
                   = 
                   
                     
                       ( 
                       
                         
                           
                             
                               - 
                               a 
                             
                           
                           
                             0 
                           
                           
                             a 
                           
                         
                         
                           
                             
                               - 
                               b 
                             
                           
                           
                             0 
                           
                           
                             b 
                           
                         
                         
                           
                             
                               - 
                               a 
                             
                           
                           
                             0 
                           
                           
                             a 
                           
                         
                       
                       ) 
                     
                     * 
                     
                       ( 
                       
                         
                           
                             
                               p 
                               
                                 
                                   i 
                                   - 
                                   1 
                                 
                                 , 
                                 
                                   j 
                                   - 
                                   1 
                                 
                               
                             
                           
                           
                             
                               p 
                               
                                 
                                   i 
                                   - 
                                   1 
                                 
                                 , 
                                 j 
                               
                             
                           
                           
                             
                               p 
                               
                                 
                                   i 
                                   - 
                                   1 
                                 
                                 , 
                                 
                                   j 
                                   + 
                                   1 
                                 
                               
                             
                           
                         
                         
                           
                             
                               p 
                               
                                 i 
                                 , 
                                 
                                   j 
                                   - 
                                   1 
                                 
                               
                             
                           
                           
                             
                               p 
                               
                                 i 
                                 , 
                                 j 
                               
                             
                           
                           
                             
                               p 
                               
                                 i 
                                 , 
                                 
                                   j 
                                   + 
                                   1 
                                 
                               
                             
                           
                         
                         
                           
                             
                               p 
                               
                                 
                                   i 
                                   + 
                                   1 
                                 
                                 , 
                                 
                                   j 
                                   - 
                                   1 
                                 
                               
                             
                           
                           
                             
                               p 
                               
                                 
                                   i 
                                   + 
                                   1 
                                 
                                 , 
                                 j 
                               
                             
                           
                           
                             
                               p 
                               
                                 
                                   i 
                                   + 
                                   1 
                                 
                                 , 
                                 
                                   j 
                                   + 
                                   1 
                                 
                               
                             
                           
                         
                       
                       ) 
                     
                   
                 
               
               
                 
                   ( 
                   2 
                   ) 
                 
               
             
           
         
       
         
         
           
             where a and b can be any integer. In another further embodiment, a and b is 1 and 2 respectively. The first matrix on the right side of Equation (2) is generally referred to as a y-direction edge detector. Also P i,j  is the interested pixel and P i−1,j−1 , P i−1,j , P i−1,j+1 , P i,j−1 , P i,j+1 , P i+1,j−1 , P i+1,j  and P i+1,j+1  are the pixels immediately surrounding the interested pixel P i,j . 
           
         
       
    
     After steps  32   a  and  32   b , the background gradient direction N and background tangent direction T are computed in step  32   c . The background gradient direction N is the vector sum of G xb  and G yb  and the background tangent direction T is perpendicular to N. The angle θ between the background tangent direction T and the x-coordinate for each pixel can be determined by using the background x-directional derivative G xb  and the background y-directional derivative G yb  of each corresponding pixel by the following Equations:
 
θ=tan −1 ( G   xb   /G   yb )  (3)
 
       FIG. 4 b    shows the background gradient direction N and the background tangent direction T for one of the pixels presented in a contour map. The angle θ is an important parameter for this edge detection algorithm. Either the value of this angle itself, or some functional values of this angle are then recorded/saved and forwarded to the online step  200  for subsequent use. A gradient direction profile thereby is formed after the background gradient directions N for all the pixels on the background image are determined. Likewise, the background tangent direction profile can also be obtained in a similar manner.  FIG. 5  shows background gradient directions N and background tangent directions T of some of the pixels in the background image. 
       FIG. 6  shows a flow chart of the online step  200  according to a first embodiment of the present invention. The term ‘online’ here means that the edge detection system  20  is ready to process one or a sequence of digital images captured by the optical detector  26 . In one embodiment, the online step  200 , which runs after the initialization step  100 , starts with capturing an image on the surface  24  frame-by-frame. When an object presents itself on the surface  24 , both the surface  24  and the object are captured in step  34 . The image with an object is hereafter referred to as foreground image. 
     After that, a threshold for determining whether a pixel is an edge of an object is set in step  36 . The threshold is determined by the following formula: 
     
       
         
           
             
               
                 
                   Threshold 
                   = 
                   
                     
                       mean 
                       ⁢ 
                       
                           
                       
                       ⁢ 
                       of 
                       ⁢ 
                       
                           
                       
                       ⁢ 
                       the 
                       ⁢ 
                       
                           
                       
                       ⁢ 
                       intensity 
                       ⁢ 
                       
                           
                       
                       ⁢ 
                       of 
                       ⁢ 
                       
                           
                       
                       ⁢ 
                       the 
                       ⁢ 
                       
                           
                       
                       ⁢ 
                       foreground 
                       ⁢ 
                       
                           
                       
                       ⁢ 
                       image 
                     
                     m 
                   
                 
               
               
                 
                   ( 
                   4 
                   ) 
                 
               
             
           
         
       
         
         
           
             where m is in a range of 6 to 14. In one embodiment, m is equal to 8. This Threshold value is a global value to check if a pixel is a potential edge boundary point or not. 
           
         
       
    
     Afterwards, the foreground x-directional derivative G xf  and the foreground y-directional derivative G yf  are obtained respectively in steps  38   a  and  38   b . Specifically, the foreground x-directional derivative G xf  for an interested pixel is determined by using Equation (1) and the foreground y-directional derivative G xf  of the interested pixel is determined by using Equation (2). In a similar manner, the foreground gradient direction (or gradient vector) G f  is computed as the vector sum of G xf  and G yf . After this is processed for all pixels in the foreground image, a foreground gradient profile is then formed. 
       FIG. 7  illustrates the situation when an object  30  (in this case the hand of a user) is presented on the surface  24 . The vectors N and T, which denote the background gradient direction and background tangent direction respectively, are obtained from the initialization step  100  for this pixel. When comparing the background image and the foreground image, the foreground gradient direction G f  for some pixels on the foreground image are different from the background gradient direction N in the background image due to the difference in reflectivity between the object and the surface  24 . This is illustrated in  FIG. 7  where at the edge boundary (in this case the tip of the finger) the magnitude and direction of G f  are different from N for this pixel. 
     In one embodiment and referring to  FIGS. 8 a  and 8 b   , the angle γ between the foreground gradient direction G f  and the background gradient direction N is obtained in step  38   g  and a value G T , which is the product of the magnitude of G f  and the absolute value of sin(γ) is computed in step  38   h  for each pixel. This value G T  is referred to as the differential value hereafter in this specification, In other words:
 
 G   T   =|G   f |·sin γ|  (5)
 
     It can be observed that the value G T  is the absolute value of the vector rejection of G f  from N, i.e. the absolute magnitude value of the vector difference between the foreground gradient direction G f  and its projection onto the background gradient direction N. By computing G T  for all pixels in the foreground image, a differential profile is obtained. In essence, the differential profile is the profile of differential values G T  for the entire foreground image. 
     For each pixel, the value G T  is then compared with the Threshold value obtained in Equation (4) in step  38   i . The pixel is declared to be a potential edge pixel if G T  is higher than the Threshold. Otherwise, it is declared not an edge pixel. 
     Equation (5) can be simplified further. Refer to  FIG. 8 a   , 
     
       
         
           
             
               
                 
                   
                     
                       
                         
                           G 
                           T 
                         
                         = 
                           
                         ⁢ 
                         
                           
                              
                             
                               G 
                               f 
                             
                              
                           
                           · 
                           
                              
                             
                               sin 
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               γ 
                             
                              
                           
                         
                       
                     
                   
                   
                     
                       
                         = 
                           
                         ⁢ 
                         
                           
                              
                             
                               G 
                               f 
                             
                              
                           
                           · 
                           
                              
                             
                               sin 
                               ⁡ 
                               
                                 [ 
                                 
                                   θ 
                                   - 
                                   
                                     ( 
                                     
                                       θ 
                                       - 
                                       γ 
                                     
                                     ) 
                                   
                                 
                                 ] 
                               
                             
                              
                           
                         
                       
                     
                   
                   
                     
                       
                         = 
                           
                         ⁢ 
                         
                            
                           
                             
                               
                                 G 
                                 f 
                               
                               ⁢ 
                               
                                 cos 
                                 ⁡ 
                                 
                                   ( 
                                   
                                     θ 
                                     - 
                                     γ 
                                   
                                   ) 
                                 
                               
                               ⁢ 
                               sin 
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               θ 
                             
                             - 
                             
                               
                                 G 
                                 f 
                               
                               ⁢ 
                               
                                 sin 
                                 ⁡ 
                                 
                                   ( 
                                   
                                     θ 
                                     - 
                                     γ 
                                   
                                   ) 
                                 
                               
                               ⁢ 
                               cos 
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               θ 
                             
                           
                            
                         
                       
                     
                   
                   
                     
                       
                         = 
                           
                         ⁢ 
                         
                            
                           
                             
                               
                                 G 
                                 yf 
                               
                               ⁢ 
                               sin 
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               θ 
                             
                             - 
                             
                               
                                 G 
                                 xf 
                               
                               ⁢ 
                               cos 
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               θ 
                             
                           
                            
                         
                       
                     
                   
                   
                     
                       
                         = 
                           
                         ⁢ 
                         
                            
                           
                             
                               G 
                               yT 
                             
                             - 
                             
                               G 
                               xT 
                             
                           
                            
                         
                       
                     
                   
                 
               
               
                 
                   ( 
                   
                     6 
                     ⁢ 
                     a 
                   
                   ) 
                 
               
             
           
         
       
         
         
           
             where G yT =G yf  sin θ and G xT =G xf  cos θ and θ is the angle found in step  32   c  for the corresponding pixel in the initialization step  100 . 
             When the foreground gradient direction G f  is on the other side of the background gradient direction N as shown in  FIG. 8 b   , Equation (5) can be re-written as: 
           
         
       
    
     
       
         
           
             
               
                 
                   
                     
                       
                         
                           G 
                           T 
                         
                         = 
                           
                         ⁢ 
                         
                           
                              
                             
                               G 
                               f 
                             
                              
                           
                           · 
                           
                              
                             
                               sin 
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               γ 
                             
                              
                           
                         
                       
                     
                   
                   
                     
                       
                         = 
                           
                         ⁢ 
                         
                           
                              
                             
                               G 
                               f 
                             
                              
                           
                           · 
                           
                              
                             
                               sin 
                               ⁡ 
                               
                                 ( 
                                 
                                   - 
                                   γ 
                                 
                                 ) 
                               
                             
                              
                           
                         
                       
                     
                   
                   
                     
                       
                         = 
                           
                         ⁢ 
                         
                           
                              
                             
                               G 
                               f 
                             
                              
                           
                           · 
                           
                              
                             
                               sin 
                               ⁡ 
                               
                                 [ 
                                 
                                   θ 
                                   - 
                                   
                                     ( 
                                     
                                       θ 
                                       + 
                                       γ 
                                     
                                     ) 
                                   
                                 
                                 ] 
                               
                             
                              
                           
                         
                       
                     
                   
                   
                     
                       
                         = 
                           
                         ⁢ 
                         
                            
                           
                             
                               
                                 G 
                                 f 
                               
                               ⁢ 
                               
                                 cos 
                                 ⁡ 
                                 
                                   ( 
                                   
                                     θ 
                                     + 
                                     γ 
                                   
                                   ) 
                                 
                               
                               ⁢ 
                               sin 
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               θ 
                             
                             - 
                             
                               
                                 G 
                                 f 
                               
                               ⁢ 
                               
                                 sin 
                                 ⁡ 
                                 
                                   ( 
                                   
                                     θ 
                                     + 
                                     γ 
                                   
                                   ) 
                                 
                               
                               ⁢ 
                               cos 
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               θ 
                             
                           
                            
                         
                       
                     
                   
                   
                     
                       
                         = 
                           
                         ⁢ 
                         
                            
                           
                             
                               
                                 G 
                                 yf 
                               
                               ⁢ 
                               sin 
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               θ 
                             
                             - 
                             
                               
                                 G 
                                 xf 
                               
                               ⁢ 
                               cos 
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               θ 
                             
                           
                            
                         
                       
                     
                   
                   
                     
                       
                         = 
                           
                         ⁢ 
                         
                            
                           
                             
                               G 
                               yT 
                             
                             - 
                             
                               G 
                               xT 
                             
                           
                            
                         
                       
                     
                   
                 
               
               
                 
                   ( 
                   
                     6 
                     ⁢ 
                     b 
                   
                   ) 
                 
               
             
           
         
       
     
     In either case, we have
 
 G   T   =|G   yT   −G   xT |  (7)
 
     Referring to  FIGS. 8 a  and 8 b    again, the value G yT  is the projection of G yf  onto the background tangent direction vector T while the value G xT  is the projection of G xf  onto the background tangent direction vector T. Hence, the value G T  is the absolute difference between the projection of G yf  and the projection of G xf  onto the same background tangent direction vector T. 
     Thus in another embodiment, a modified flow chart as shown in  FIG. 9  is used to implement the online step  200 . In this flow-chart, steps  34 ,  36 ,  38   a  and  38   b  are the same as that of  FIG. 6  and are not repeated here. Step  38   c  is to compute G xT , which is the projection of G xf  onto the background tangent direction vector T as follows:
 
 G   xT   =G   xf ·cos θ  (8)
         Similarly, step  38   d  is to compute G yT , which is the projection of G yf  onto the background tangent direction vector T as follows:
 
 G   yT   =G   yf ·sin θ  (9)
       

     Thereafter, a total gradient G T  is found in step  38   e:  
 
 G   T   =|G   yT   −G   xT |  (10)
 
     Similar to the flow chart presented in  FIG. 6 , the last step  38   f  is to compare the value of G T  against the Threshold value and declare whether the pixel under examination is a potential edge pixel or not. 
     The method of this invention has several advantages. One of the advantages is that the edge detection by the method of the present invention is not affected by the change of light intensity on the surface  24  or noise generated by the light source  22  over time. This is particularly a problem when luminance generated by the light source  22  is affected by the environment. For example, if the edge detecting system  20  is installed in an automobile, the heat generated by the automobile may reduce the light intensity output. As shown in  FIGS. 10 a  and 10 b   , the directions of background gradient directions N at low light intensity and the direction of background gradient directions N′ at high light intensity remain mostly unchanged. As a result, the background gradient directions T at low light intensity and the background gradient directions T at high light intensity remain mostly unchanged as well. Therefore, the method of detecting an edge of the object of the present invention is not affected by any changes of background light intensity. 
       FIG. 11  shows another aspect of the edge detection system  20  according to one embodiment of the present invention. In this aspect, the edge detection system  20  comprises an initialization image capturing module  40 , initialization module  42 , online image capturing module  44  and online module  46 . The initialization image capturing module  40  is configured to perform the step  30  while the initialization module  42  is configured to perform step  32  (i.e. steps  32   a - 32   c ). Furthermore, the online image capturing module  44  is configured to perform step  34  and  36  while the online module  46  is configured to perform steps  38   a ,  38   b ,  38   g ,  38   h  and  38   i  in  FIG. 6  or steps  38   a  to  38   f  in  FIG. 9 . 
     In one implementation, the edge detection system  20  is installed in an image projector  48  as shown in  FIG. 12 . The image projector  48  comprises a projector  50  to project an image onto a surface  24 , an IR light source  54 , an IR camera  52  and a microcomputer  56 . In one application, the image projector  48  projects either a still image or a video image sequence onto the surface  24 . Concurrently, the IR light source  54  irradiates the surface with infrared light and the IR camera  52  captures the IR light intensity reflected from the surface  24 . In a further embodiment, the projected images, which are visible by humans, may contain clickable icons on the surface  24  for user to select. The user can then use his/her finger to point to an icon. The IR camera filters out the visible image and only process those light intensity in the IR spectrum. The edge detection system  20  can then identify the boundary of the human hand and finger from the IR image; and forward such information to higher level image processing modules in the image projector  48  to identify which icon the user is to click. 
       FIGS. 13 a  to 13 d    shows the experimental results of the present edge detection system.  FIG. 13 a    shows an image whereby the background image is dim but the light intensity of the foreground image suddenly increases due to some unexpected reason (i.e. a drop of temperature), while  FIG. 13 b    is the corresponding edge boundary profile performed by the edge detection system on  FIG. 13 a   . Similarly,  FIG. 13 c    shows another image whereby the background image is bright but the light intensity of the foreground image decreases (i.e. due to temperature rise).  FIG. 13 d    is the corresponding edge boundary profile performed by the edge detection system on  FIG. 13   c.    
     The exemplary embodiments of the present invention are thus fully described. Although the description referred to particular embodiments, it will be clear to one skilled in the art that the present invention may be practiced with variation of these specific details. Hence this invention should not be construed as limited to the embodiments set forth herein.