Abstract:
A method for dynamically correcting misalignment of a vehicular camera includes fixedly disposing a camera at a vehicle and operating the camera to acquire multiple frames of image data whilst the vehicle is moving generally in a straight line. A plurality of sets of feature points are selected in an image frame, with each set including a first feature point and a second feature point. For each set of feature points, a motion trajectory of that set&#39;s feature points is tracked in subsequent image frames. For each tracked first and second feature points, a vanishing point is established in the image plane. Based on the established vanishing point, a vanishing line is determined in the image plane. When the vanishing line is determined to be non-horizontal in the image plane, at least one of pitch, roll or yaw of the camera is adjusted to correct rotational misalignment of the camera.

Description:
CROSS-REFERENCE TO RELATED APPLICATIONS 
       [0001]    The present application is a continuation of U.S. patent application Ser. No. 14/113,414, filed Oct. 23, 2013, now U.S. Pat. No. 9,357,208, which is a 371 national phase application of PCT Application No. PCT/CA2012/000056, filed Jan. 20, 2012, which claims priority to U.S. Provisional Application Ser. No. 61/478,711, filed Apr. 25, 2011, the contents of which are incorporated by reference herein in their entirety. 
     
    
     FIELD OF INVENTION 
       [0002]    The invention relates to the field of vehicular cameras, and more particularly to methods and systems for dynamically calibrating the position or alignment of a vehicular camera in the field. 
       BACKGROUND OF INVENTION 
       [0003]    In an effort to provide drivers with a comprehensive view of their surroundings, vehicle manufacturers have recently proposed and marketed 360 degree vision systems which display a “bird&#39;s eye” view of the vehicle and its surroundings. Such 360 degree vision systems typically utilize four wide angle cameras, one at the front of the vehicle, one at the rear and two at the sides. The outputs of these four cameras are displayed together on single display screen to provide a 360 degree image. See, for example,  FIGS. 1A, 1B, and 1C , which show a vehicle  10  and the location of cameras  12   a - 12   d , respective camera images  14   a - 14   d , and 360 degree image  16 . 
         [0004]    A problem arises in attempting to stitch together the aforesaid camera images into a single composite image in that each camera is not absolutely fixed in position. There are tolerances during the manufacture of the cameras and assembly into the vehicle. In addition, and more importantly, the positioning of each camera will vary over the life of the vehicle as it is driven and subjected to the rigours of the real world. Vibrations from bumpy roads and door slams, the effects of car washes and repair and replacement of various parts, as well as the movement of the pivoting side view mirror housings, can all have an effect of the position (including angular orientation) of the vehicular cameras. 
         [0005]    For this reason, the commercial 360 degree vision systems are not seamless. Instead, to avoid having to deal with misalignment of and between the four cameras, the commercial systems basically display the images from the four cameras in four predetermined regions of the display, typically leaving buffer zones  17  between the four images as seen in  FIG. 1C . In other words, the images from the four cameras are not seamlessly stitched together to provide a uniform composite 360 degree image  18  as shown in  FIG. 1D , which is more visually appealing. 
         [0006]    It is possible to calibrate each camera when the vehicle leaves the factory production line. An end of assembly line tester may be used to project predetermined targets in a controlled environment at known distances from the vehicle. Knowing the real physical position of various markers, it is possible to define a transfer function that maps camera pixel locations to real locations, and from this determine an offset to the nominal camera position. However, this end of line testing method does not solve the problem of being able to independently calibrate the cameras in the field, where there is no controlled environment in which pre-designated markers are situated at known locations. Simply put, it is not possible to use end-of-line assembly line calibration based on predetermined targets in a controlled environment to calibrate a vehicular camera in the field. 
         [0007]    Each vehicular camera has six degrees of freedom, three linear (up-down, right-left, forward-backward) and three rotational (roll, pitch, and yaw). In attempting to stitch together the images from the four cameras based on predetermined demarcation lines defined with respect to nominally positioned cameras, it was noticed that changes in the three rotational degrees of freedom in particular result in a noticeable visual distortion in the composite 360 degrees image. Thus, it is particularly desired to calibrate the cameras with respect to the three rotational degrees of freedom. 
         [0008]    The invention presents a method and system for dynamically ascertaining the position of a vehicular camera in the field, particularly with respect to its three rotational degrees of freedom, without manual intervention. The knowledge of the camera position may thus be used to calibrate the camera so as to seamlessly stitch together images from all four cameras. It will also be appreciated that the knowledge of camera position can also be used to calibrate the camera for a variety of other functions, for example, when one or more of the cameras are used for object detection, lane departure warning, automatic high beam control and other such driver assistance purposes. 
       SUMMARY OF INVENTION 
       [0009]    Generally speaking, the invention dynamically calibrates a vehicular camera to ascertain its position, in at least the three rotational degrees of freedom, with respect to a vehicular frame of reference or common coordinate system. 
         [0010]    According to this aspect of the invention a vehicular camera is independently calibrated using dynamic images obtained in the field. The calibration is carried out by utilizing the principle of vanishing points, wherein parallel lines in a scene meet at a vanishing point. The invention ascertains a vanishing line based on a locus of such vanishing points. The position of the vanishing line is correlated to the position of the vehicular camera, including in particular the angular positions thereof. 
         [0011]    The first aspect of the invention can be better appreciated with respect to  FIGS. 2A-2C and 3A-3C .  FIG. 2A  shows a ground plane  20 , defined by X, Y coordinates. The ground plane is defined by the roadway.  FIG. 3A  shows an image plane  20 ′ defined by x, y coordinates. The image plane  20 ′ is provided in this example by the front facing camera  12   a.    
         [0012]      FIG. 2A  also shows two lines  22   a ,  22   b  that are parallel with the Y-axis in the ground plane  20 . However, these two lines  22   a ,  22   b  will be seen in the image plane  20 ′ as non-parallel lines  22   a ′,  22   b ′ as shown in  FIG. 3A . The non-parallel lines  22   a ′,  22   b ′ will meet at a central vanishing point VP 0  in the image plane  20 ′. 
         [0013]    Similarly, referring additionally to  FIG. 2B , other sets of parallel lines such as  32   a ,  32   b  and  34   a ,  34   b  that are angled with respect to the Y-axis ground plane  30  will be seen as non-parallel lines  32   a ′,  32   b ′ and  34   a ′,  34   b ′ in image plane  30 ′, as shown in  FIG. 3B . The non-parallel lines  32   a ′,  32   b ′ will meet at vanishing point VP 1  in the image plane  30 ′ and the non-parallel lines  34   a ′,  34   b ′ will meet at vanishing point VP 2  in the image plane  30 ′. The locus of vanishing points VP 0 , VP 1 , VP 2  in the image plane  30 ′ will yield a vanishing line VL. In circumstances where the camera is perfectly aligned with no rotational error as shown in  FIG. 3B , the vanishing point VP 0  will be located at a preordained pixel position (such as at the horizontal centre of the image) and the vanishing line VL will be perfectly horizontal in the image plane  30 ′ and located at a preordained vertical pixel height. Thus,  FIG. 3B  shows the situation in the image plane when the front facing camera is situated at its nominal position. 
         [0014]    However, if the position including the rotational angles of the front camera has shifted then, as shown in the ground and image planes  30 ,  30 ″ of  FIGS. 2C, and 3C , the same ground plane conditions ( FIG. 2C  is identical to  FIG. 2B ) will generate shifted vanishing points VP 0 ′, VP 1 ′, VP 2 ′ and a shifted (and angled with respect to the horizontal) vanishing line VL′ in the image plane. The changes in the central vanishing point VP 0  and in the vanishing line VL can be correlated in particular to changes in the angular positions or roll, pitch and yaw of the vehicular camera, enabling the camera to be independently calibrated. 
         [0015]    To find parallel lines in a dynamic situation where the vehicle is in motion, this aspect of the invention selects a plurality of feature points in the scene and tracks the subsequent positions of these points in a set of image frames acquired from the camera video stream as the vehicle moves. Thus, for example, as shown in the schematic diagrams of  FIGS. 4A-4C , feature point j (the base of a traffic sign pole on one side of the road) and feature point k (the base of a traffic sign pole on the other side of the road) are tracked at subsequent image frames  40 ,  42 ,  44 . The pixel positions of these feature points will change over the subsequent image frames to yield, for example, vector J, comprising points (x 0 , y 0 ), (x 1 , y 1 ), . . . (x n , y n ), in respect of feature point j, and vector K in respect of feature point k. The vectors J and K are graphed in an image plane  50  in  FIG. 5 , and can be extrapolated to ascertain the central vanishing point VP 0  in the image plane  50 . The corresponding situation is shown in ground planes  60 ,  62 ,  64  of  FIGS. 6A- 6C , from which it should be appreciated that the motion of the vehicle relative to the feature points can be utilized to extract parallel lines J and K in the ground plane  70  as shown in  FIG. 7 . 
         [0016]    In the situation just discussed, the vehicle is shown moving in a straight line so as to enable the central vanishing point to be determined. However, when the vehicle turns as a result of a change in its steering angle, the motion of the vehicle can be approximated over relatively short distances (approximately 0.5 to 2 seconds of travel time, depending of vehicle speed) as a straight motion at an angle with respect to the ground Y-axis. Repeating the foregoing process of extracting and tracking the trajectories of feature points for various steering angle ranges as the vehicle moves will enable other vanishing points to be determined, hence enabling the determination of the vanishing line. 
         [0017]    Similar conditions and circumstances exist for the rear and side camera, but the exact relationship between changes in camera angular position and shifts in the central vanishing point and vanishing will differ. 
         [0018]    From the foregoing then, it will be appreciated that one aspect of the invention provides a method of dynamically ascertaining the position or alignment of a vehicular camera relative to a vehicle to which the camera is attached. The method includes the steps of: (a) establishing a plurality of vehicular steering angle ranges; (b) acquiring a set of image frames in a video stream provided by the camera whilst the vehicle is in motion, the image frames defining an image plane; (c) measuring the steering angle of the vehicle and, for each steering angle range: (i) selecting a plurality of feature points in the image frames, (ii) tracking a motion trajectory of each selected feature point in the set of image frames, and (iii) determining a vanishing point in the image plane for the plurality of tracked motion trajectories; (d) determining a vanishing line in the image plane provided by the camera based on a locus of said vanishing points; and (e) determining the position or alignment of the camera based on the position of a central vanishing point (determined when the steering angle range encompasses 0 degrees) and the vanishing line. 
     
    
     
       BRIEF DESCRIPTION OF THE DRAWINGS 
         [0019]    The foregoing and other aspects of the invention will be better understood with respect to the attached drawings, wherein: 
           [0020]      FIG. 1A  is a schematic diagram of a vehicle having front, rear, and side facing vehicular cameras and the fields of view provided thereby; 
           [0021]      FIG. 1B  is an example of images obtained by each of the four cameras shown in  FIG. 1A ; 
           [0022]      FIG. 1C  is an image provided by a 360 degree vision system according to the prior art where the individual images provided by the cameras shown in  FIG. 1B  are not seamlessly stitched into a composite 360 degree image; 
           [0023]      FIG. 1D  is an image provided by a 360 degree vision system according to the preferred embodiment of the invention which seamlessly stitches together the individual images provided by the cameras as shown in  FIG. 1B  into a composite 360 degree image; 
           [0024]      FIG. 1E  is a diagram showing the relationships between individual camera coordinate systems and a vehicle coordinate system; 
           [0025]      FIG. 2A  is a diagram showing two lines parallel to a coordinate axis in a ground plane and  FIG. 3A  is a diagram showing the effect of these two parallel lines when projected onto an image plane provided by the camera in circumstances where the camera situated at its nominal position; 
           [0026]      FIG. 2B  is a diagram showing other parallel lines that are angled with respect to the coordinate axis in the ground plane of  FIG. 2A  and  FIG. 3B  is a diagram showing the effect of these other parallel lines when projected onto the image plane of  FIG. 3A  in circumstances where the camera situated at its nominal position; 
           [0027]      FIG. 2C  is identical to  FIG. 2B , and  FIG. 3C  is a diagram showing the sets of parallel lines in  FIGS. 2A and 2B  when projected onto the image plane provided by the camera in circumstances where the camera is NOT situated at its nominal position but has rotated; 
           [0028]      FIGS. 4A-4C  are diagrams showing the motion trajectories of feature points over successive image frames in a video stream provided by the front camera; 
           [0029]      FIG. 5  is a diagram showing vectors in the image plane derived from the motion trajectories of  FIGS. 4A-4C ; 
           [0030]      FIGS. 6A-6C  are diagrams showing the corresponding motion trajectories of the feature points in  FIGS. 4A-4C  in the ground plane; 
           [0031]      FIG. 7  is a diagram showing vectors in the ground plane derived from the motion trajectories of  FIGS. 6A-6C ; 
           [0032]      FIG. 8  is a system block diagram from a hardware perspective of the 360 degree vision system; 
           [0033]      FIG. 9  is a block diagram of an online calibration algorithm executed by the 360 degree vision system for dynamically ascertaining the position, including angular rotations, of the front camera; 
           [0034]      FIG. 10  is a histogram showing distribution of vehicle steering angle over normal driving conditions; 
           [0035]      FIG. 11  is a plot showing the size of steering angle bins over the range of steering angles; 
           [0036]      FIG. 12  is a flowchart of a vanishing point detection algorithm; 
           [0037]      FIG. 13  is a diagram showing feature point motion trajectories in the image plane provided by the front camera; 
           [0038]      FIG. 14  is a diagram showing de-warped motion trajectories of  FIG. 13 ; 
           [0039]      FIG. 15  is a diagram showing linearly fitted, de-warped motion trajectories of  FIG. 13 , and the location of a vanishing point based on the intersection of such trajectories; 
           [0040]      FIG. 16  provides pseudo code for the algorithm shown in  FIG. 12 ; 
           [0041]      FIG. 17  is a flowchart of a vanishing line detection algorithm; 
           [0042]      FIG. 18  is a flowchart of a rotational angle estimation algorithm; and 
           [0043]      FIG. 19  is a diagram showing various vanishing point and vanishing line parameters in the image plane which are used by the rotational angle estimation algorithm. 
       
    
    
     DETAILED DESCRIPTION OF PREFERRED EMBODIMENTS 
       [0044]    In this document, unless the context dictates otherwise, the following terms have the following meanings: 
         [0045]    “ground plane” refers to a real plane parallel to the roadway. 
         [0046]    “image plane” refers to a two-dimensional space provided as an output of a camera viewing a real three-dimensional space. 
         [0047]    “plane at infinity” means all points at infinity, and refers to a plane that is perpendicular to the ground plane. 
         [0048]    “horizon line” is the intersection of the ground plane with the plane at infinity. 
         [0049]    “vanishing point” is a point at which parallel lines in the ground plane seem to converge in an image plane. If the camera is centered between two parallel lines in the ground plane which are parallel to the camera optical axis, the intersection of the two parallel lines is referred to as the “central vanishing point”. 
         [0050]    “principal point” refers to the central vanishing point of a camera when the camera is at its nominal installed position and orientation. This principal point is an intrinsic camera parameter and provided as part of the manufacturing data. 
         [0051]    “vanishing line” is a locus of estimated vanishing points. 
         [0052]    “camera rotational angles” are the angles that define the actual orientation of the camera.  FIG. 1E  shows the position of the four cameras with respect to the vehicle coordinate system. The right hand system is assumed to be positive for the rotations. Consider the total rotation of each camera to be defined in terms of its rotation around the individual camera coordinates: X axis (pitch or α), Y axis (yaw or β) and Z axis (roll or γ). The rotations, by definition, are not commutative and thus, the order in which the camera is rotated around the different axes is important. For our purpose, the camera is first rolled, followed by yaw and then pitch, making the order of rotations as Z axis (roll)→Y axis (yaw)→X axis (pitch). 
         [0053]    “de-warping” refers to a procedure for devolving distortions produced by a wide angle camera lens. In the preferred embodiment the vehicular camera employed for the 360 degree composite image is a very wide angle, omni-vision camera, so the original images are distorted. A de-warping procedure as known in the art per se is necessary to account for this distortion and to convert curvy trajectories to straight trajectories. Once the convergence point (vanishing point) is found, its coordinates are de-warped to give the final image coordinates. 
         [0054]      FIG. 8  shows a hardware schematic for a preferred three-hundred-and-sixty degree vision system  100 , which includes the four vehicular cameras  12   a - 12   d , each of which includes a wide angle lens  102  coupled to an image sensor  104 , a memory  106  and a transmitter  108 . The cameras are coupled via the transmitters  108  to respective receivers  110  on a main electronic control unit (ECU)  112 . In this particular embodiment a floating point gate array (FPGA)  114  functions as a multiplexer to provide one of the four camera video streams  116  (each stream comprising successive image frames captured by the camera at a rate of approximately  25 - 30  frames per second) to an output line  118  that is connected to a digital signal processor (DSP)  120 . The DSP  120 , in conjunction with an associated microcontroller  122 , processes the selected camera video stream and carries out the online calibration (OC) algorithms discussed in detail herein. The FPGA  114  also provides a composite 360 degree view video output  124  to a display driver  126  based on stitching instructions provided by the DSP  120  via a command line  128 . 
         [0055]    The microcontroller  122  is connected to the vehicle command area network (CAN) via a CAN transceiver  130  and thus can query the main vehicle controller (not shown) for information such as vehicle speed and steering angle. 
         [0056]    As summarized above, the OC algorithms according to the first aspect of the invention are based on the concept of vanishing points because the estimation of the camera angles in these algorithms relies on the estimation of the vanishing line. In order to determine the vanishing line, it is necessary to estimate vanishing points corresponding to different orientations of parallel lines in the image. The vanishing line in conjunction with the spatial position of the principal point is used to determine the camera rotational angles. 
         [0057]    Ideally, in order to collect various vanishing points in different orientations, there should be various parallel lines with different orientations in the corresponding ground plane. However this is not available in reality since the surrounding view or scene is not a controlled environment. Additionally there exist various external environmental factors preventing a perfect projection of parallel lines into the image plane. Thus the OC algorithm utilizes the relative motion of the vehicle with respect to various feature points in order to generate motion trajectories to replicate the ideal situation in which there are parallel lines available in the input image. By selecting special features in the input images and tracking for short durations, these points move approximately parallel to the vehicle motion and thus are representative of parallel lines with respect to the coordinate system being considered. The intersection point of these trajectories lies on the vanishing point which is to be estimated. When the vehicle turns, the trajectories have a different orientation depending on the angle of turn. The locus or collection of the various vanishing points in respect of the various steering angles corresponds to different orientations of parallel lines, and enables the vanishing line to be estimated. 
         [0058]    I. Coordinate System 
         [0059]      FIG. 1E  shows a vehicle coordinate system that is used in conjunction with the example described in this publication. The vehicle X-axis lies along the longitudinal axis of the vehicle. The vehicle Y-axis lies along the cross-car direction or latitudinal axis of the vehicle. The vehicle Z-axis is the vertical axis (in/out of the page). The origin point (o) is midway along the front wheel drive axis. Each camera associated with the vehicle has its own camera coordinate system where the X-axis always points to the right of the camera, the Y-axis always points away from the camera and the Z-axis is similar to the Z-axis of the vehicle coordinate system. The camera coordinate systems are also illustrated in  FIG. 1  E. The calibration of each camera is done so that its rotational angles are first estimated with respect to the camera coordinate system, where pitch (α), yaw (β) and roll (γ) are the rotations around the X-, Y- and Z-axes of the camera coordinate system, respectively. Once calibrated, these rotations can be simply transformed to the equivalent rotations in the vehicle coordinate system as shown in Table 1 below. The rotations around the X-, Y- and Z-axes of the vehicle coordinate system are termed as Rx, Ry and Rz, respectively. 
         [0000]    
       
         
               
               
               
               
               
             
           
               
                   
                 TABLE 1 
               
               
                   
                   
               
               
                   
                 Camera 
                 Rz (degree) 
                 Ry(degree) 
                 Rx(degree) 
               
               
                   
                   
               
             
             
               
                   
                 Front 
                 γ + 90  
                   α 
                 −β 
               
               
                   
                 Left 
                 γ + 180 
                 −β 
                 −α 
               
               
                   
                 Rear 
                 γ + 270  
                 −α 
                   β 
               
               
                   
                 Right 
                 γ 
                   β 
                   α 
               
               
                   
                   
               
             
          
         
       
     
         [0060]    Table 2 below shows an example of nominal angular positions of the front  12   a , rear  12   b  and side facing cameras  12   c ,  12   d  in a sample vehicle. Note that the roll, pitch and yaw for each camera implies change about a different vehicular axis, e.g., for the front camera pitch is defined as the angle about the vehicle Y-axis and for the right side camera pitch is defined the angle about the vehicle X-axis. 
         [0000]    
       
         
               
               
               
               
               
             
               
               
               
               
               
             
           
               
                   
                 TABLE 2 
               
               
                   
                   
               
               
                   
                 Camera 
                 Rz (degree) 
                 Ry(degree) 
                 Rx(degree) 
               
               
                   
                   
               
             
             
               
                   
               
             
          
           
               
                   
                 Front 
                 90 
                 62 
                 0 
               
               
                   
                 Left 
                 180 
                 0 
                 −12 
               
               
                   
                 Rear 
                 270 
                 −45 
                 0 
               
               
                   
                 Right 
                 0 
                 0 
                 12 
               
               
                   
                   
               
             
          
         
       
     
         [0061]    II. Front Camera 
         [0062]    A system block diagram of an OC algorithm  150  for the front camera  12   a  in accordance with the first aspect of the invention is shown in  FIG. 9 . Inputs to the algorithm  150  include: data confirming the active camera  12  (front  12   a , rear  12   b  or side  12   c ,  12   d  camera); the intrinsic parameters (principal point, focal length, lens map) for the camera under consideration; and CAN bus data including the instantaneous vehicle speed and steering angle. In an initial module  152  the vehicle speed and steering angle information is recorded for every image frame captured by the algorithm. In a first module  154 , the vanishing points are detected using a motion tracking method. In a following module  156 , the vanishing line is estimated based on the locus or collection of the estimated vanishing points for the various steering angles. The estimated central vanishing point in conjunction with the vanishing line leads to the final module  158  of the OC algorithm-the computation of the three camera rotational angles in the camera coordinate system, namely, α, β and γ. 
         [0063]    A. Inputs 
         [0064]    The processing of successive image frames in step  152  is conditioned upon two important inputs: steering angle and vehicle speed. The steering angle is one of the major inputs of the OC algorithm  150 . Using steering angle data captured during approximately ten hours of normal driving in a variety of scenarios using multiple drivers and with no special maneuvers, the inventors ascertained that during the different driving maneuvers the steering is held almost constant at different corresponding angles within a very small variation range for a computationally reasonable amount of time.  FIG. 10  shows a histogram of thirty consecutive frame sets lying in the same steering angle range observed during the normal driving along urban routes by multiple drivers. 
         [0065]    The steering angle has been partitioned into bins  160  from −180 degrees to +180 degrees in varying increments of 6 degrees or more for this experiment. The way the angles are partitioned is determined by an external function in which the central angles are (−6 to +6 degrees) divided into two central bins with a width of six degrees. The bins have symmetrical structure. The width of the bins for positive and negative angles is the same. The larger the angle becomes the wider the corresponding steering bin.  FIG. 11  shows an example of steering bin structure with linear increments for the bins  160  as the angles increase. Note that in alternative embodiments, nonlinear increments for the steering bins  160  may be used. 
         [0066]    Furthermore, although with a change in the steering angle the vehicle inscribes a circle, for a very short duration (˜&lt;1-2 sec) the path of the vehicle with respect to any point being tracked on the ground could be considered to be a straight line. The sharper the steering angle, the slower the movement of the car and the lesser the distance traveled in a curvature. This further helps to approximate the vehicle motion for very short durations by a straight path even for sharper turns. This allows for the detection of parallel trajectories in the same direction as the path of travel described by the wheels which is at an angle with respect to the vehicular coordinate system. Thus, a different set of vanishing points could be computed for these different set of parallel lines which are at different angles with respect to the vehicular coordinate axes and these vanishing points lie along the vanishing line. 
         [0067]    The change in the steering angle from the neutral (or 0 degree) location causes the wheels of the vehicle to move at an angle with respect to the body of the vehicle and thus any points tracked when steering is non-zero inscribe parallel trajectories which are at an angle to the X-axis of the vehicle coordinate system. To maintain linearity and constancy of the inclination of the trajectories, the captured images are processed as a single set for small increments of steering angles. 
         [0068]    The estimation of the vanishing point within each steering bin is thus conditioned upon the steering angle, whereby the input images are processed as a single set only if the steering angle is held within a particular range defined as steering bin. With any change in the steering out of the defined range, the previously computed trajectories are stored and the processing of a new set of images for the new steering bin is initiated 
         [0069]    The estimation of the vanishing point within each steering bin is also conditioned upon the vehicle speed. The speed of the vehicle has no effect in the path the trajectory follows in the image plane other than the fact the trajectory moves at a faster pixel rate across the frame at higher speeds. So, similar to the steering bin, if the speed values are held within a particular range, pre-defined in the algorithm, the speed bin remains constant. If the speed varies out of the defined range a new speed bin is introduced and several parameters such as tracking duration are updated. The new set of features is thus tracked according to the new set of parameters. For instance the increment in the speed bin causes the features to move faster and therefore the tracking duration will be shortened. 
         [0070]    B. Vanishing Point Detection 
         [0071]    A flow chart for the vanishing point detection module  154  is shown in  FIG. 12 . The main inputs  154 A to the vanishing point detection module  154  include the image frames of the video stream, steering angle, and vehicle speed. The main goal of this module is to produce the vanishing point based on the available input data. 
         [0072]    In an initial step  154 B a data structure is constructed for tracking trajectories across a variety of steering angles. In a following step  154 C the best features in a region of interest (ROI) that can lead to the determination of the vanishing point are detected and stored. For the front-facing camera, the ROI is close to the visible horizon line. Ideally the ROI should cover the road sides and not that much of the ground. 
         [0073]    In the following steps  154 D- 154 G, various feature points are extracted and their motions tracked to generate trajectories. For a pre-configured set of frames (which is a function of speed and steering bin), a new set of features are extracted and tracked over time. The tracking algorithm is based on motion vector estimation using block matching where, for each feature to be tracked in the current frame, a small 8×8 neighborhood around that feature is considered and the best possible match in a small window of pixels in the next frame is found. It is then assumed that the feature in the current frame has moved to the detected location in the next frame. Further information about block matching techniques may be found in Applicants&#39; co-pending patent application PCT/CA2012/000057, filed Jan. 20, 2012 and entitled “Image Processing Method for Detecting Objects Using Relative Motion” and published Nov. 1, 2012 as International Publication No. WO 2012/145819, the contents of which are incorporated by reference herein in their entirety. The collected trajectories are stored and their spatial properties are evaluated per frame set in steps  154 H and  1541 . 
         [0074]    More particularly, in step  154 H, the collected trajectories are de-warped. Each trajectory is then linearly fitted using robust regression techniques. If the fitted trajectories meet the criteria set by various threshold (such as sufficient length or time), they are saved. The intersection of these fitted trajectories gives the location of the vanishing point for each steering angle bin. For instance,  FIG. 13  shows an example in which trajectories  162  are shown in a warped image space (due to the wide angle lens used in the camera) and  FIG. 14  shows trajectories  162 ′ in a de-warped space.  FIG. 15  shows the trajectories in the de-warped image linearly fitted to generate substantially linear trajectories  162 ″, enabling a vanishing point VP to estimated. (Note that  FIG. 15  is a mirror image of  FIG. 14  utilizing a different scale.) 
         [0075]    Pseudo code for the vanishing point detection module  154  is presented in  FIG. 16 . Since the vanishing point is detected and recorded per different steering angle bin, and the threshold values as well as some processing data such as the location of ROI vary depending on the vehicle speed and steering angle, the vanishing point detection module stores the data necessary for the next module in a structured format called a ‘trajectory structure’. The number of elements in the trajectory structure depends on the number of steering bins. The most important elements of this structure are: 
         [0076]    (a) Steering bin width. Since it is not feasible to account for each single angle, the bins have been designed to include a group of angles. The range of angles allocated to each bin is determined by an external function. 
         [0077]    (b) Pre-configured set of frames. The duration for which each feature is tracked is determined by this number of frames. After reaching this number a new set of features are selected and tracked. The estimation of vanishing points is also conditioned upon the number of frames. The duration of the tracking is dependent upon the steering angle range in consideration, with a sharper steering angle being accounted for by a shorter track length translated into smaller number of frames. 
         [0078]    (c) ROI location. The image region in which the initial features are selected. 
         [0079]    (d) Number of features threshold per trajectory. The minimum number of features each trajectory must have in order to be qualified for further processing. 
         [0080]    (e) Number of trajectories for estimation of vanishing point. A minimum number of trajectories are preferably needed to find the vanishing point. 
         [0081]    As shown, at the initial stage, the speed bin value is checked and the trajectory structure is updated accordingly. After this step, the code checks a few conditions and depending on the condition, different tasks are performed. If during the tracking process a speed bin change occurs, the trajectory structure is updated. The updated trajectory parameters are not applied to the tracking process, until the next set of tracking. This will not affect the performance since the speed bin does not vary in a shorter time frame than the tracking duration. 
         [0082]    C. Vanishing Line Detection 
         [0083]    A self-explanatory flowchart of the vanishing line detection module  156  is shown in  FIG. 17 . This module is the intermediate step between the vanishing point and the camera rotational angle estimation modules  154 ,  158 . The vanishing line is estimated using a collection of vanishing points obtained during the different normal driving turning maneuvers of the vehicle. Since the estimated vanishing points lie on the visible vanishing line, the best vote vanishing points for each steering range can be used to estimate the vanishing line using a robust fitting scheme. The estimation of the vanishing point in each bin itself is preferably further refined by statistical voting. To estimate the vanishing line, a well-known robust regression technique in which the linear line parameters are iteratively estimated using least square method has been applied at step  156 D. 
         [0084]    D. Rotation Angle Estimation 
         [0085]    Once the vanishing line is estimated, the parameters of the vanishing line are used as inputs to the rotational angle estimation module  158 . The output of this module is the final OC output-the camera rotational angles.  FIG. 18  shows a flowchart of the algorithm used in this module. Note that the initial output  158 E of this module is with respect to the camera coordinate system. The rotations in the camera coordinate system can then be transformed to the vehicle coordinate system as shown in Table 1. 
         [0086]    Referring additionally to  FIG. 19 , knowing the location of the principal point, the vertical distance d 1  of this point to the vanishing line as well as the distance d 2  of a projection point to the central vanishing point are computed. Based on the geometrical relationship between the vanishing line and the actual camera angles, α and β angles are estimated. Note that the X, Y, and Z coordinates are the camera coordinate system axes as shown in  FIG. 1E . 
         [0087]    It has been discovered that the α and β angles map uniquely to the d 1  and d 2  distances, so in order to estimate these angles a lookup table is employed. This lookup table is created by varying the front camera α and β angles and recording the resultant d 1  and d 2  distances for each combination of input α and β angles. A small portion of a sample lookup table is presented in Table 3 below. The d 1  and d 2  distances can be used as indexes into the lookup table for the determination of the α and β angles. (It should also be understood that the exact relationship between α, β and d 1 , d 2  will differ depending on the particular arrangements and selection of cameras for each target vehicle.) 
         [0000]    
       
         
               
               
               
               
               
             
               
               
               
               
               
             
           
               
                   
                 TABLE 3 
               
               
                   
                   
               
               
                   
                 d 1   
                 d 2   
                 α 
                 β 
               
               
                   
                   
               
             
             
               
                   
               
             
          
           
               
                   
                 152.5087 
                 3.2576 
                 62.6000 
                 −0.5000 
               
               
                   
                 152.5114 
                 2.6061 
                 62.6000 
                 −0.4000 
               
               
                   
                 152.5134 
                 1.9546 
                 62.6000 
                 −0.3000 
               
               
                   
                 152.5149 
                 1.3030 
                 62.6000 
                 −0.2000 
               
               
                   
                 152.5158 
                 0.6515 
                 62.6000 
                 −0.1000 
               
               
                   
                 152.5161 
                 0.0000 
                 62.6000 
                 0 
               
               
                   
                 152.5158 
                 0.6515 
                 62.6000 
                 0.1000 
               
               
                   
                 152.5149 
                 1.3030 
                 62.6000 
                 0.2000 
               
               
                   
                 152.5134 
                 1.9546 
                 62.6000 
                 0.3000 
               
               
                   
                 152.5114 
                 2.6061 
                 62.6000 
                 0.4000 
               
               
                   
                 152.5087 
                 3.2576 
                 62.6000 
                 0.5000 
               
               
                   
                   
               
             
          
         
       
     
         [0088]    To find the roll angle or γ, the camera calibration equation is used to solve for the only unknown parameter. The camera calibration equation is defined as: 
         [0000]    
       
         
           
             
               
                 
                   
                     [ 
                     
                       
                         
                           x 
                         
                       
                       
                         
                           y 
                         
                       
                       
                         
                           z 
                         
                       
                     
                     ] 
                   
                   = 
                   
                     KRT 
                      
                     
                       [ 
                       
                         
                           
                             X 
                           
                         
                         
                           
                             Y 
                           
                         
                         
                           
                             Z 
                           
                         
                       
                       ] 
                     
                   
                 
               
               
                 
                   ( 
                   1 
                   ) 
                 
               
             
           
         
       
     
         [0000]    where X, Y, and Z are the camera coordinate system and the coordinates (x/z, y/z) are the image coordinates. The K parameter is the matrix of the camera intrinsic parameters as shown in equation (2): 
         [0000]    
       
         
           
             
               
                 
                   K 
                    
                   
                     [ 
                     
                       
                         
                           
                             
                               - 
                               f 
                             
                             
                               pixel 
                                
                               
                                   
                               
                                
                               Size 
                             
                           
                         
                         
                           0 
                         
                         
                           axisX 
                         
                       
                       
                         
                           0 
                         
                         
                           
                             f 
                             
                               pixel 
                                
                               
                                   
                               
                                
                               Size 
                             
                           
                         
                         
                           axisY 
                         
                       
                       
                         
                           0 
                         
                         
                           0 
                         
                         
                           1 
                         
                       
                     
                     ] 
                   
                 
               
               
                 
                   ( 
                   2 
                   ) 
                 
               
             
           
         
       
     
         [0000]    where f is the focal length, axisX and axizY are the coordinates of the principal point. The matrix R is the combination of three rotational matrices shown in equation (3): 
         [0000]    
       
         
           
             
               
                 
                   
                     
                       
                         R 
                         = 
                           
                          
                         
                           
                             R 
                             z 
                           
                            
                           
                             R 
                             y 
                           
                            
                           
                             R 
                             x 
                           
                         
                       
                     
                   
                   
                     
                       
                         = 
                           
                          
                         
                           
                             [ 
                             
                               
                                 
                                   
                                     cos 
                                      
                                     
                                         
                                     
                                      
                                     γ 
                                   
                                 
                                 
                                   
                                     sin 
                                      
                                     
                                         
                                     
                                      
                                     γ 
                                   
                                 
                                 
                                   
                                     
                                         
                                     
                                      
                                     0 
                                   
                                 
                               
                               
                                 
                                   
                                     
                                       - 
                                       sin 
                                     
                                      
                                     
                                         
                                     
                                      
                                     γ 
                                   
                                 
                                 
                                   
                                     cos 
                                      
                                     
                                         
                                     
                                      
                                     γ 
                                   
                                 
                                 
                                   0 
                                 
                               
                               
                                 
                                   0 
                                 
                                 
                                   0 
                                 
                                 
                                   1 
                                 
                               
                             
                             ] 
                           
                           × 
                           
                             [ 
                             
                               
                                 
                                   
                                     cos 
                                      
                                     
                                         
                                     
                                      
                                     β 
                                   
                                 
                                 
                                   
                                     0 
                                      
                                     
                                         
                                     
                                   
                                 
                                 
                                   
                                     
                                       - 
                                       sin 
                                     
                                      
                                     
                                         
                                     
                                      
                                     β 
                                   
                                 
                               
                               
                                 
                                   0 
                                 
                                 
                                   1 
                                 
                                 
                                   0 
                                 
                               
                               
                                 
                                   
                                     sin 
                                      
                                     
                                         
                                     
                                      
                                     β 
                                   
                                 
                                 
                                   0 
                                 
                                 
                                   
                                     cos 
                                      
                                     
                                         
                                     
                                      
                                     β 
                                   
                                 
                               
                             
                             ] 
                           
                           × 
                         
                       
                     
                   
                   
                     
                       
                           
                          
                         
                           [ 
                           
                             
                               
                                 1 
                               
                               
                                 0 
                               
                               
                                 0 
                               
                             
                             
                               
                                 0 
                               
                               
                                 
                                   cos 
                                    
                                   
                                       
                                   
                                    
                                   α 
                                 
                               
                               
                                 
                                   sin 
                                    
                                   
                                       
                                   
                                    
                                   α 
                                 
                               
                             
                             
                               
                                 0 
                               
                               
                                 
                                   
                                     - 
                                     sin 
                                   
                                    
                                   
                                       
                                   
                                    
                                   α 
                                 
                               
                               
                                 
                                   cos 
                                    
                                   
                                       
                                   
                                    
                                   α 
                                 
                               
                             
                           
                           ] 
                         
                       
                     
                   
                 
               
               
                 
                   ( 
                   3 
                   ) 
                 
               
             
           
         
       
     
         [0000]    where parameters α, β, and γ represent the angles of rotation around camera coordinate system axes X, Y, and Z, respectively. The matrix T is the translation matrix shown in equation (4): 
         [0000]    
       
         
           
             
               
                 
                   T 
                   = 
                   
                     [ 
                     
                       
                         
                           1 
                         
                         
                           0 
                         
                         
                           0 
                         
                         
                           
                             - 
                             
                               t 
                               1 
                             
                           
                         
                       
                       
                         
                           0 
                         
                         
                           1 
                         
                         
                           0 
                         
                         
                           
                             - 
                             
                               t 
                               2 
                             
                           
                         
                       
                       
                         
                           0 
                         
                         
                           0 
                         
                         
                           1 
                         
                         
                           
                             - 
                             
                               t 
                               3 
                             
                           
                         
                       
                     
                     ] 
                   
                 
               
               
                 
                   ( 
                   4 
                   ) 
                 
               
             
           
         
       
     
         [0000]    where t 1 , t 2 , and t 3  are the translations along X, Y, and Z axes. Assuming the world coordinates of the central vanishing point on the ground plane of the camera coordinate system to be X=0, Y=∞, Z=0, the projection in the image plane(cvpX=image x coordinate of the central vanishing point in the image plane) is already estimated. Thus, for the projection of the central vanishing point onto the image plane, x=cvpX and y=cvpY. Note that the world coordinates of the central vanishing point are independent of the camera&#39;s position with respect to the vehicle. 
         [0089]    Replacing K, R, and T in equation (1) with known α, β, X, Y, Z, x, and y, results in equation (5) in which only the angle γin R y  is unknown. 
         [0000]        A  cos γ+ B  sin γ= C  
 
         [0000]    
       
      
       where,  
      
     
         [0000]      A=f sin αsin β(5)
 
         [0000]      B=f cos α
 
         [0000]        C =( cvpX− axis X )sin αcos β
 
         [0090]    By solving the sinusoidal equation, the last rotation angle, roll or γ, is estimated. 
         [0091]    III. Rear Camera 
         [0092]    The approach for the rear camera  12   b  is similar to the approach for the front camera  12   a  discussed above. However the ROI location will be different since the tracking direction is the opposite of the front camera. And the angle/distance lookup table will also be different due to the different geometries involved. 
         [0093]    IV. Side Camera 
         [0094]    The side cameras  12   c ,  12   d , which are installed in the mirrors on the side of the vehicle, also need to be calibrated online during the life cycle of the system  100  to assure the seamless stitching of the images captured by all four cameras. It is feasible to use an algorithm similar to the OC algorithm  150  for front and rear cameras to calibrate the side cameras. 
         [0095]    Those skilled in the art will understand that a variety of modifications may be made to the particular embodiments discussed herein without departing from the fair scope of the invention as defined by the following claims.