Abstract:
A system mounted in a vehicle for classifying light sources. The system includes a lens and a spatial image sensor. The lens is adapted to provide an image of a light source on the spatial image sensor. A diffraction grating is disposed between the lens and the light source. The diffraction grating is adapted for providing a spectrum. A processor is configured for classifying the light source as belonging to a class selected from a plurality of classes of light sources expected to be found in the vicinity of the vehicle, wherein the spectrum is used for the classifying of the light source. Both the image and the spectrum may be used for classifying the light source or the spectrum is used for classifying the light source and the image is used for another driver assistance application.

Description:
CROSS REFERENCE TO RELATED APPLICATION 
       [0001]    The present application benefits from U.S. provisional patent application No. 61/021,071 filed by the present inventor on Jan. 15, 2008, the disclosure of which is included herein by reference. 
     
    
     BACKGROUND 
       [0002]    1. Technical Field 
         [0003]    The present invention relates to a spectral image processor including a camera, a diffraction grating and a processor to detect and classify light sources in real time. Embodiments of the present invention are applicable to driver assistance systems (DAS). Specifically, oncoming vehicle headlights, leading vehicle taillights and streetlights, pedestrians, industrial lights and road signs are detected using a spectrum of the light sources. The spectral image processor allows for multiple DAS applications to be run simultaneously. 
         [0004]    2. Description of Related Art 
         [0005]    It is desirable for a vehicle control system to have the ability to classify various light sources including headlamps, taillights, street-lamps, house lights, and industrial lights. Schofield et al. (U.S. Pat. No. 6,831,261), disclose a headlight control device capable of identifying spectral characteristics of light sources using a camera equipped with one or more spectral filters. The spectral filters which provide the ability to distinguish red and white lights for example in the case of taillights and headlamps, also limit the use of the simultaneous use of the device of the same image frames for other driver assistance applications, such as lane departure warning and road sign detection. 
         [0006]    Although white light of a halogen headlamp and a streetlight appear to both be white, their spectral composition is quite different. The low pressure sodium and high pressure sodium arc lamps used for street-lamps and industrial lights has a very distinct spectral pattern than that of a headlamp. Other white lights and fluorescent lights have different spectral characteristics. Since these ‘white’ light sources appear the same in a color camera with for instance red/green/blue color filters. (RGB) camera the different white light sources cannot be always be easily differentiated based on discrete color information. 
         [0007]    Reference is now made to  FIG. 1  and  FIG. 2 , which illustrate a vehicle control system  16  including a camera and image sensor  12  mounted in a vehicle  18  imaging a field of view in the forward or rear direction. Image sensor  12  typically delivers images in real time and the images are captured in a time series of image frames  15 . An image processor  14  is used to process image frames  15  to perform one of a number of prior art vehicle controls. Prior art vehicle control systems include forward collision warning systems, lane departure warning systems, road sign detection, pedestrian detection and headlight control systems. 
         [0008]    Headlight control is described in a pending US application US2007/0221822 of the present inventor. US application 2007/0221822 discloses image sensor  12  which captures image frames  15  consecutively in real time for headlight detection in conjunction with other driver control systems. The light source is typically one or more of headlights from an oncoming vehicle, taillights of a leading vehicle, street signs and/or traffic signs. The image spots are characterized in terms of position, intensity, size, and shape, but not by color, i.e. color filters are not used in the camera. Since color filters are not used in the camera, the image frames are available for sharing between multiple driver assistance system without sacrificing performance. 
         [0009]    Collision Warning is disclosed in U.S. Pat. No. 7,113,867 by the present inventor. Time to collision is determined based on information from multiple images  15  captured in real time using camera  12  mounted in vehicle  18 . 
         [0010]    Lane Departure Warning (LDW) is disclosed in U.S. Pat. No. 7,151,996 by the present inventor. If a moving vehicle has inadvertently moved out of its lane of travel based on image information from images  15  from forward looking camera  12 , then the system signals the driver accordingly. 
         [0011]    Ego-motion estimation is disclosed in U.S. Pat. No. 6,704,621 by the present inventor. Image information is received from images  15  recorded as the vehicle moves along a roadway. The image information is processed to generate an ego-motion estimate of the vehicle, including the translation of the vehicle in the forward direction and the rotation. Vehicle control systems, such as disclosed in U.S. Pat. No. 6,831,261 which rely on changing exposure parameters (ie, aperture, exposure, magnification, etc) in order to detect headlights have a difficult time maintaining other control systems which rely on the same camera, e.g. Lane Departure Warning, Forward Collision Warning, etc. As a result of changing exposure parameters half or more of the (possibly critical) frames may not be available for the other control systems. This greatly affects performance of the other control systems. 
         [0012]    Hence, since in the vehicle headlight control system as disclosed in U.S. Pat. No. 6,831,261 (or in any other disclosure where special control is required of camera settings including, aperture, exposure time and magnification), the same camera cannot be conveniently used for other simultaneously operable vehicle control systems such as lane departure warning or collision warning. 
         [0013]    Additionally, the use of color cameras with infrared filters required to achieve good spectral separation reduces imaging sensitivity by a factor of six or more. A reduction in sensitivity by such a factor has an adverse impact on other vehicle control application such as LDW performance in dark scenes. The presence of an infrared filter also negates the use of the camera as a near infrared sensor for applications, such as pedestrian detection. Thus, headlight control systems which make strong use of color or spectral analysis with the use of color or absorptive or dichroic filters in the captured images (such as in U.S. Pat. No. 6,831,261) will tend not be compatible with other applications without sacrificing performance. 
         [0014]    Thus there is a need for, and it would be advantageous to have, a spectral processor adapted to identify various light sources by their spectral composition without adversely affecting use of the same image frames by other driver assistance applications. 
         [0015]    Support vector machines (SVMs) are a set of related supervised learning methods used for classification and regression. Support vector machines (SVMs) belong to a family of generalized linear classifiers Support vector machines (SVMs) can also be considered a special case of Tikhonov regularization. A special property of SVMs is that they simultaneously minimize the empirical classification error and maximize the geometric margin; hence they are also known as maximum margin classifiers. 
         [0016]    Viewing the input data as two sets of vectors in an n-dimensional space, an SVM will construct a separating hyper-plane in that space, one which maximizes the “margin” between the two data sets. To calculate the margin, two parallel hyper-planes are constructed, one on each side of the separating one, which are “pushed up against” the two data sets. Intuitively, a good separation is achieved by the hyper-plane that has the largest distance to the neighboring data points of both classes. The hope is that, the larger the margin or distance between these parallel hyper-planes, the better the generalization error of the classifier will be. 
       BRIEF SUMMARY 
       [0017]    According to an aspect of the present invention, there is provided a system mounted in a vehicle. The system includes a lens and a spatial image sensor. The lens is adapted to provide an image of a light source on the spatial image sensor. A diffraction grating is disposed between the lens and the light source. The diffraction grating is adapted for providing a spectrum. A processor is configured for classifying the light source as belonging to a class selected from a plurality of classes of light sources expected to be found in the vicinity of the vehicle, wherein the spectrum is used for the classifying of the light source. The spectrum may be sensed by the spatial light sensor. The light source may be of streetlights, headlights, taillights and traffic signs. Typically, a hood enclosure is used to limit field of view so that an image provided by said lens does not superimpose said spectrum. Both the image and the spectrum may be used for classifying the light source or the spectrum is used for classifying the light source and the image is used for another driver assistance application. The diffraction grating is a holographic diffraction grating and/or a blazed diffraction grating. The blazing may be at a wavelength selected based on a known spectrum of a known light source. The lens and the diffraction grating are optionally manufactured as a single optical element. The spatial image sensor may have one or more programmable photosensitive gain regions. A second spatial image sensor may be provided to detect the spectrum. The (first) spatial image sensor and the second spatial image sensor may have different electronic gains. 
         [0018]    According to another aspect of the present invention there is provided a method in a system including a camera equipped with a lens and a spatial image sensor. The lens provides an image of a light source on the spatial image sensor. A classifier is trained based on a multiple known spectra of light sources expected to be found in the vicinity of the system, e.g. road environment. After a trained classifier is produced, an image is detected of a light source, a spectrum of the light source is provided and located on the spatial image sensor. By applying the trained classifier, the light source is classified based on the spectrum as belonging to a class selected from a plurality of classes of light sources. 
         [0019]    The classifying may be performed by applying rules based on at least one known spectrum of the light sources expected to be found in the vicinity of the system. The classifier may include a binary classifier and/or is based on support vector machines. The classifying may be based on both the spectrum and the image. The spectrum may be produced by either a diffraction grating or a prism. 
         [0020]    According to yet another aspect of the present invention, there is provided a system including a lens and a spatial image sensor. The lens provides an image of a light source on the spatial image sensor. A diffraction grating is disposed between the lens and the light source. The diffraction grating is adapted for providing a spectrum. A processor is configured for classifying the light source as belonging to a class selected from a plurality of classes of light sources, wherein the spectrum is used for the classifying of the light source. 
         [0021]    According to yet another aspect of the present invention, there is provided a system including a diffraction grating that diffracts light from a light source and a pair of spatial image sensors. The first of the pair of spatial image sensors is disposed to receive a direct transmission of focused, diffracted light corresponding to a zeroth diffraction order. The second of the pair of spatial image sensors is disposed to receive an indirect transmission of focused, diffracted light corresponding to a first diffraction peak. A lens focuses light diffracted by the diffraction grating into images on respective ones of the pair of spatial image sensors. A first image corresponds to the zeroth diffraction order being focused on the first spatial image sensor. The second image corresponds to the first diffraction peak being focused on the second spatial image sensor. A processor uses the images sensed by the spatial image sensors to classify the light source into one of a specified set of light source classes. 
         [0022]    The foregoing and/or other aspects will become apparent from the following detailed description when considered in conjunction with the accompanying drawing figures 
     
    
     
       BRIEF DESCRIPTION OF THE DRAWINGS 
         [0023]    The invention is herein described, by way of example only, with reference to the accompanying drawings, wherein: 
           [0024]      FIG. 1  is a drawing illustrating a conventional imaging system; 
           [0025]      FIG. 2  is a drawing of a camera of the imaging system of  FIG. 1  mounted in a vehicle; 
           [0026]      FIG. 3  is a drawing illustrating a spectral camera, according to an embodiment of the present invention; 
           [0027]      FIG. 3   a  is a graph of direct light transmission of a light source through the spectral camera of  FIG. 3 ; 
           [0028]      FIG. 3   b  is a graph of a diffracted spectrum of the light source through the spectral camera of  FIG. 3 ; 
           [0029]      FIG. 4  is a illustrates a configuration of the spectral camera, according to another feature of the present invention, with two image sensors; 
           [0030]      FIG. 5  is a drawing illustrating a spectral camera, according to another aspect of the present invention, in which the diffraction grating and the lens are integrated into a single optical element; 
           [0031]      FIGS. 5   a ,  5   b  and  5   c  illustrate diffraction grating of different size and shape, according to different embodiments of the present invention, as viewed over the aperture the spectral camera along the optical axis of the spectral camera; 
           [0032]      FIG. 6  illustrates graphs of typical spectra of different light sources found at roads in the vicinity of a motor vehicle; and 
           [0033]      FIG. 7  is a flow diagram illustrating a method of classification of light sources, according to embodiments of the present invention. 
       
    
    
     DETAILED DESCRIPTION 
       [0034]    Reference will now be made in detail to embodiments of the present invention, examples of which are illustrated in the accompanying drawings, wherein like reference numerals refer to the like elements throughout. The embodiments are described below to explain the present invention by referring to the figures. 
         [0035]    Before explaining embodiments of the invention in detail, it is to be understood that the invention is not limited in its application to the details of design and the arrangement of the components set forth in the following description or illustrated in the drawings. The invention is capable of other embodiments or of being practiced or carried out in various ways. Also, it is to be understood that the phraseology and terminology employed herein is for the purpose of description and should not be regarded as limiting. 
         [0036]    The term “processor” is used herein may be a general purpose microprocessor, an application specific integrated circuit (ASIC), a system-on-chip (SoC), a field programmable gate array (FPGA) or any other electronic device known in the electronic arts, programmable or non-programmable. 
         [0037]    The term “light source” as used herein refers to direct light sources, e.g. headlamps, streetlights and indirect light sources which do not actually source light but reflect light, such as ordinary traffic signs. The terms “light source” and “object” are used herein interchangeably. 
         [0038]    The term “spectrum” as used herein refers a continuous electromagnetic ultraviolet/visible/near infrared spectrum as opposed to discrete spectral information as may be provided by one or more absorptive and/or dichroic color filters. 
         [0039]    A “spectrum” is provided according to different embodiments of the present invention with use in the optical system of “dispersive” optical element which changes (on reflection or transmission) direction of optical rays dependent on wavelength (frequency or color) of electromagnetic radiation. A “diffraction grating” and a prism are examples of a “dispersive” optical element. 
         [0040]    Although spectra of light sources in the embodiments presented is by diffraction using a diffraction grating, refraction such as by a glass prism may be similarly applied to provide a spectrum by one skilled in the art of optical design. 
         [0041]    The term “vehicle” as used herein includes (but not limited to) in different embodiments of the present invention: an automobile, helicopter, plane, and boat. In some embodiments of the present invention, detection of lights, e.g. headlamps, is performed in conjunction with other driver assistance systems being employed in the vehicle. As an example, the output of a detection system, according to an embodiment of the present invention may be used as an input for a traffic sign detection and recognition system and reduce the incidence of false (positive and/or negative) recognition of a traffic sign recognition system. A traffic sign recognition system is disclosed in co-pending EP application 07122458.8. 
         [0042]    In an embodiment of the present invention headlight control according to US2007/0221822 may have an input from a system according to an embodiment of the present invention and take advantage of the various spectral characteristics of different light sources for improved light classification. 
         [0043]    Although aspects of the present invention have been described for detecting and classifying lights in the vicinity of a vehicle, the principles of the present invention may be applied to other light sources, e.g., infrared other applications such as for military applications to identify the elements of interest, including search and rescue; location of armaments and troops, detecting atmospheric contaminants, such as poison gas; early warning missile detection systems; observation of submerged or buried mines or other impediments and tracking of supplies, as well as other applications including satellite topography. 
         [0044]    Referring now to the drawings,  FIG. 3  illustrates a spectral camera  22 , in accordance with an embodiment of the present invention. Diffraction grating  30  diffracts light from light sources  80   b . e.g. headlamps, taillights and streetlights, in the field of view of spectral camera  22 . A lens  40  focuses light from light sources onto images on image sensor  50  in the focal plane of lens  40 . A typical image sensor  50  is the Micron MT9V022 (Micron Technology Inc., Boise, Id. USA) which has 752×480 pixels and pixel size of 6 micrometer×6 micrometer. For convenience, a smaller region of image sensor  50  corresponding to a standard 640×480 (VGA) is optionally used. Lens  40  with a focal length of 4 mm. gives a 60 degree vertical field of view (VFOV) and 40 degree horizontal field of view (HIFOV). The vertical field of view of lens  40  and the horizontal field of view of lens  40  are given by equations Eq. 1 and Eq. 2, respectively: 
         [0000]      α v =2 tan −1 ( h/ 2 f ))  Eq. 1
 
         [0000]      α h =2 tan −1 ( v/ 2 f )  Eq. 2
 
         [0000]    where f=focal length of lens  40 =4 mm,
 
h=horizontal dimension of image sensor  50 =752 pixels×6 micrometers=4.5 mm, and
 
v=vertical dimension of image sensor  50 =480 pixels×6 micrometers=2.88 mm
 
         [0045]    The use of a hood enclosure  20  prevents light from unwanted light sources such as  80   a  (for example, the sun) from entering spectral camera  22 . For short lengths l of hood enclosure  20 , the overall field of view of spectral camera  22  stays approximately the same as the 60 degrees field of view calculated for lens  40  using Equation 1. The use of hood enclosure  20  with a short length l of hood enclosure  20  improves contrast of the desired images and diffracted spectra. Increasing the length l of hood enclosure  20  reduces the overall field of view of spectral camera  22 . The variation of dimensions in hood enclosure  20  allows for different vertical (y) and horizontal (x) fields of view for spectral camera  22  to be adjusted to accommodate various lens  40 , diffraction grating  30  and image sensor  50  configurations (for example see  FIGS. 4 and 5 ). The variation of dimensions in hood enclosure  20  and various lens  40 , diffraction grating  30  and image sensor  50  configurations can be selected to suit the type (height) of vehicle on which spectral camera  22  is mounted and the type of light sources to be detected and classified. 
         [0046]    Consider a configuration where lens  40  and image sensor  50  provide a horizontal FOV of 60 degrees. Diffraction grating  30  is placed in front of lens  40  producing the first order spectrum at 18 degrees. Flood enclosure  20  (or baffle) restricts the FOV to around 18 degrees. This is a novel feature since a typical camera hood is specifically designed to be outside the FOV of the lens. With hood  20  in place, the only light hitting the outer regions of sensor  50  is first order diffracted light from light sources within the 18 degrees. The spectral image is not superimposed by direct light from sources outside the 18 degree FOV. Furthermore, the only light which reaches the central part of image sensor  50  is direct light from the source within the 18 degree FOV. Thus the central image is not superimposed by diffracted light from light sources outside the 18 degree FOV. With lens  40  of 40 degrees field of view, and hood  20  restricting the FOV to 18 degrees one first order spectral image is detected for each light source  80 . With lens a 60 degree FOV both the + and − first order spectral images are detected. 
         [0047]    The governing equation for diffraction grating  30  is 
         [0000]      Sin  A +Sin  B= 1×10 −6 ×( KnL )  Eq. 3
 
         [0000]    where
 
A=angle of incidence (in degrees) of light source prior to entering grating  30 ,
 
B=angles of diffraction (in degrees) of incident light exiting diffraction grating  30 ,
 
K=integer number (+/−) orders of diffraction exiting diffraction grating  30 ,
 
n=the groove density of diffraction grating  30  in grooves per millimeter, and
 
L=wavelength in nano meters of light from light source  80   b , the light entering diffraction grating  30 .
 
         [0048]    Spectra of light emitted from light source  80   b  is provided at points  70   a  and  70   b  on image sensor  50  by angular dispersion which is the variation of the diffraction angle with wavelength and is defined as follows: 
         [0000]    
       
         
           
             
               
                 
                   
                     
                       ∂ 
                       B 
                     
                     
                       ∂ 
                       λ 
                     
                   
                   = 
                   
                     Kn 
                     
                       cos 
                        
                       
                         ( 
                         B 
                         ) 
                       
                     
                   
                 
               
               
                 
                   Eq 
                   . 
                   
                       
                   
                    
                   4 
                 
               
             
           
         
       
     
         [0049]    In an exemplary embodiment of the present invention, light source  80   b  has a typical wavelength of 620 nano meters and an incident angle of zero degrees relative to the normal of diffraction grating  30 . Diffraction grating  30  has a groove density n=500 lines per mm. The order K=0 corresponds to a direct transmission  60  of light source  80   b  through diffraction grating  30  with lens  40  focusing direct light transmission  60  onto the focal plane of lens  40  and image sensor  50 . The order K=+/−1 corresponds to the diffraction of light source  80   b  through the diffraction grating  30  with lens  40  focusing in the focal plane of lens  40  diffracted spectra  70   a  and  70   b  onto image sensor  50 . The diffracted angle B of spectra  70   a  and  70   b  being +/−17.5 degrees relative to the normal of diffraction grating  30  according to Eq. 3 for K=+/−1.  FIGS. 3   a  and  3   b  show intensity graphs of the direct light image  60  and diffracted spectrum  70   a  respectively as a function of position across image sensor  50 . A typical diffraction grating  30  is Holographic Diffraction Grating Film; Edmund Optics (Edmund Optics Inc, Barrington, N.J. USA) part number NT54-510 with 500 grooves/mm, 18 degrees diffraction angle, groove orientation linear. Grooves are placed horizontally parallel to the horizontal or x axis in spectral camera  22 . The distance separating the peaks in of direct image  60  and diffracted spectra  70   a  and  70   b  are constant on image sensor  50 . If lens  40  has a focal length of 4 mm and diffraction grating  30  has an 18 degrees diffraction angle the distance between the peaks of direct image  60  and diffracted spectra  70   a  on image sensor  50  is given by: 
         [0000]        d=f ×tan( B )  Eq. 5
 
         [0000]    where
 
d=distance between the peaks of direct image  60  and diffracted spectra  70   a  on image sensor  50 ,
 
f=focal length of lens  40 =4 mm, and
 
B=diffraction angle of diffraction grating  30 =18 degrees.
 
         [0050]    The above equation gives distance d between the peaks of direct image  60  and diffracted spectra  70   a  on image sensor  50  as 1.3 mm. If the pixel size of image sensor  50  is 6 micro meters by 6 micro meters, approximately 216 pixels distance is between direct image  60  and diffracted spectra  70   a  on image sensor  50 . Similarly a 216 pixels distance is between direct image  60  and diffracted spectra  70   b  on image sensor  50  and 432 (two times 216) pixels separates diffracted spectra  70   b  and  70   a  on image sensor  50 . An algorithm used for locating and classifying light sources  80   b , e.g. headlights and taillights, in the field of view of spectral camera  22  can make use of the fixed distances between direct image  60  and diffracted spectra  70   a  and  70   b  on image sensor  50 . 
         [0051]    Light source  80   b , e.g. headlights and/or taillights, produce diffracted spectra  70   a  and  70   b  on image sensor  50  which are typically dimmer than direct transmission  60 . Image sensor  50  is optionally chosen which has different electronic gains, one gain for the region where diffracted spectra  70   a ,  70   b  fall onto image sensor  50  and another (lower) gain for the region where direct transmission  60  of light source  80   b  falls on image sensor  50 . 
         [0052]    Reference is now made to  FIG. 4 , which illustrates another embodiment of spectral camera  22 , in accordance with an embodiment of the present invention. Diffraction grating  30  diffracts light from light sources  80 , e.g. headlights and taillights, in the field of view of spectral camera  22 . Lens  40  focuses light from light sources onto images on different image sensors  50   a  and  50   b  both in the focal plane of lens  40 . Direct transmission  60 , corresponding to zeroth diffraction order is imaged by image sensor  50   b  and a first diffraction peak is imaged by image sensor  509 . 
         [0053]    It is noteworthy that according to aspects of the present invention, the use of a dispersive optical element, e.g. diffraction grating  30 , for producing a continuous spectrum, allows for the spectrum to be used in the near infrared region, greater than ˜700 nanometer optical wavelength. The near infrared region is particularly useful in some driver assistance application such as pedestrian detection, lane detection and detection of halogen lamps. 
         [0054]    Reference is now made to  FIG. 5 , which illustrates yet another embodiment of spectral camera  22 , in accordance with another aspect of the present invention. In  FIG. 5 , diffraction grating  32  is etched or ruled on the outer surface of at least a portion of the aperture of a lens  41 , so that diffraction grating  32  and lens  41  are manufactured as a single optical element  35 . Diffraction grating  32  diffracts light from light sources  80   b , e.g. headlights and taillights, in the field of view of spectral camera  22 . Lens  41  focuses light from light sources onto images on image sensors  50  in the focal plane of lens  41 . Direct transmission  60 , corresponding to zeroth diffraction order is imaged by image sensor  50  and first order diffraction peaks  70   a  and  70   b  are imaged onto image sensor  50 . Single optical element  35  may have a diffraction grating  32  produced by a photo-lithographic process to produce holographic diffraction grating types such as plane diffraction gratings, convex diffraction gratings or concave diffraction gratings. Alternatively single optical element  35  may be a diffraction lens or even a zone plate. 
         [0055]    Reference is now made  FIGS. 5   a ,  5   b  and  5   c  which illustrate diffraction gratings of different size and shape, according to different embodiments of the present invention, as viewed along the optical axis (z) of spectral camera  22 . Diffraction grating  32  may include a portion of the aperture of the lens  40 ,  41  and a number of possibilities of shape and size of diffraction grating  32  for single optical element  35  are shown in  FIGS. 5   a ,  5   b  and  5   c.    
         [0056]    According to different aspects of the present invention, the diffraction angle (or direction) may have a horizontal or vertical component (in the plane of image sensor  50 ). In a driver assistance application, a vertical component of the diffraction direction is typically desirable since most of lights  80  in the vehicle environment tend to be distributed horizontally below the horizon, a vertical component tends to position spectra  70  in direct image positions  60  corresponding to the sky. Consequently the chances of superimposition between spectra  70  and image spots  60  is reduced when there is a significant vertical component to the diffraction angle. 
         [0057]    Reference is now made to  FIG. 6  which shows Cartesian graphs of spectra of various light sources found in typical road scenes as measured in spectral camera  20 ,  22 . In the graphs of  FIG. 6 , the x-axes (abscissa) represent spectral wavelength (in arbitrary units) as measured along image sensor  50  and the y axes (ordinate) represent measured intensity (in arbitrary units) on image sensor  50 . In the graphs of  FIG. 6 , direct transmissions  60  of the respective light sources  80 , the spectra are aligned so that direct transmissions  60  are all at arbitrary unit  100  of the x-axes of  FIG. 6 . Although the wavelength units shown are uncalibrated and do not exactly correspond to wavelengths in nanometers, the characteristic troughs in the sodium arc light spectrum at 765 nm, 800 nm, and 835 nm are clearly seen. In one approach to light source classification with spectral camera  22 , uses the particular spectral features such as the peaks and troughs in the spectrum to manually come up with rules to differentiate between the various light sources. 
         [0058]    Reference is now made to  FIG. 7 , which shows a flow diagram including a training process  700  a subsequent real time classification process  701  based on training process  700 , according to an embodiment of the present invention. A typically large data base  75  is created with real world image examples of various light sources  80 . A spot detection algorithm  101  is used to locate the direct transmission spots  60  as images of light sources  80 . Spots  60  are classified (step  102 ), for instance manually, into the various known light-source types: halogen headlight, xenon, high intensity discharge (HID) headlights, sodium arc lights, fluorescent lights etc. Diffracted spectrum  70   a ,  70   b  is located above or below image spot  60 . A region located for instance 100 pixels above the spot is used (step  103 ) as the input vector including the spectral data for the classifier, where W=11 and H=200, are the width and height respectively of the region measured in pixels. A classification algorithm  104  such as the Support Vector Machine (SVM) is trained on this input vector data. Since the SVM is a binary classifier the input data is preferably split into groups such as headlight or non-headlight. A second classifier  104  which distinguishes between taillight or non-taillight is optionally added. The above steps  101 - 104  are training steps and are performed “off-line”. When the classification algorithm is fully trained ( 700 ), the same spot detection algorithm (step  101 ) is preferably used on a real time image  76 . During “on-line” operation  701  the W×H region is located (step  109 ), to have the spectral data (step  103 ) of the image spot and input into trained classifiers  104 . The result  106  of classification  701  is used for instance in an automatic headlight control as described in US 2007/0221822. 
         [0059]    In preferred embodiments of the present invention, diffraction grating  30  is a blazed diffraction grating. Blazing diffraction grating  30 , as well known in the optical arts, causes a specific spectral range of light source  80   b  to fall into one or a few diffraction orders. Blazed gratings are manufactured to produce maximum efficiency at designated wavelengths. A grating may, therefore, be specified as “blazed at 250 nm” or “blazed at 1 micron” etc. and manufactured according to known techniques with an appropriate design of groove geometry. In different embodiments of the present invention, diffraction grating  30  is blazed at or near spectral peaks of known light sources, e.g. headlights, taillights, expected to be found in the vicinity of motor vehicles. 
         [0060]    In another embodiment of spectral camera  22 , in accordance with the present invention a spectral camera  22  is bore sighted with a conventional camera  12 . Spectral camera  22  and conventional camera  12  are placed next to each other to reduce parallax error. Conventional camera  12  is used to provide direct transmission or image spot  60  and spectral camera is used to provide diffracted spectra  70   a  and  70   b . Prior to use spectra  70  and direct images  60  are calibrated such as with monochromatic light. 
         [0061]    The definite articles “a”, “an” is used herein, such as “a lens”, “a sensor” have the meaning of “one or more” that is “one or more lenses” or “one or more sensors”. 
         [0062]    Although selected embodiments of the present invention have been shown and described, it is to be understood the present invention is not limited to the described embodiments. Instead, it is to be appreciated that changes may be made to these embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the claims and the equivalents thereof.