Abstract:
Electronic devices may include image sensors and processing circuitry. Image sensors may be used to capture multiple exposure images. Processing circuitry may be used to combine multiple exposure images into high-dynamic-range images. A motion correction method is provided that detects motion between multiple exposure images without using a frame buffer. A noise model is used to separate noise from motion for more accurate motion detection. A dilation operator may be used to enlarge a motion mask generated by the motion detector. Motion-corrected images may be generated from the multiple exposure images using a soft switch based on the motion strength. Motion-corrected multiple exposure images may be combined to generate a motion-corrected HDR image. A smoothing filter may be applied to the motion region of the motion-corrected HDR image. A blooming correction may be used to eliminate color artifacts in the motion-corrected HDR image.

Description:
This application claims the benefit of provisional patent application No. 61/436,952, filed Jan. 27, 2011 which is hereby incorporated by reference herein in its entirety. 
    
    
     BACKGROUND 
     The present invention relates to imaging devices and, more particularly, to imaging devices with image sensors that may be used to produce high-dynamic-range images. 
     Image sensors are commonly used in electronic devices such as cellular telephones, cameras, and computers to capture images. In a typical arrangement, an electronic device is provided with a single image sensor having an array of pixels and a single corresponding lens. Some electronic devices use arrays of image sensors and arrays of corresponding lenses. 
     In certain applications, such as when acquiring still or video images of a scene with a large range of light intensities, it may be desirable to capture high-dynamic range images. While highlight and shadow detail may be lost using a conventional image sensor, highlight and shadow detail may be retained using image sensors with high-dynamic-range capabilities. 
     Common high-dynamic-range (HDR) imaging systems use a multiple exposure (ME) image capture method. In a ME method, multiple images are captured by the image sensor, each image having a different exposure time. Short-exposure images may retain shadow detail while long-exposure images may retain highlight detail. In a typical device, pixels from short-exposure and long-exposure images are selected to create a HDR image. 
     When capturing HDR images using ME imaging systems, or any HDR imaging system using sequential exposures, a moving object will be registered at different pixel positions in each exposure. If one of the exposure times in an ME image capture is long relative to the motion of the scene or objects in the scene, object shapes will appear blurred and elongated in the direction of motion in the long exposure image. When the images are combined using conventional multiple exposure HDR image combination methods, the discrepancy in position and shape of a moving object in the multiple exposures will result in misregistration of the object in the combined HDR image. 
     It would therefore be desirable to provide improved methods of motion-corrected image combination for high-dynamic-range imaging devices. 
    
    
     
       BRIEF DESCRIPTION OF THE DRAWINGS 
         FIG. 1  shows an illustrative imaging device that can be used to capture high-dynamic-range images in accordance with an embodiment of the present invention. 
         FIG. 2A  is an illustrative diagram of two multiple exposure image frames containing a moving object and a stationary object of the type that may be captured using an imaging system of the type shown in  FIG. 1  in accordance with an embodiment of the present invention. 
         FIG. 2B  is an illustrative diagram of two multiple exposure image frames including a long-exposure image and a short-exposure image containing a moving object and a stationary object of the type that may be captured using an imaging system of the type shown in  FIG. 1  in accordance with an embodiment of the present invention. 
         FIG. 2C  is an illustrative diagram of two multiple exposure image frames including a long-exposure image and a short-exposure image containing a moving object and a stationary object of the type that may be captured using an imaging system of the type shown in  FIG. 1  in accordance with an embodiment of the present invention. 
         FIG. 3  is an illustrative diagram of a method of combing multiple exposure images to generate a motion mask in accordance with an embodiment of the present invention. 
         FIG. 4A  is an illustrative diagram of a method of generating an enlarged motion mask from a motion mask in accordance with an embodiment of the present invention. 
         FIG. 4B  is an illustrative diagram of a method of combing multiple exposure image frames with an enlarged motion mask to generate a corrected image in accordance with an embodiment of the present invention. 
         FIG. 5  is an illustrative diagram of a method of combing a multiple exposure image frame with a corrected image to generate a motion-corrected high-dynamic-range image in accordance with an embodiment of the present invention. 
         FIG. 6  is an illustrative diagram of a method of combing a multiple exposure image frame with a corrected image with a blooming correction step to generate a motion-corrected high-dynamic-range image in accordance with an embodiment of the present invention. 
         FIG. 7  is an illustrative diagram of a method of improving motion-corrected high-dynamic-range images by smoothing motion masked regions of the motion-corrected high-dynamic-range image in accordance with an embodiment of the present invention. 
     
    
    
     DETAILED DESCRIPTION 
     Imaging systems are widely used in electronic devices such as digital cameras, computers, cellular telephones, and other electronic devices. These electronic devices may include image sensors that gather incoming light to capture an image. The image sensors may include at least one image pixel array. The pixels in the image pixel array may include photosensitive elements such as photodiodes that convert the incoming light into digital data. Image sensors may have any number of pixels (e.g., hundreds or thousands or more). A typical image sensor may, for example, have hundreds of thousands or millions of pixels (e.g., megapixels). 
       FIG. 1  is a diagram of an illustrative electronic device that uses an image sensor to capture images. Device  10  may be a portable electronic device such as a camera, a cellular telephone, a video camera, or other imaging device that captures imaging data. Device  10  may include at least one camera module  12 . Camera module  12  may include an array of image pixels such as image pixel array  16  in which pixels are arranged in pixel rows and pixel columns or in other suitable arrangements. Camera module  12  may include lens  14  for focusing image light from a real-world scene onto image pixel array  16 . Camera module  12  may provide image data to processing circuitry  18 . 
     Processing circuitry  18  may include one or more integrated circuits (e.g., image processing circuits, microprocessors, storage devices such as random-access memory and non-volatile memory, etc.) and may be implemented using components that are separate from image pixel array  16  and/or that form part of image pixel array  16  (e.g., circuits that form part of an integrated circuit that controls or reads pixel signals from image pixel array  16  or an integrated circuit within pixel array  16 ). Image data that has been captured by image pixel array  16  may be processed and stored using processing circuitry  18 . Processed image data may, if desired, be provided to external equipment (e.g., a computer or other device) using wired and/or wireless communications paths coupled to processing circuitry  18 . 
     Dynamic range may be defined as the luminance ratio of the brightest element in a given scene to the darkest element the given scene. Typically, cameras and other imaging devices capture images having a dynamic range that is smaller than that of real-world scenes. HDR imaging systems are therefore required to capture representative images of scenes that have regions with high contrast, such as scenes that have portions in bright sunlight and portions in dark shadows. 
     An image may be considered an HDR image if it has been generated using imaging processes or software processing designed to increase dynamic range. As an example, HDR images may be captured by a digital camera using a multiple integration (or multiple exposure (ME)) method. In particular, multiple images of the same scene may be captured using different exposure (or integration) times. A short-exposure image captured during a short integration time may better capture details of brightly lit portions of the scene, whereas a long-exposure image captured during a relatively longer integration time may better capture details of dark portions of the scene. The short-exposure and long-exposure images may be combined into a composite HDR image that accurately represents the brightly lit as well as the dark portions of the image. 
     Some HDR imaging systems use frame-sequential exposures in which an entire image frame is captured (i.e., all pixels accumulate image data) before the subsequent image frame is captured. Other HDR imaging systems use row-sequential exposures in which a selection of pixel rows capture an image of a portion of a scene (i.e. a portion of an image frame) and the same selection of pixel rows is used to capture a second image of the same portion of the scene before subsequent rows are used to repeat the multiple exposure imaging process. 
     When capturing HDR images using frame-sequential or row-sequential ME imaging methods, or any HDR imaging system using sequential exposures, a moving object will be registered at different pixel positions in each exposure. In a long-exposure image (i.e. images captured with an exposure time that is longer than the exposure time of a corresponding short-exposure image), motion of the scene or objects in the scene may cause object shapes to appear blurred and elongated in the direction of motion in the long-exposure image. When the images are combined using conventional multiple exposure HDR image combination methods, the discrepancy in position and shape of a moving object in the multiple exposures will result in misregistration of the object in the combined HDR image. Common ME imaging systems use a Bayer color filter patterned image sensor. Combing multiple exposure images in the Bayer domain misregistered objects not only causes shape distortion but also cause severe color distortion of objects in combined HDR images. 
       FIG. 2A  is an illustrative diagram of two multiple exposure images captured using (for example) image pixel array  16  of  FIG. 1 . In the example of  FIG. 2A , image frame  1 A may contain objects such as stationary object  20  and moving object  22 . Moving object  22  may be moving in direction  26 . Image frame  1 A may contain more or less than two objects, more or less than one moving object, or may contain more or less than one stationary object. As shown in  FIG. 2A , moving object  22  has changed position during the time between the capture of image frame  1 A and image frame  2 A. The position of moving object  22  at the time frame  1 A was captured (as indicated by dashed line  24  in frame  2 A) is empty in frame  2 A. Moving object  22  occupies a different position from position  24  in frame  2 A. A conventional combination of image frame  1 A and image frame  2 A will result in two copies of moving object  22  in the combined image. 
       FIG. 2B  is an illustrative diagram of two multiple exposure images containing stationary object  20  and moving object  22  (moving in direction  26 ). In the example of  FIG. 2B , image frame  1 B is a short-exposure image and image  2 B is a long-exposure image. Due to the longer exposure time (relative to the motion of the object across the image) used to capture long-exposure image frame  2 B, moving object  22  appears in image frame  2 B as elongated object  22 E. This is because moving object  22  changed position during the capture of image frame  2 B. As shown in  FIG. 2B , elongated object  22 E partially occupies original position  24  of image frame  2 B. A conventional combination of image frame  1 B and image frame  2 B will result in an elongated, distorted image of moving object  22  in a combined HDR image. Image frames  2 A and  2 B may be Bayer color images of objects  20  and  22 . A conventional combination of Bayer color images such as frames  1 B and  2 B may result in an image of moving object  22  that suffers from color distortion (i.e. incorrect mixing of color image pixels from frames  1 B and  2 B) in addition to spatial distortion and elongation. 
       FIG. 2C  is an illustrative diagram of a short-exposure and a long-exposure image containing stationary object  20  and moving object  22  (moving in direction  26 ). As shown in  FIG. 2C , moving object  22  has changed position during the time between the end of the capture of short-exposure image frame  1 C and the start of the capture of long-exposure image frame  2 C. Moving object  22  has also moved during the capture of image frame  2 C. The position of moving object  22  at the time frame  1 C was captured (as indicated by dashed line  24  in frame  2 C) is empty in frame  2 C. Moving object  22  occupies a different position from position  24  in frame  1 B. In addition, due to the longer exposure time used to capture long-exposure image frame  2 C, moving object  22  also appears in image frame  2 C as elongated object  22 E. A conventional combination of image frame  1 C and image frame  2 C to form an HDR image will result in two copies of moving object  22  in the combined image. In addition, one of the two copies of moving object  22  in the combined HDR image will appear as elongated object  22 E. Elongated object  22 E may suffer from elongation, distortion, and color distortion (e.g., if image frames  1 C and  2 C were captured using an image sensor having a Bayer color filter or other mixed color filter array). 
       FIGS. 2A ,  2 B, and  2 C show horizontal motion and distortion of moving object  22 . In practice, the motion of moving object  22  may be in any direction relative to the field of view of camera module  12 . The distortion of elongated moving object  22 E may be in any direction relative to the orientation of image pixel array  14 . Moreover, the distortion of moving object  22  may be more complex than that shown in  FIGS. 2A ,  2 B, and  2 C. For example, image frames  1 C and  2 C may be captured using a row-sequential ME image capture method or a rolling shutter scheme in which multiple exposures of a pixel row or group of pixel rows are executed before executing multiple exposures of another pixel row or group of pixel rows. In the example of a row-sequential ME image capture, the distortion of elongated moving object  22 E may be discontinuous across the image of moving object  22 E (i.e., a portion of elongated object  22 E may be shifted with respect to another portion of elongated object  22 E). 
       FIG. 3  is a diagram of an illustrative method of creating a motion mask from two sequential image frames such as frames T 1  and T 2 . Image frames T 1  and T 2  may be captured using an image pixel array such as image pixel array  16  of  FIG. 1 . As shown in  FIG. 3 , image frames T 1  and T 2  contain stationary object  20  and moving object  30 , moving in direction  32 . Image frame T 1  may have an exposure time t 1  that is longer than the exposure time t 2  of image frame T 2 . Due to the long exposure time of frame T 1  relative to the motion of object  30  (i.e., object  30  moves across a non-negligible number of image pixels during the exposure time of image frame T 1 ), image frame T 1  may contain an elongated or distorted image of moving object  30  such as elongated image  30 E. 
     A motion mask may be an array of values, each value corresponding to a single image pixel in image frame T 1  and image frame T 2 . Each array value in the motion mask may indicate the likelihood of the corresponding pixel in either image frame T 1  or image frame T 2  containing a moving object (e.g., a value of 1 may indicate a pixel containing a moving object while a value of 0 may indicate a pixel does not contain a moving object). 
     A method for producing a motion mask from two sequential image frames may, as shown in  FIG. 3 , include generating luma images Y 1  and Y 2  from image frames T 1  and T 2 , respectively. A luma image may be computed using processing circuitry  18  of  FIG. 1  by convolving each image frame with a luma operator (e.g., a high-pass filter). For example, image frame T 1  and image frame T 2  may be convolved with the operator h, where: 
                     h   =       [         1       4       6       4       1           4       16       24       16       4           6       24       36       24       6           4       16       24       16       4           1       4       6       4       1         ]     /   256       ,           (   1   )               
according to the following equation:
 
 Y ( x,y )= h*T ( x,y ),  (2)
 
where Y(x,y) is the value of pixel (x,y) in luma image Y (e.g., luma images Y 1  and Y 2 ) and T(x,y) is the value of pixel (x,y) in image frame T (e.g., image frames T 1  and T 2 , respectively).
 
     Luma images Y 1  and Y 2  may be combined to a mean-absolute-difference (MAD) image by computing, for each pixel, the MAD of a surrounding group of pixels in luma images Y 1  and Y 2 . For example, the pixel (x,y) value of the MAD image (MAD(x,y)) may be computed using the pixels in an m×n group of pixels (where m and n may have any integer value) such as a five-by-five window surrounding pixel (x,y): 
                       MAD   ⁡     (     x   ,   y     )       =       ∑     i   ,   j       ⁢                Y   1     ⁡     (     i   ,   j     )       -     R   ·       Y   2     ⁡     (     i   ,   j     )                /   25         ,           (   4   )               
where R is the exposure ratio (i.e., the ratio of the long-exposure integration time to the short-exposure integration time) and Y 1 (i,j) is the value of pixel (i,j) of luma image Y 1  and Y 2 (i,j) is the value of pixel (i,j) of luma image Y 2 . The MAD image may then be combined with a noise model to generate the motion mask. The noise model may be based on one or both image frames T 1  and T 2 , may be based on one or both luma images Y 1  and Y 2 , may be based on a combination of image frames T 1  and T 2  and luma images Y 1  and Y 2 , or may be based on a combination of pixels from one of image frames T 1  and T 2  or luma images Y 1  and Y 2 . As an example, noise dependent thresholds qq 1  and qq 2  may be determined using the pixel gain:
 
 qq   1   =q   1 ·gain  (5)
 
and
 
 qq   2   =q   2 ·√{square root over (gain· Y   1 ( x,y ))}+ qq   1   (6)
 
where gain is a multiplicative factor applied to the raw accumulated charge in a pixel to produce an image pixel value, and where q 1  and q 2  are chosen parameters. In one preferred embodiment, q 1 =60 and q 2 =12 may be used.
 
     Alternatively, long-exposure image T 1 (x,y) may replace luma image Y 1 (x,y) in equation 6. In another example, the average value of all green pixels in a window (e.g., a 5×5 window of pixels surrounding pixel (x,y)) may be used for each (x,y) value in equation 6. Once a noise model (e.g., thresholds qq 1  and qq 2 ) has been chosen, motion mask M 0  may be computed using processing circuitry  18  as follows:
 
 M   0 ( x,y )=min( qq   2   −qq   1 ,max(0 ,MAD ( x,y )− qq   1 ))/( qq   2   −qq   1 ).  (7)
 
As shown in  FIG. 3 , motion mask M 0  has non-zero values in pixels corresponding to pixels in image frames T 1  and T 2  containing moving object  30 . The pixels in motion mask M 0  having non-zero values are indicated by motion regions  30 M.
 
     As shown in  FIG. 4A , an enlarged motion mask may be generated from motion mask M 0 . As stated above in connection with  FIG. 3 , each value M 0 (x,y) may indicate the likelihood of the corresponding pixel (x,y) in image frames T 1  and T 2  containing a moving object. Motion mask M 0  may contain continuous values between 0 and 1. If desired, the values M 0 (x,y) may be quantized using a floor operator:
 
 M   0 ( x,y )=floor( M   0 ( x,y )·256).  (8)
 
Following application of the floor operator as in equation 8, motion mask M 0  contains zero values in all pixels other than pixels in motion regions  30 M. Pixel values in motion regions  30  may contain integer values between 0 and 256.
 
     Enlarged motion mask {tilde over (M)} 0  may be computed by replacing values M 0 (x,y) with the maximum value in a window W x,y  surrounding pixel (x,y): 
                         M   ~     0     ⁡     (     x   ,   y     )       =       max     i   ,     j   ∈     W     x   ,   y             ⁢       (       M   0     ⁡     (     i   ,   j     )       )     .               (   9   )               
For example, a 5×1 window W x,y  (i.e., a set of pixels with a width of 5 pixels and a height of 1 pixel) or other window may be used. Following application of the maximum function as described in equation 9, enlarged motion mask {tilde over (M)} 0  may contain zero values in all pixels outside of enlarged motion regions  30 ME and non-zero pixel values in pixel within enlarged motion regions  30 ME.
 
       FIG. 4B  is an illustrative diagram of a method for generating a corrected long-exposure image such as corrected long-exposure image {tilde over (T)} 1  by combining long-exposure image T 1 , short-exposure image T 2  and enlarged motion mask {tilde over (M)} 0 . In one embodiment, values of pixels in image frame T 1  corresponding to non-zero pixels (i.e. in enlarged motion regions  30 ME) in enlarged motion mask {tilde over (M)} 0  may be replaced by the values of corresponding pixels in short-exposure image T 2  multiplied by exposure ratio R. As shown in  FIG. 4B , long-exposure image T 1  may contain stationary object  20  and elongated moving object  30 E, short-exposure image T 2  may contain stationary object  20  and moving object  30 , and enlarged motion mask {tilde over (M)} 0  may contain enlarged motion regions  30 ME having non-zero pixel values corresponding to the positions of object  30  (elongated in image frame T 1 ) in frames T 1  and T 2 . Corrected long-exposure image {tilde over (T)} 1  contains stationary object  20  and corrected image  30 C of moving object  30 . 
     In another embodiment, the values of pixels image frame T 1  corresponding to pixels in enlarged motion regions  30 M may be replaced by the values of corresponding pixels in short-exposure image T 2  using a soft-switching function:
 
 {tilde over (T)}   1 ( x,y )=[(256 −{tilde over (M)}   0 ( x,y ))· T   1 ( x,y )+ {tilde over (M)}   0 ( x,y )· R·T   2 ( x,y )]/256.  (9)
 
Generating corrected long-exposure image {tilde over (T)} 1  using the soft-switching function of equation 9 may help avoid hard transitions (i.e., visible edges) between regions in corrected long-exposure image {tilde over (T)} 1  corresponding to pixels inside and outside of enlarged motion regions  30 ME. Alternatively, motion mask M 0  may be used in place of enlarged motion mask {tilde over (M)} 0  in equation 9.
 
       FIG. 5  is a diagram of an illustrative method of generating a motion-corrected HDR image in accordance with an embodiment of the present invention. As shown in  FIG. 5 , motion-corrected HDR image H may be generated using processing circuitry  18  by combining corrected long-exposure image {tilde over (T)} 1  and short-exposure image T 2 . As described in connection with  FIGS. 3 and 4B , corrected long-exposure image {tilde over (T)} 1  may contain stationary object  20  and corrected moving object  30 C while short-exposure image T 2  may contain stationary object  20  and moving object  30 . Each pixel (x,y) in motion-corrected HDR image H may be determined using any linear combination of the pixel values in corrected long-exposure image {tilde over (T)} 1  and short-exposure image T 2 . In one preferred embodiment, the values of pixels (x,y) in motion-corrected HDR image H may be determined using the following equation: 
                     H   ⁡     (     x   ,   y     )       =     {                       T   ~     1     ⁡     (     x   ,   y     )       ,             if   ⁢           ⁢         T   ~     1     ⁡     (     x   ,   y     )         &lt;     S   1                   R   ·       T   2     ⁡     (     x   ,   y     )         ,             if   ⁢           ⁢         T   ~     1     ⁡     (     x   ,   y     )         &gt;     S   2                           [         (       S   2     -         T   ~     1     ⁡     (     x   ,   y     )         )     ·       T   ~     1       +       (           T   ~     1     ⁡     (     x   ,   y     )       -     S   1       )     ·   R   ·       T   2     ⁡     (     x   ,   y     )           ]     /     (       S   2     -     S   1       )       ,                     (   10   )               
otherwise, where R is the exposure ratio and where S 1  and S 2  are the knee points for the HDR linear combination. In one preferred embodiment, S 1  and S 2  may be chosen such that S 1 =S 2 −S 21 (e.g., S 2 =3900 and S 21 =1024).
 
       FIG. 6  is a diagram of another embodiment of a method for combining corrected long-exposure image {tilde over (T)} 1  and short-exposure image T 2  to generate motion-corrected HDR image H. In the example of  FIG. 6 , an additional blooming correction is applied during the combination of long-exposure image {tilde over (T)} 1  and short-exposure image T 2 . As described in connection with  FIGS. 3 and 4B , corrected long-exposure image {tilde over (T)} 1  may contain stationary object  20  and corrected moving object  30 C while short-exposure image T 2  may contain stationary object  20  and moving object  30 . 
     In a conventional CMOS image sensor, blooming charge from saturated pixels into neighboring non-saturated pixels (e.g., due to overexposure of a photosensor to light) often causes a non-linear response to light in the saturated and neighboring non-saturated pixels). Due to this non-linear response and blooming charges, in a CMOS image sensor using a Bayer color filter or other patterned color filter, blooming in a long-exposure image may result in color artifacts in combined HDR images. Color artifacts may be propagated or may be exaggerated during image combination during generation of motion-corrected HDR images (as in equation 10). As shown in  FIG. 6 , a blooming correction may be applied during image combination. Blooming correction operation  40  may use processing circuitry  18  to identify saturated pixels in long-exposure image frame T 1  and replace the saturated pixel values with pixel values in short-exposure image frame T 2 . Blooming correction method  40  may also replace pixel values in pixels neighboring saturated values, even if their long-exposure value isn&#39;t saturated. In one preferred embodiment, the booming correction may be applied by selecting L(x,y) to be the maximum pixel value in a p×q window of pixels (e.g., a p=3×q=3, p=3×q=1 or other window of pixels where p and q have integer values) centered on pixel (x,y). Blooming correction operation  40  may then use maximal window value L(x,y) as a comparison value in a soft-switching linear combination of corrected long-exposure image {tilde over (T)} 1  and short-exposure image T 2 : 
                     H   ⁡     (     x   ,   y     )       =     {                       T   ~     1     ⁡     (     x   ,   y     )       ,             if   ⁢           ⁢     L   ⁡     (     x   ,   y     )         &lt;     S   1                   R   ·       T   2     ⁡     (     x   ,   y     )         ,             if   ⁢           ⁢     L   ⁡     (     x   ,   y     )         &gt;     S   2                           [         (       S   2     -     L   ⁡     (     x   ,   y     )         )     ·       T   ~     1       +       (       L   ⁡     (     x   ,   y     )       -     S   1       )     ·   R   ·       T   2     ⁡     (     x   ,   y     )           ]     /     (       S   2     -     S   1       )       ,                     (   11   )               
otherwise, where, as described in connection with equation 10, R is the exposure ratio and where S 1  and S 2  are knee points for the HDR linear combination. In one preferred embodiment, S 1  and S 2  may be chosen such that S 1 =S 2 −S 21  (e.g., S 2 =3900 and S 21 =1024).
 
       FIG. 7  is an illustrative diagram of an additional step in generating motion-corrected HDR images that includes a smoothing operation applied to motion-corrected HDR image H. Smoothed motion-corrected HDR image {tilde over (H)} may be generated by convolving motion regions of motion-corrected HDR image H with smoothing operator  41 . Smoothing operator  41  may be a one-dimensional smoothing filter or other smoothing filter. As an example, smoothing filter  41  may be a five-tab filter such as g=[1/3,0,1/3,0,1/3]. Smoothing operator  41  may be applied to all pixels of motion-corrected HDR image H to produce a filtered image motion-corrected HDR image f(H), where f(H)=g*H (i.e. motion-corrected HDR image H convolved with smoothing filter g). 
     In another embodiment, smoothed motion-corrected HDR image {tilde over (H)} may be generated in a smoothing operation such that filter g (i.e., smoothing operator  41 ) is only applied to pixels in motion regions  30 M or in enlarged motion regions  30 ME. Smoothing operator  41  may be applied only to enlarged motion regions  30 ME using soft-switching filter operation using enlarged motion mask {tilde over (M)} 0 . The soft-switching filter operation uses soft-switching function β to scale the level of filtering of each pixel based on enlarged motion mask {tilde over (M)} 0  as shown in the following equation:
 
 {tilde over (H)} ( x,y )=β( x,y )· f ( H )( x,y )+(1−β( x,y ))· H ( x,y ),  (12)
 
where,
 
β( x,y )=min( d   2   −d   1 ,max(0 ,{tilde over (M)}   0 ( x,y )− d   1 ))/( d   2   −d   1 )  (13)
 
and where d 1  and d 2  are two threshold parameters for the soft-switching function. In one example, d 2 =256 and d 1 =d 2 −64.
 
     Various embodiments have been described illustrating methods which may be provided for high-dynamic-range imaging systems for generating motion-corrected HDR images of a scene containing a moving object. The motion-correction method may include using an image sensor to capture subsequent first and second images that include the moving object and using processing circuitry to generate a motion mask. The first image may be captured during a first exposure time and the second image may be captured during a second exposure time. The first exposure time may be longer than the second exposure time. 
     The method may include using processing circuitry to produce luma images from the first and second images by convolving the first and second images with a high-pass filter. The luma images may be combined to produce a mean-absolute-difference image by combining pixel values of an m×n group of pixels in the first and second luma images into a single mean-absolute-difference image pixel value by performing computations that include the pixel values of the m×n group of pixels. 
     The motion mask may have non-zero pixel values in a motion region that corresponds to portions of the first image that include the moving object and portions of the second image that include the moving object. The motion mask may have pixels with values equal to zero outside the motion region. The method may include generating an enlarged motion mask including an enlarged motion region that is larger than the motion region in the motion mask. The method may also include generating a corrected image by linearly combining the first and second images multiplied by the motion mask and generating a motion-corrected high-dynamic-range image based on a linear combination of the corrected image and the second image multiplied by the ratio of the first exposure time to the second exposure time. 
     If desired, the corrected image may be produced using a soft-switching function so that the corrected image includes a first region having exclusively pixel data from the first image, a second region having exclusively pixel data from the second image, and a transition region having pixel data based on data from the first image and the second image. 
     The generation of the motion-corrected high-dynamic-range image may include linearly combing the corrected image and the second image in a process in which the data for the each pixel of the motion-corrected high-dynamic-range is selected based on a comparison of a single pixel value from the first corrected image to first and second knee point values. 
     Alternatively, the generation of the motion-corrected high-dynamic-range image may include performing a blooming correction operation during the linear combination of the corrected image and the second image in which the data for the each pixel of the motion-corrected high-dynamic-range is selected based on a comparison of the maximum pixel value in a p×q group of pixels surrounding each pixel from the first corrected image to first and second knee point values. 
     The method may further include performing a smoothing operation on the motion-corrected high-dynamic-range image using processing circuitry. The smoothing operation may include smoothing pixel data in portions of the motion-corrected high-dynamic-range image corresponding to the motion region of the motion mask without smoothing pixel data in other portions of the motion-corrected high-dynamic-range image corresponding to regions outside the motion region of the motion mask. Smoothing the pixel data may include applying a soft-switching filter operation to the pixel data during smoothing the operation in which a smoothed motion-corrected high-dynamic-range image having a first region having exclusively smoothed pixel data, a second region having exclusively unsmoothed pixel data, and a transition region having pixel data based on smoothed and unsmoothed pixel data is generated. 
     The foregoing is merely illustrative of the principles of this invention which can be practiced in other embodiments.