Abstract:
A method and apparatus for determining certain ambient conditions in a scene by analyzing a sequence of images that represent the scene. The apparatus uses only image information to determine scene illumination, or the presence of shadows, fog, smoke, or haze by comparing properties of detected objects, averaged over a finite video sequence, against properties of the reference image of the scene as that scene would appear without any objects present. Such a reference image is constructed in a manner similar to time-averaging successive camera images.

Description:
This patent application claims benefit of U.S. provisional patent application Ser. No. 60/006100 filed Oct. 31, 1995. 
    
    
     The invention relates to image processing techniques and, more particularly, to a method and apparatus for detecting objects within a sequence of images. 
     BACKGROUND OF THE DISCLOSURE 
     Many computer vision systems for automatic surveillance and monitoring seek to detect and segment transitory objects that appear temporarily in the system&#39;s field of view. Examples include traffic monitoring applications that count vehicles and automatic surveillance systems for security. These systems often require different object detection and segmentation methods depending on the ambient conditions. An example of such a system is disclosed in U.S. patent application Ser. No. 08/372,924 filed Jan. 17, 1995, the disclosure of which is incorporated herein by reference. 
     The three primary ambient conditions that can create a need for different detection and segmentation methods are: scene illumination, for example whether it is day or night, the presence of shadows, and scene is obscured due to log, smoke or haze. For example, in a traffic monitoring system, the detection method at night may be specialized for detecting headlights and therefore may not be applicable during the daytime. Also, on bright days, objects may cast shadows that interfere with accurate object segmentations, and therefore require that an additional shadow removal method be used. Finally, on very foggy days, reliable object detection may be impossible, and therefore the monitoring system operates in a fail-safe mode. 
     If an automatic monitoring system is to operate autonomously over an extended period of time, it should preferably include a method for determining the ambient conditions within a scene so that the system can use the appropriate detection method in response to those conditions. 
     Previous work on determining scene illumination, shadow presence, or fog presence has been based on image analysis. Some deployed systems predict scene illumination and shadow presence using an internal clock, knowledge of latitude and longitude, and a precomputed calendar of sun positions. This, however, is not robust to overcast days or foggy weather. 
     Additionally, approaches based on raw image intensity thresholds are very unlikely to be robust. 
     Therefore, there is a need for a method and apparatus for determining the ambient conditions in a scene including scene illumination and the presence of shadows, fog, smoke or haze. 
     SUMMARY OF THE INVENTION 
     The invention is a method and apparatus for determining certain ambient conditions in a scene by analyzing a sequence of images that represent the scene. The invention uses only image information to determine scene illumination, or the presence of shadows, fog, smoke, or haze by comparing properties of detected objects, averaged over a finite video sequence, against properties of the reference image of the scene as that scene would appear without any objects present. Such a reference image is constructed in a manner similar to time-averaging successive camera images. 
    
    
     BRIEF DESCRIPTION OF THE DRAWINGS 
     The teachings of the present invention can be readily understood by considering the following detailed description in conjunction with the accompanying drawings, in which: 
     FIG. 1 is a block diagram of an image processor of the present invention; 
     FIG. 2 depicts a flow diagram of a method for determining scene illumination; and 
     FIG. 3 depicts a flow diagram of a method for determining ambient conditions from energy differences in the sequence of images as compared to a reference image. 
    
    
     To facilitate understanding, identical reference numerals have been used, where possible, to designate identical elements that are common to the figures. 
     DETAILED DESCRIPTION 
     FIG. 1 depicts an image processor 100 for generating a reference image and an object image, wherein a sequence of images generated by an image source 102 (e.g., video camera or video storage media) is converted to digital form in analog-to-digital converter (A/D) 104 and processed using pyramid processor 106, image stabilizer 108, reference image generator 110, frame store 112, reference image processor 114 and subtractor 116. The reference image is derived and updated using reference image generator 110 and a frame store 112. The processor 100 produces a reference image and an object image. The reference image represents the background imagery of a scene captured by the field of view of a video camera or some other imaging sensor while the object image represents moving or temporarily stopped objects (non-background) imagery of the scene. The reference and object images are further processed by an object processor to determined the ambient environment of the scene. 
     Each image of the image sequences are typically decomposed into a specified number of Gaussian pyramid levels by pyramid processor 106 for reducing pixel density and image resolution. Pyramid processor 106 is not essential, since the apparatus could be operated at the resolution of the 640×480 pixel density of a video camera 102. However, because this resolution is higher than is needed downstream for the apparatus, the use of pyramid processor 106 increases the system&#39;s computational efficiency. Not all levels of the pyramid must be used in each computation. Further, not all levels of the pyramid need be stored between computations, as higher levels can always be computed from lower ones. However, for illustrative purposes it is assumed that all of the specified number of Gaussian pyramid levels are available for each of the downstream computations discussed below. A preferred pyramid processor 106 is a pyramid processing circuit described in U.S. Pat. No. 5,359,674, the disclosure of which is incorporated herein by reference. 
     Image stabilizer 108 employs electronic image stabilization to compensate for camera motion and jitter. In general, camera motion causes pixels in the image to move (i.e., change) without there being actual object motion in the scene. The stabilizer 108 compensates for image translation from image-to-image that is due to camera rotation and/or sway. The stabilizer achieves continuous alignment to within one pixel between the reference image within frame store 112 and each new input image. The required shifting of the input image to achieve alignment is determined using a matched filter to locate two known landmark features in the scene as captured by the images and aligning all images with respect to these landmarks. 
     The reference image generator 110 performs a recursive temporal filtering operation on each corresponding pixel of the successive stabilized image frames applied as an input thereto. Put mathematically, 
     
         r.sub.t- (x,y)=(r.sub.t-1 (x,y)+gx[i.sub.t (x,y)-r.sub.t-1 (x,y)] 
    
     where r t  represents the reference image after frame t, and i t  represents the t&#39;th frame of the input image frame sequence. The constant g determines the &#34;responsiveness&#34; of the construction process. Other algorithms for reference image generation may also be used. 
     The &#34;responsiveness&#34; setting of g must be sufficiently slow to keep transitory objects that appear in the scene from being included in the reference image. As such, after initializing the reference image and updating the image with a few new input images, (i.e., an initialization phase), the stored reference image in frame store 112 comprises only the stationary background objects being viewed by the image source. Such a &#34;responsiveness&#34; setting of g is incapable of adjusting r t  quickly enough to add illumination changes to the reference image. This problem is solved using the reference image processor 114. 
     The processor 114 contains an illumination/AGC compensator that generates a reference image after the reference image pixel intensities have been passed through a linear function of the form k t  x+c t , where the value of k t  and c t , are generated by reference image processor 114 and respectively represent the estimated gain and offset between the reference image r t  and the current image i t . Processor 114 computes this gain and offset by plotting a cloud of points in a 2D space in which the x-axis represents gray-level intensity in the reference image, and the y-axis represents gray-level intensity in the current image, and fitting a line to this cloud. The cloud is the set of points (r t-1  (x,y),i t  (x,y)) for all image positions x,y. This approach will work using any method for computing the gain and offset representing illumination change. For example, the gain might be estimated by comparing the histograms of the current image and the reference image. 
     The above approach allows fast illumination changes, which can usually be modeled as a gain and offset, to be added to the reference image while preventing transitory objects from being added. It does so by giving the reference image processor 114 the flexibility to decide whether the new reference image pixel values should be computed as a function of pixel values in the current image or whether they should be computed simply by applying a gain and offset to the current reference image. By applying a gain and offset to the current reference image the illumination change can be simulated without running the risk of allowing transitory objects to appear in the reference image. 
     The result is that the amplitude of the stationary background manifesting pixels of the illumination-compensated current image appearing at the output of reference image processor 114 will always be substantially equal to the amplitude of the stationary background manifesting pixels of the reference image, which includes solely stationary background manifesting pixels, appearing at the output of frame store 112. Therefore, subtractor 116, is coupled to image stabilizer 108 and processor 114 and produces the difference between the amplitudes of corresponding pixels applied as inputs thereto. These differences represent significantly-valued pixels that manifest solely moving object in each one of successive 2D image frames. The output of subtractor 312 is forwarded to an object processor 118. 
     The object processor comprises an object detection and tracking processor 120 that conventionally detects the objects in the scene and tracks the objects as each object moves over time. To facilitate and improve object tracking, the present invention provides a scene illumination processor 122 that analyzes the object image to determine the illumination environment (e.g., day, night, fog and the like) of the scene. This illumination information is coupled to the object detection and tracking processor 120 such that the processor 120 can select appropriate detection and tracking routines that perform optimally in the present scene illumination environment. 
     FIG. 2 depicts a flow diagram of a routine 200 for determining scene illumination. At step 202, a set of non-background pixels in an image I, (object image) each is classified as &#34;bright&#34; or &#34;dark&#34;, depending on whether the total image intensity in some limited region centered on it is greater than or less than the total image intensity in the same region in the reference image R. This assumes the reference image R is aligned pixel-for-pixel with the image I. 
     Over some finite number of images from a sequence of video images representing the sampling period on which the day/night determination is to be based, the total number of dark n dark  and bright n bright , non-background pixels detected is determined relative to a reference intensity. The intensity is the brightness of the pixel itself. The number of pixels classified as bright is counted and, at step 206, the number of pixels classified as dark is counted. The sum n dark  +n bright . yields the total number of non-background pixels that were detected. 
     Using comparator step 208, the scene can be classified as well-lit or poorly-lit, or, in outdoor scenes, daytime or nighttime, using the fraction 
     
         f.sub.dark =n.sub.dark /(n.sub.dark +n.sub.bright.). 
    
     Assuming that the objects being detected have surface colors obtained from a uniform distribution, and that the mean background intensity is roughly in the middle of this distribution, then f dark  should be approximately 0.5. However, if the scene is poorly-lit, the background image will be dark, and it will be difficult to detect any pixel with a dark surface color. Under this condition f dark  becomes small. Therefore, a simple test can be used to determine whether the scene is well- or poorly-lit: if f dark  &gt;α, then the scene is well-lit. Otherwise it is poorly-lit. In practice, using α=0.2 has proven to make accurate determinations for outdoor scenes. 
     A different routine is used to detect fog/haze and shadow presence in the scenes. FIG. 3 depicts a flow diagram of a routine 300 for ambient condition detection (e.g., shadow/fog/haze detection). 
     Specifically, the presence of shadows is also determined using the concepts of bright and dark non-background pixels. At step 302, the pixels (or regions) of the object image are separated into bright and dark regions. 
     At steps 304 and 306 for each non-background pixel having the coordinates (x, y) in an image G, the routine defines the &#34;energy&#34; at (x, y) as a function of the intensity differences between pixels near (x, y). In practice, the following energy measure has been used: ##EQU1## where E(x,y) is the intensity of the pixel at position (x,y) in the image G and W(x,y) represents a &#34;windowing&#34; function producing a set of pixels which are taken to be the &#34;neighbors&#34; of pixel (x, y), and where W(x,y) is the cardinality of this set. Other energy functions can also be used. 
     Given an image I (object image) and the reference R (reference image), the energy difference at a pixel (x, y) is defined as 
     
         ediff(x,y)=|energy(I,x,y)-energy(R,x,y)|. 
    
     Over the same sample time period used to determine day/night, the mean energy difference of all the bright non-background pixels, and the mean or average energy difference of all the dark non-background pixels are computed and denoted as E bright . and E dark , respectively. For computational efficiency, one can classify a sparse sampling of the pixels rather than attempting to classify each pixel. This sparse sampling can be specified by the user, using an image mask, so that the sampling occurs only in those places where transitory objects are likely to appear. As an example, in a traffic monitoring application, a sampling mask that restricted sampling only to image locations that fell on the roadway can be used. 
     The size of the set produced by the neighborhood function W that is used to compute the energy may vary with pixel location (x,y) or may be a fixed size independent of location. W may be derived from the same mask that is used to select the pixels that are to be classified as background or non-background. The same principle may be applied within the routine 200 for determining scene illumination. 
     At step 308, the routine processes the values E dark  and E bright . to detect the presence of shadows in the scene. Specifically, empirical study has shown that under typical shadow conditions on smooth background surfaces such as roadways, E dark  /E bright  &gt;1.2. Under diffuse illumination, for example on overcast day, in outdoor scenes, or when shadows are quite short, E dark  /E bright . is significantly smaller. This is because the neighborhood window function W used in the energy measure typically spans both the object and the background, and therefore the energy function measures the contrast between the object and the background. In brightly-lit scenes where shadows are likely, the background is likely to appear quite bright, and therefore bright objects will contrast less sharply against the background than will dark objects. 
     At step 310, the presence of fog, haze, or smoke is detected by examining the magnitude of E bright . and E dark . In well-lit conditions, E dark  should be greater than some minimum; otherwise the scene has poor contrast and fog is likely. In poorly-lit conditions, E bright . should be greater than some minimum; otherwise, fog is likely. 
     It is to be understood that the apparatus and method of operation taught herein are illustrative of the invention. Modifications may readily be devised by those skilled in the art without departing from the spirit or scope of the invention. The invention can be used in any system for automatic surveillance and monitoring or wherever a need exists to determine ambient conditions from a sequence of images.