Login| Sign Up| Help| Contact|

Patent Searching and Data


Title:
STATIC SOILING DETECTION AND CORRECTION
Document Type and Number:
WIPO Patent Application WO/2017/001096
Kind Code:
A1
Abstract:
A method and device for detecting image artifacts. Pixel transition values of camera images are computed in a first direction by comparing intensity differences between neighbouring pixels with an upper threshold and a lower threshold and setting a corresponding pixel transition value. A low pass filter with respect to time and a spatial filter are applied to the pixel transition values. Pixels of potential artifact regions are identified by comparing magnitude values of the smoothed pixel transition values with a predetermined detection threshold. A method and device for correcting image artifacts. Pixel quotient values of camera images are computed for a first direction. The quotient values are derived from an image intensity of a pixel divided by an intensity of a neighbouring pixel in the first direction. Median values of the respective pixel quotient values are computed. A pixel attenuation factor is obtained as an iterative solution of a matrix equation, wherein a matrix of the matrix equation comprises the median values. Corrected pixel intensities are obtained by dividing the observed pixel intensities by the corresponding pixel attenuation factors.

Inventors:
GUERREIRO RUI (GB)
Application Number:
PCT/EP2016/060379
Publication Date:
January 05, 2017
Filing Date:
May 10, 2016
Export Citation:
Click for automatic bibliography generation   Help
Assignee:
CONTINENTAL AUTOMOTIVE GMBH (DE)
International Classes:
G06T7/00; B60S1/08; G06T5/00
Domestic Patent References:
WO2003060826A12003-07-24
Foreign References:
DE102011013527A12012-01-05
EP1258403A22002-11-20
EP2351351A12011-08-03
Other References:
JINWEI GU ET AL: "Removing image artifacts due to dirty camera lenses and thin occluders", ACM TRANSACTIONS ON GRAPHICS (TOG), vol. 28, no. 5, 1 December 2009 (2009-12-01), US, pages 1, XP055269428, ISSN: 0730-0301, DOI: 10.1145/1618452.1618490
LIN S ET AL: "Removal of Image Artifacts Due to Sensor Dust", INTERNET CITATION, 1 January 2007 (2007-01-01), pages 1 - 8, XP002563625, Retrieved from the Internet [retrieved on 20100211]
ANONYMOUS: "algorithm - How to calculate or approximate the median of a list without storing the list - Stack Overflow", STACK OVERFLOW, 27 January 2010 (2010-01-27), XP055269426, Retrieved from the Internet [retrieved on 20160428]
Download PDF:
Claims:
CLAIMS

1. A method for detecting image artifacts, comprising

- receiving image data from a vehicle camera, the image data comprising image frames,

- comparing intensity differences between neighbouring pixels in a first direction with a pre-determined upper threshold and with a pre-determined lower threshold,

- setting a pixel transition value to a first value when the intensity difference is greater than the pre¬ determined upper threshold, setting the pixel transition value to a second value when the intensity difference is less than the pre-determined lower threshold and setting the pixel transition value to zero when the intensity difference lies between the pre-determined upper thresh¬ old and the pre-determined lower threshold,

- computing accumulated pixel transition values of the pixel transition values by applying a low pass filter with respect to a frame index,

- computing smoothed pixel transition values by applying a spatial filter with respect to pixel locations,

- computing a magnitude value of the smoothed and accu¬ mulated pixel transition values for the pixel locations of the image frame,

- identifying pixels of potential artifact regions by comparing the magnitude value with a predetermined de¬ tection threshold.

2. The method of claim 1, comprising

- comparing intensity differences between neighbouring pixels in a second direction with the pre-determined up- per threshold and with the pre-determined lower thresh¬ old,

- setting the pixel transition value to the first value when the intensity difference is greater than the pre¬ determined upper threshold, setting the pixel transition value to the second value when the intensity difference is less than the pre-determined lower threshold and set¬ ting the pixel transition value to zero when the intensity difference lies between the pre-determined upper threshold and the pre-determined lower threshold,

The method of claim 1 or claim 2, the computation of output values of the low pass filter comprises computing an accumulated value at a frame index f for the respec¬ tive first or second direction as a weighted sum of the accumulated value at the earlier frame index f - 1 and the smoothed pixel transition value at the earlier at frame index f.

The method of claim 3, wherein a weight factor of the accumulated value at the earlier frame index f - 1 is at least 0.95.

A method for correcting image artifacts, comprising

- receiving image data from a vehicle camera, the image data comprising image frames,

- computing pixel quotient values in a first direction, wherein the pixel quotient values are derived from a quotient, the numerator of the quotient comprising an image intensity at a given pixel location and the de¬ nominator comprising an image intensity at a neighbouring pixel in the first direction, - computing median values of the pixel quotient values with respect to time,

- computing attenuation factors of pixel locations as an approximate solution to a system of linear equations in the attenuation factor, the system of linear equations comprising a first set of linear equations, in which the median values appear as pre-factor of the attenuation factors, and a second set of linear equations, which de¬ termine values of the attenuation factors at respective pixel locations,

- deriving corrected pixel intensities by dividing the observed pixel intensities by the corresponding attenua¬ tion factors B (x, y) of the respective pixel locations.

The method according to claim 5, comprising

computing pixel quotient values in a second direction, wherein the pixel quotient values are derived from a quotient, the numerator of the quotient comprising an image intensity at a given pixel location and the de¬ nominator comprising an image intensity at a neighbouring pixel in the second direction, wherein the median values are computed for the pixel quotient values in the first direction and for the pixel quotient values in the second direction.

The method according to claim 5, comprising using the method according to one of the claims 1 to 4 for deter¬ mining the second set of linear equations.

The method according to one of the claims 4 to 6, wherein the median value is computed as a streaming me¬ dian value, the streaming median value being derived from a median value estimate for the previous frame in¬ dex f - 1 and the pixel quotient value at frame index f.

The method according to claim 8, wherein the streaming median value of the current frame index is computed by adding a pre-determined value delta to the previous es¬ timate if the pixel quotient value is greater than the previous streaming median value, by subtracting the predetermined value delta if the pixel quotient value is less than the previous streaming median value, and by setting the current streaming median value to the previous streaming median value otherwise.

The method according to claim 9, wherein the pre-factors of the attenuation factors are defined by a constraint matrix, the method comprising multiplying the system of linear equations with the transposed constraint matrix and solving the resulting system of linear equations using an iterative method.

A computer program product for executing a method according to one of the claims 1 to 10.

A computation unit for detecting image artifacts, the computation unit comprising

an input connection for receiving image data,

an output connection for outputting locations of detected pixels,

wherein the computation unit is operative to

compare intensity differences between neighbouring pixels in a first direction with a pre-determined upper threshold and with a pre-determined lower threshold, set a pixel transition value to a first value when the intensity difference is greater than the pre¬ determined upper threshold, setting the pixel transition value to a second value when the intensity difference is less than the pre-determined lower threshold and setting the pixel transition value to zero when the intensity difference lies between the pre-determined upper thresh¬ old and the pre-determined lower threshold,

compute accumulated pixel transition values of the pixel transition values by applying a low pass filter with respect to a frame index,

compute smoothed pixel transition values by apply¬ ing a spatial with respect to pixel locations,

compute a magnitude value of the smoothed and accu¬ mulated pixel transition values for the pixel locations of the image frame,

identify pixels of potential artifact regions by comparing the magnitude value with a predetermined de¬ tection threshold.

A vehicle camera with the computation unit according to claim 12, wherein the vehicle camera is connected to the input connection of the computation unit.

A computation unit for correcting image artifacts, the computation unit comprising

an input connection for receiving image data,

an output connection for outputting corrected image frames, wherein the computation unit is operative to

- compute pixel quotient values in a first direction, wherein the pixel quotient values are derived from a quotient, the numerator of the quotient comprising an image intensity at a given pixel location and the de¬ nominator comprising an image intensity at a neighbouring pixel in the first direction,

- computing median values of the pixel quotient values with respect to time,

- compute attenuation factors of pixel locations as an approximate solution to a system of linear equations in the attenuation factor, the system of linear equations comprising a first set of linear equations, in which the median values appear as pre-factor of the attenuation factors, and a second set of linear equations, which de¬ termine values of the attenuation factors at respective pixel locations,

- derive corrected pixel intensities by dividing the ob¬ served pixel intensities by the corresponding attenua¬ tion factors B (x, y) of the respective pixel locations.

15. A vehicle camera with the computation unit according to claim 14, wherein the vehicle camera is connected to the input connection of the computation unit.

Description:
STATIC SOILING DETECTION AND CORRECTION

Present day passenger vehicles are increasingly equipped with camera-based assistance systems, which capture the surround- ing environment of the vehicle, and provide a variety of functions for improving driving safety and comfort. The func ¬ tionality of these systems is based on the analysis of the recorded image data. Therefore, the quality of the system's predictions is directly related to the quality of the image data.

One factor that affects the image quality and which is diffi ¬ cult to control is the degree of contamination of the optical system of the camera. The cameras may be positioned at places with less risk of contamination, or the cameras may be cleaned by an electric wiper. Despite of these provisions, it is impossible to avoid a contamination of the optical system completely. Therefore, it has been proposed to detect dirt particles on a camera lens automatically in order to trigger an appropriate action. An example for such an automatic de ¬ tection of lens contaminations is disclosed in the European patent application EP 2351351.

In a first aspect, the present specification discloses a com- puter implemented method for detecting image artifacts.

Image data with image frames is received from a vehicle cam ¬ era, for example over an automotive data bus, and an inten ¬ sity difference between neighbouring pixels in a first direc- tion of an image frame is compared with a pre-determined up ¬ per threshold and with a pre-determined lower threshold. The first direction may correspond to the rows of an image frame. Furthermore, the pixel transition values can also be computed in a second direction, or y-direction, with respect to the pixel locations of the image frame. Thereby, the over- all detection quality can be improved and stripe shaped arti ¬ facts can be avoided. The second direction may correspond to the columns of an image frame.

A pixel transition value is set to a first value when the previously computed intensity difference of neighbouring pix ¬ els is greater than the pre-determined upper threshold. The pixel transition value is set to a second value when the in ¬ tensity difference is less than the pre-determined lower threshold and the pixel transition value is set to zero when the intensity difference lies between the pre-determined up ¬ per threshold and the pre-determined lower threshold.

In particular, the upper threshold can be set to a positive value and the lower threshold to a negative value, and the positive and the negative value can have equal magnitude. The upper threshold and the lower threshold may also be equal and, in particular, they may both be equal to zero. The first value can be chosen as a positive value, such as 1 or a posi ¬ tive constant a, and the second value can be chosen as a negative value, such as -1 or as the negative of the first value .

If the intensity difference is exactly equal to one of the thresholds it may be set to the respective first or second value or it may be set to zero. The pixel transition value is also referred to as "transition type". Accumulated pixel transition values are computed from the pixel transition values of corresponding pixel locations of the image frames by applying a low pass filter with respect to time, wherein time is represented by the frame index. In one embodiment, the low pass filter is computed as an accumu ¬ lated value at a frame index f for the respective first and second direction. The accumulated value is computed as a weighted sum of the accumulated value at the earlier frame index f - 1 and the pixel transition value at the earlier frame index f. In particular, the weight factor of the accu ¬ mulated value at the earlier frame index f - 1 may be set to at least 0.95. Thereby, a major contribution comes from the previous estimation, which results in a low pass filter. Furthermore, the accumulated pixel transition values are smoothed out with respect to the pixel locations by applying a spatial filter to the pixel locations, in particular by computing a convolution of the spatial filter. In particular, the spatial filter can be provided as filter with filter co- efficients between 0 and 1 that fall off to zero as a func ¬ tion of a difference from a central point, for example by a circular filter.

In one embodiment, the low pass filtering with respect to time is performed before the spatial filtering. In another embodiment, spatial filtering is performed before the low pass filter with respect to time. In the first case, the low pass filter is applied to the pixel transition values to ob ¬ tain accumulated pixel transition values and the spatial fil- ter is applied to the accumulated pixel transition values. In the second case, the spatial filter is applied to the pixel transition values to obtain smoothed pixel transition values and the low pass filter with respect to time is applied to the smoothed pixel transition values.

The pixel transition values that have been accumulated with respect to time and smoothed with respect to the pixel loca ¬ tions (x, y) are referred as "smoothed and accumulated pixel transition values". This expression refers to both sequences of filtering. In one embodiment, the spatial filter is realized as an aver ¬ aging filter, for which the filter coefficients add up to 1. This is equivalent to a total volume of 1 under the filter function if the filter is defined step-wise and the coordi ¬ nates (x, y) have a distance of 1.

Magnitude values of the pixel locations are computed for the smoothed pixel transition values of the pixel locations. If the smoothed pixel transition values are computed with re ¬ spect to one direction only, the magnitude values can be com- puted by taking the modulus.

If the smoothed pixel transition values are computed with re ¬ spect to the first direction and with respect to the second direction, a magnitude value can be computed by adding the squared values for the respective first and second direc ¬ tions, and in particular, it can be computed as an L2-norm, which is also referred to as Euclidean norm. Then, the pixels of potential artifact regions are identified by comparing the magnitude value for given pixel locations (x, y) with a pre- determined detection threshold. In a further aspect, the present specification discloses a computer implemented method for correcting image artifacts. According to this method, image data with image frames is re ¬ ceived from a vehicle camera, for example via an automotive data bus .

Pixel quotient values for the respective pixel locations are computed in a first direction, or x-direction. In particular, the first direction can be provided by the rows of an image frame. In order to improve the image correction and to avoid stripe shaped artifacts, pixel quotient values for the re ¬ spective pixel locations can also be computed in a second di ¬ rection, or y-direction. In particular, the second direction can be provided by the columns of an image frame.

A numerator of the pixel quotient value comprises an image intensity at a given pixel location and a denominator of the pixel quotient value comprises an image intensity at a neighbouring pixel in the respective first or second direc- tion. By using pixels neighbouring positions, the method is "localized", and does not combine pixels from pixel loca ¬ tions, which are far apart. This feature contributes to a sparse matrix for a system of linear equations. Median values of the pixel quotient values are computed for the respective pixel locations with respect to time, wherein time is represented by frame index. In particular, the median value can be computed as a streaming median value, which ap ¬ proximates a true median.

The attenuation factors of the pixel locations of the image frames are computed as an approximate solution to a system of linear equations in the attenuation factors of the respective pixel locations (x, y) , wherein the attenuation factors of the pixel locations are represented as a vector. The system of linear equations comprises a first set of lin ¬ ear equations, in which the previously determined median val ¬ ues appear as pre-factor of the respective attenuation factors. Furthermore, the system of linear equations comprises a second set of linear equations, which determine values of the attenuation factors at corresponding pixel locations. In particular, the second set of linear equations may be determined by the abovementioned method for identifying image artifacts.

A corrected pixel intensity for a pixel of the image frame at a given time t is derived by dividing the observed pixel in ¬ tensity by the previously determined attenuation factor B (x, y) , where the attenuation factor lies between 0 and 1.

In a particular embodiment, the median values of the pixel quotient values are obtained as streaming median values of the pixel quotient values up to a frame index f. The stream ¬ ing median value is derived from a median value estimate for the previous frame index f - 1 and the pixel quotient value at frame index f.

The streaming median value approximates the true value of a median. The streaming median value of the current frame index and pixel is computed by adding a pre-determined value

"delta" to the previous estimate if the current pixel quo- tient value is greater than the previous streaming median value. If the current pixel quotient value is less than the previous streaming median value, the pre-determined value "delta" is subtracted from the previous streaming median value. Otherwise, the current streaming median value is set to the previous streaming median value. In particular, the abovementioned system of linear equation can be solved approximately using an iterative method. A num ¬ ber of iteration steps may be determined in advance or in de ¬ pendence of a convergence rate. The pre-factors of the attenuation factor in the linear equa ¬ tions can be defined as elements of a constraint matrix. In one embodiment, the method comprises multiplying the system of linear equations with the transposed constraint matrix. The resulting system of linear equations is solved using an iterative method. In particular, the iterative method can be provided by a conjugate gradient method, which is used for finding the minimum of a quadratic form that is defined by the resulting equation. According to a further aspect, the present specification discloses a computation unit for carrying out the abovementioned method of detecting image artifacts, for example by providing integrated circuits, ASICS, microprocessors computer readable memory with data and computer readable instructions and the like.

The computation unit comprises an input connection for receiving image data and an output connection for outputting locations of detected pixels. For a bidirectional data con- nection, the output and input connections may also coincide. The locations of detected pixels can also be marked in a mem- ory area, for example by providing pointers to data struc ¬ tures etc.

The computation unit is operative to execute the abovemen- tioned artifact detection method, in particular, the computa ¬ tion unit is operative to compare intensity differences be ¬ tween neighbouring pixels in a first direction with a predetermined upper threshold and with a pre-determined lower threshold and to set a pixel transition value according to the intensity difference.

The computation unit sets the pixel transition value to a first value when the intensity difference is greater than the pre-determined upper threshold, to a second value when the intensity difference is less than the pre-determined lower threshold and sets the pixel transition value to zero when the intensity difference lies between the pre-determined up ¬ per threshold and the pre-determined lower threshold. Furthermore, the computation unit computes accumulated pixel transition values of the respective pixel transition values by applying a low pass filter with respect to a frame index or with respect to time. The computation unit computes smoothed pixel transition values by applying a spatial filter to the accumulated pixel transition values and computes a magnitude value of the smoothed pixel transition values for the pixel locations of the image frame.

The computation unit outputs the detected pixels via the out- put connection, for example by storing a reference to pixel locations or the coordinates of the pixel locations of the detected artifacts in a computer readable memory of the com ¬ putation unit.

Then, the computation unit identifies pixels of potential ar- tifact regions by comparing the magnitude value with a prede ¬ termined detection threshold.

Moreover, the present specification discloses a vehicle cam ¬ era with the aforementioned computation unit, wherein the ve- hicle camera is connected to the input connection of the com ¬ putation unit.

In a further aspect, the present specification discloses a computation unit for correcting image artifacts. The computa- tion unit comprises an input connection for receiving image data and an output connection for outputting corrected image frames, which may also coincide for a bidirectional data con ¬ nection . The computation unit is operative to execute the abovemen- tioned method for correcting image artifacts. In particular, the computation unit is operative to compute pixel quotient values in a first direction, wherein the pixel quotient val ¬ ues are derived from a quotient. The numerator of the quo- tient comprising an image intensity at a given pixel location and the denominator comprising an image intensity at a neighbouring pixel in the first direction.

Furthermore, the computation unit computes median values of the pixel quotient values with respect to time and computes attenuation factors of the respective pixel locations of the image frame. The attenuation factors are computed as an ap- proximate solution to a system of linear equations in the at ¬ tenuation factor, the system of linear equations comprising a first set of linear equations and a second set of linear equations .

The equations of the first set of equations relate the value of an attenuation factor at a first pixel location to the value of an attenuation factor at an adjacent or neighbouring pixel location in the respective first or second direction. In the first set of linear equations, the median values ap ¬ pear as pre-factor of the attenuation factors.

The second set of linear equations determines values of the attenuation factors at respective pixel locations, which are known by other means, for example by using the abovementioned artifact detection method.

Then, the computation unit derives corrected pixel intensi ¬ ties by dividing the observed pixel intensities, or, in other words, the pixel intensities in the received current image frame, by the corresponding attenuation factors B (x, y) of the respective pixel locations.

Furthermore, the present specification discloses a vehicle camera with the computation unit for correcting the image artifacts, wherein the vehicle camera is connected to the input connection of the computation unit.

The subject matter of the present specification is now ex- plained in further detail with respect to the following Fig ¬ ures in which Figure 1 shows an image of a vehicle camera that contains image contaminations,

Figure 2 shows a pixel variation measure of the image of

Fig. 1 in the x direction,

Figure 3 shows a pixel variation measure of the image of

Fig. 1 in the y direction,

Figure 4 shows the result of smoothing out the image of Fig,

2 by convolution with a circular filter, Figure 5 shows the result of smoothing out the image of Fig,

3 by convolution with a circular filter,

Figure 6 shows an overall pixel variation measure that is computed from the arrays of Figs. 4 and 5, Figure 7 shows the result of thresholding the overall pixel variation measure of Fig. 6,

Figure 8 shows an image with an overlaid synthetic blur

mask,

Figure 9 shows a corrected image, which is derived from the image of Fig. 8,

Figure 10 shows a pixel variation measure ξ_χ in the x- direction of Fig. 8,

Figure 11 shows a pixel variation measure ξ_y in the y- direction of Fig. 8,

Figure 12 shows the synthetic blur mask,

Figure 13 shows the estimated blur mask,

Figure 14 shows an original image with artifacts,

Figure 15 shows a corrected image,

Figure 16 shows a pixel variation measure ξ_χ in the x- direction of Fig. 14,

Figure 17 shows a pixel variation measure ξ_y in the y- direction of Fig. 14,

Figure 18 shows an estimated image attenuation or blur mask, and Figure 19 shows an image defect correction system according to the present specifcation .

DETAILED DESCRIPTION

In the following description, details are provided to de ¬ scribe the embodiments of the present specification. It shall be apparent to one skilled in the art, however, that the em ¬ bodiments may be practised without such details.

A common assumption in imaging systems is that the radiance emitted from a scene is observed directly at the sensor. How ¬ ever, there are often physical layers or media lying between the scene and the imaging system. For example, the lenses of vehicle cameras, consumer digital cameras, or the front win ¬ dows of security cameras often accumulate various types of contaminants over time such as fingerprints, dust and dirt. Also, the exposure of cameras to aggressive environments can cause defects in the optical path, like stone chips, rifts or scratches at the camera lens. Artifacts from a dirty camera lens are shown in Fig. 1.

These artifacts can be disturbing for users and can seriously impair the analysis of the scene by automatic methods. For example, in the automotive area, the wrong analysis of a sce ¬ ne may lead to the turning off or malfunction of security system when they are needed in case of an accident, to false alarms, or to unwanted action from the vehicle like an erro ¬ neous automatic break action. These artifacts can cause po- tentially life-threatening situations. One possible prevention measure against dirty lenses is to clean them at pre-determined times. However, because many camera systems are automated and are not often inspected, such as many automotive systems, an automatic way of detect- ing such artifacts is needed. Similarly, an automatic way of detecting lens damage that cause image artifacts is needed. A method that detects that there are issues on the lens can no ¬ tify a human that it needs attention or it can disable or no ¬ tify the methods that follow it that that particular part of the image is not usable.

In cases where it is not practical or commercially viable to clean or change the camera, such as for applications like outdoor security cameras, underwater cameras or automotive cameras or for videos captured in the past, a computational algorithm according to the present specification may provide advantages by artificially removing the artifacts caused by dirt or by a lightly damaged-lens , so that the methods ana ¬ lyzing the images can operate properly.

Unlike image inpainting and hole-filling methods, an algo ¬ rithm according to the present specification makes use of a computational model for the process of image formation to de ¬ tect that the lens are dirty or directly recover the image information, in particular those image points which are still partially visible in the captured images.

Artifacts caused by dirt and lens damage as well as artifacts caused by obstructions can be described using an image for- mation model in which the scene radiance is reduced, either by attenuation, in the case of lens dirt or light lens dam ¬ age, or, in the case of occluders, by obstruction. In gen- eral, attenuation tends to make the affected regions darker. Because of camera defocus, this attenuation is smooth-varying and the high frequencies in the original scene radiance are partially preserved in the degraded images.

This can be seen in Fig. 1, where the edges of the background are still partially visible on the degraded image.

The current specification discloses two types of image cor- rection methods, which make use of these observations. Ac ¬ cording to a first type of method a method a location where the lens contains attenuation or occluding-type artifacts is detected. According to a second type of method, the amount by which the images are attenuated at each pixel is detected and s an estimate of the artifact-free image is obtained. The methods use only the information measured from a sequence of images, which is obtained in an automated way. They make use of temporal information but require only a small number of frames to achieve a solution. The methods according to the present specification do not require that the images are to ¬ tally uncorrelated, but only that there is some movement, as the one expected in, for example, a moving vehicle. The meth ¬ ods work best when the statistics of the images being cap ¬ tured obeys a natural image statistics.

There are few methods on the literature that deal with this issue. The method SIGGRAPH according to the reference "Remov ¬ ing Image Artifacts Due to Dirty Camera Lenses and Thin

Occluders", by J. Gu, R. Ramamoorthi, P.N. Belhumeur and S.K. Nayar, in ACM Transactions on Graphics (Proceedings of

SIGGRAPH Asia), Dec. 2009, attempts to detect and correct the artifacts in image sequences but requires that the output of computing the mean image and mean image derivative magnitude over time are mostly constant valued image-sized arrays ex ¬ cept where artifacts are located (see Fig. 6 b) and c) of the aforementioned paper.

This means that these quantities are only usable after a very large amount of frames, i.e., a long time, and that the scenes have to be very diverse and uncorrelated . While the first condition imposes a long detection time, the latter one is typically not applicable at all, since the scenes in most real-life scenarios have always about the same type of con ¬ tent, e.g., a road below and sky above for automotive appli ¬ cations. The authors themselves recognize that lighting is typically unevenly distributed and propose a solution with inferior quality.

Image inpainting and hole-filling techniques assume that the location of the artifacts are known and then replace the af ¬ fected areas with a synthesized estimate obtained from the neighboring regions. By contrast, a correction method accord ¬ ing to the present specification makes use of information of the original scene that is still partially accessible to re ¬ cover the original scene. In many cases, the result is more faithful to the actual structure of the original unobserved image. In areas where the image is totally obstructed, inpainting methods can be used.

The reference "Removal of Image Artifacts Due to Sensor Dust" by C. Zhou and S. Lin, Association for Computing Machinery, Inc., June 2007 describes reducing the appearance of dust in an image by first formulating a model of artifact formation due to sensor dust and then using contextual information in the image and a color consistency constraint. This method has a very narrow application range, i.e., the detection of dust particles, and minimizes a non-convex function, which may be computationally intensive and instable.

Finally, some methods detect areas in the image that rarely contain high frequencies. Although drops of water on the lens and obstructing dirt has this effect, attenuating artifacts exhibit a transparency-type effect that lets a lot of high frequencies from the scene go through. This means that such areas would not be detected.

Figs. 1 to 7 illustrate a method for detecting image attenua ¬ tions according to a first embodiment of the present specifi- cation. Figs. 8 to 18 illustrate a method for correcting im ¬ age contaminations according to a second embodiment of the present specification.

In the Figures 1 - 18, the pixel numbers in the x-direction are indicated on the x-axis and the pixel numbers in y- direction are indicated on the y-axis. The image format of the image in Figs. 1 - 18 is about 1280 x 800 pixels.

According to a first embodiment, a detection method is dis- closed, which is suitable for detecting if there is a distur ¬ bance in the optical path caused by attenuating or obstruct ¬ ing elements. The model for describing attenuating or obstructing elements is:

I f = I of -B, (1) where If is the observed image with artifacts, the index " f" , which is also referred to as time index "t", is a frame index that numbers the image frames in the order of their re ¬ cording, I 0 f is the original unobserved image and B E [0,1] is the attenuation mask, where 0 indicates total obstruction and 1, no obstruction. The intensity "I" refers to luminance val ¬ ues, but similar processing can be done in RGB or in other color spaces. Computing the horizontal derivative of the pre ¬ vious equation leads to

l f (x + l,y) - If(x,y) = / 0/ O + l,yB(x + l,y) - I Qf {x,y)B(x,y), (2) wherein x and y are respective horizontal and vertical pixel indices and the pixels are number consecutively in the verti ¬ cal and the horizontal directions. In cases where there is no change in the attenuation mask, i.e., B{x + l,y) = B{x,y) , this equation becomes l f {x + l,y) - l f {x,y) = S(x, y)(/ 0 (x + l,y) - / 0/ O, y))- (3)

According to natural image statistics, pixel intensities vary very little between consecutive pixels in most of the image, with very few exceptions. This is the principle behind JPEG compression, which works by not transmitting the high- frequency components of the image, i.e., the variations, for most of the image. Equivalently, many ill-posed problems such as image restoration or other recovery methods impose that the lasso, also known as "least absolute shrinkage and selec ¬ tion operator", or the ^-norm of the image derivatives is minimized, which translates the observation that most deriva- tive values have about zero magnitude and only a few excep ¬ tions occur.

Considering that each pixel intensity value Io/{x > y is given by the addition of an idealized value and noise following a Normal distribution (0,σ 2 ) with zero mean and some variance, a typical model, the smooth variation of natural images can be represented as

/ 0 (x + 1, y) - lof(x, y) ~ JV 0, σ 2) r which implies that

I f (x + l,y) -I f (x,y) ~ {Q,B{x,y) 2 o 2 ), meaning, among other things, that the derivatives of If(x,y) have about the same amount of positive and negative values.

These considerations are used to detect that a variation ex ¬ ists in B at a particular location and direction of the image, by counting the average amount of positive minus nega- tive transitions that occur. If there is a predominance of positive or negative transitions by, say, 20%, there is a variation in the value of B and, therefore, attenuation. This is done by first computing the transition type,

where T is a threshold. A threshold T = 0 is used in the ex ¬ perimental analysis to obtain the Figures 2 and 3. The cor ¬ rected Figures 9 and 15, the time averaged transition magni ¬ tudes of Figs. 6 and 7 and the estimated blur masks of 13 and 18 have been obtained with a moving camera and after applying the method for a few frames.

Then, an Infinite Impulse Response (IIR) filter in time is used to accumulate the transitions,

S x f (x,y) = aS x f 1 (x,y) + (1 - a)S fx (x,y) , (7) where the superscript f and the subscript f indicate a frame number and a is the feedback filter coefficient of the IIR filter. ¾(x, ) may be initialized with 0.

One way of determining a as a function of a number of frames F is given by determining a value of a that makes a positive detection achieve a value of 0.95 after filtering with F frames, which can be shown to be given by the expression

Using about F = 600 frames for update time, which is equiva ¬ lent to about 20 seconds, a value of a = 0.99 is reached, which is used in the experimental analysis.

and

Sy(x,y) = aS^{x,y) + (1 - a)S fy (x,y). f f

The results of computing the arrays S x (x,y and S y (x,y) for the image of Fig. 1, are shown in Figs. 2 and 3, respectively. In Figs. 2 and 3, a black colour signifies a negative transi ¬ tion, a white colour signifies a positive transition and a grey colour signifies no transition.

In the particular application of detecting attenuations caused by dirty lenses, the attenuation is out of focus. This means that B varies smoothly and a transition at a particular pixel should be accompanied by similarly signed transitions at pixels nearby. To constrain the method so that it only finds smooth-varied attenuation maps, 5^( , ) and S y (x,y) are blurred with a circular filter K whose coefficients add up to 1, S {x,y) <- S {x,y) * K and S y {x,y) <- S y {x,y) * K, wherein * denotes the convolution, and the expressions left of the arrows refer to the results of the convolution. The intensity values of the resulting smoothed out arrays 5^( , ) and S y (x,y) are illustrated in Figs. 4 and 5, respectively, if the original image is given by Fig. 1. Isolated black and white pixels and stripe shaped arti ¬ facts, which are still present in Figs. 2 and 3, are sup- pressed or eliminated in Figs. 4 and 5, and the light and dark regions are more contiguous and have smoother bounda ¬ ries .

Herein, a "circular filter" refers to a filter that is circu- larly symmetric with respect to the spatial dimensions x and y. A symmetric multivariate Gaussian filter or a Mexican-hat shaped filter are examples for circular filters. Naturally, any filter shape and type can be used, depending on image resolution and camera and filter properties.

Then the overall magnitude Sf(x,y) of a transition at the pixel location (x,y) is computed as the Euclidean norm of the indi ¬ vidual magnitudes for the x- and y- directions: and a transition exists if Sf(x,y)≥T 2 . In the experimental analysis of Fig. 7, a threshold T 2 = 0.2 is used. The computa ¬ tion of the sign, the addition for many pixels (in this case) and a threshold is denoted in the robust statistics litera- ture as the sign test. Fig. 6 shows the intensities of the array Sf(x,y), and Fig. 7 shows the thresholded array Sf(x,y), when the recorded image is provided by Fig. 1.

Fig. 7 shows that the algorithm detects dirt regions but also other time independent features with strongly varying intensities such as the lens border and the border of the car from which the image is taken. Features like the car border and the lens border are always present in the image and can be identified and masked out easily. Conversely, the

thresholding according to Fig. 7 can also be used to identify image portions which are not affected by dirt, scratches and the like.

Second embodiment: correcting the attenuation According to a second embodiment of the present specifica ¬ tion, a method is disclosed for determining an amount of at ¬ tenuation and for obtaining an estimate of the artifact-free image based on the determined amount of attenuation. This em- bodiment is illustrated in the Figs. 8 - 18. Fig. 8 shows an image with an overlaid artificial contamination with a blur mask that comprises the letters "t e s t". Fig. 9 shows a re ¬ covered image, which is derived from the image of Fig. 8 ac ¬ cording to the below mentioned image recovery algorithm. Fig. 10 shows a pixel variation measure ξ χ in the x-direction of Fig. 8 and Fig. 11 shows a pixel variation measure ξ γ in the y-direction of Fig. 8. The computation of the pixel variation measure is explained further below. Fig. 12 shows the actual blur mask and Fig. 13 shows the es ¬ timated blur mask, which is obtained by solving the below mentioned equation (19) . The final result of Fig. 9 is ob ¬ tained by solving the below mentioned equation (21) . Figs. 14 - 18 show the analogous results to Figs. 8 to 13 us ¬ ing the original image and a real contamination instead of an artificial blur mask. Fig. 14 shows the original image, Fig. 15 shows the corrected image using the below mentioned image correction method. Fig. 16 shows a pixel variation measure ξ χ in the x-direction of Fig. 14 and Fig. 17 shows a pixel variation measure ξ γ in the y-direction of Fig. 14. Figure 18 shows an estimated blur mask or attenuation.

If natural image statistics holds and pixel intensities vary very little between consecutive pixels in most of the image, with very few exceptions, the intensities of neighboring pixels in the uncontaminated image are approximately equal,

which means that a non-zero derivative at this pixel is caused by the influence of the attenuation factor B. Thereby the derivative equation becomes, in the pixels where this assumption holds,

l f {x + l,y) - lf x,y) = l of (x,y)B(x + l,y) - I of (x,y)B(x,y)

= l x,y)(B(x + l,y) - B{x,y))

If(x+l,y) _ B(x+l,y)

I f (x,y) B(x,y) (10) (10)

The previous equation shows that, in locations where the image varies smoothly, the quantity f x (x, ) depends only on B, which is constant in time during the recording of the video. Therefore, x (x,y) is also constant in time. If x (x,y) is not constant, it is because the initial assumption that the image varies smoothly is failing at that particular pixel and frame .

According to natural image statistics, this occurs rarely in natural images. The method according to the current specifi- cation takes this into account by considering these different values as outliers value of f x (x, ) with respect to time. To estimate the central value of % x (x,y) r many techniques that deal with outliers can be used but arguably the best one is the median, which is a robust statistic with a breakdown per- centage of 50%. The estimation of the median value of f x (x, ) according to the definition of the median requires storing many frames and then, for each pixel, sorting the pixel intensity values at position (x, y) and obtaining the central one. This is in gen- eral not a practicable solution. According to the present specification an approximation to the median is computed instead, according to a method which is described below.

Streaming median

Consider a one-dimensional sequence of numbers p(t) , teN 0r and that we want to estimate an approximation of the median of all points observed up to the last observation t, m(t) . Then an approximation of the median can be calculated according to the following method. A starting value m(— 1) of the median estimate m(t) is initialized with some value (e.g., zero) and then, for each new observation pit), compute - 1) + Δ if p(t) > m(t - l) (11) m(t) = - 1) - Δ if p(t) < m(t - 1)

m(t— 1) otherwise where Δ is a suitably chosen value and t is a time index, such as the frame index f. This method does not require that all previous values of m are stored and does only a compari ¬ son and an addition per point and observation, which is very efficient from a computational and storage point of view. Al- so, as t→ oo , m(t)→ median({p(0), ... , p(t)}) , or, in other words, the median estimate approaches the real value of the median for sufficiently large values of t. Concerning the value of Δ, if Δ is too small, m(t) will tend towards the real value of the median too slowly. If Δ is too large, it will tend towards the value of the real median quickly but will then oscilate too much.

Although a constant value of Δ, which was obtained experimen ¬ tally, is used in the exemplary embodiment of Figs. 8 - 18, a possible approach could consist of starting with a large Δ for fast convergence and then, once ni(t) stabilizes, a small Δ for increased precision.

Other approximations of values that are obtained by analyzing a ranked set of data can be obtained, too.

By making the upward and downward changes different, other approximations can be achieved. For example, the first and third quartiles can be computed respectively as: m t - 1) + Δ/2 if p(t) > m(t - 1) (12) First quartile: m(t) = { m t - 1) - 3Δ/2 if p(t) < m(t - 1)

m(t— 1) otherwise

and

m t - 1) + 3Δ/2 if p(t) > m(t (13)

Third quartile m(t - 1) - Δ/2 if p(t) < m(t

m(t— 1) otherwise.

Estimating the attenuation factor B

The attenuation factor B is estimated using the previously calculated streaming median method to estimate an approxima tion x(x,y of the median value of f x (x,y) over time. Using the relationship

■>(¾ + !,y) B(x + l,y) r (14) l f (x,y) - B{x,y) ~ obtained before, it follows that

B(x + ,y) - B(x,y)&(x,y) = 0 , (15) which indicates how values of B are related with each other. A similar derivation shows for the vertical derivatives

B(x,y + 1)- Β(χ,γ)ξ γ (χ,γ) = 0, (16) where ξ γ is an estimate of the median of

By setting some values of B to 1 in locations where it is de ¬ termined that there is no attenuation or obstruction, a set of constraint equations for B (x, y) is obtained,

B(x,y) = l. (18)

The pixel locations (x, y) may be obtained, for example, by using the detection method according to the first embodiment. The equations (15), (16) and (18) can be represented in ma ¬ trix form through the equation

Sb = r, (19) where b represents the array B reshaped as a column vector with dimensions (#X x #Y) x l , wherein the vector b is formed by taking each row of B consecutively, 5 is a sparse matrix of size (# constraints) x (#X x #Y) and r is a column vector with di- mensions (# constraints) x 1.

The number of constraints "tconstraints" is equal to the num ¬ ber of constraint equations (15), (16) and (18). The number of constraints is approximately (#X-1)*#Y horizontal con- straints plus (#Y-1)*#X vertical constraints plus N con ¬ straints for N points in which B is known.

The matrix S is obtained by writing the constraints of equa ¬ tions (15), (16) and (18) into S. Each constraint is written into a row 1 of the sparse matrix S, wherein values of S, which are not assigned a value, have a value of zero. In par ¬ ticular, the matrix S can be stored efficiently in computer memory by only storing non-zero coefficients. According to one embodiment, the matrix S is constructed as follows. The counter variable 1 is initialized with value 1 and is incremented with every new constraint that is added and the coordinate (x, y) traverses the pixel locations row by row starting with (x, y) = (1, 1) . If there is a con- straint for (x, y) from equation (15), coordinate (1, (y-

1)*#X + x + 1) of S is set to 1, coordinate (1, (y-l)*#X + x) is set to —%x(x, y) , and coordinate (1, 1) or r is set to 0. After adding this constraint, 1 is incremented by 1. If there is a constraint for (x, y) from equation (16), coor ¬ dinate (1, y*#X + x) of S is set to 1, coordinate (1, (y- 1)*#X + x) of S is set to — y (x,y) , and coordinate (1, 1) or r is set to 0. After adding this constraint, 1 is incremented by 1. If there is a constraint for (x, y) from equation (18) the coordinate (1, (y-l)*#X + x) of S is set to 1 and the co- ordinate (1, 1) of r is set to 1, and 1 is incremented by 1. Then, (x, y) is set to the next value and the procedure is repeated .

The resulting Equation (19) may in general be overdetermined and is not solved directly. Instead, both sides of the equa ¬ tion (19) are multiplied by S T from the left, thereby obtain ¬ ing a symmetric matrix S T S: S T Sb=S T r. This equation is also known as a normal equation in the context of a least squares approximation. The normal equation is solved approximately with an iterative method, thereby obtaining the vector b. For example, the iterative method may be provided by a least square solver, such as the conjugate gradient method, which approximates the vector b that minimizes the quadratic form

-b T S T Sb - b T S T r.

2

The array B is obtained from the column vector b by reshaping the vector b back into array form. The unobserved image is estimated simply by dividing each pixel of the observed image with the estimated B for that pixel,

l 0 f{x,y) = l f {x,y)/B{x,y) (20)

for pixels (x, y) with 0<S(x,y)<l. Thereby, an attenuation B (x, y) can be compensated.

According to a modified embodiment, constraint equations of equation (18) that are not needed are identified and are not included into the matrix S. For example, an algorithm may identify boundary regions of the artifacts and exclude points (x, y) outside the boundary regions from the equations (18) and from the vector b. Or, conversely, an algorithm may be used to identify interior regions with no attenuation, B = 1 and exclude the points of the interior regions from the equa ¬ tions (18) and from the vector b.

Preferably, at least one constraint equation (18) is provided for each row of the image frames and, if present, for each column of the image frames. Thereby, the one or more known attenuation values B (x, y) can be used to find the attenua ¬ tion using equations (15) and (16) in the pixel locations in which the attenuation is not known beforehand. Fig. 19 shows, by way of example, an image defect correction system 10 according to the present application. A sensor surface 12 of a video camera is connected to an image capture unit 13 which is connected to a video buffer 14. An artifact detection unit 15 and an artifact correction unit 16 are con- nected to the video buffer 14. A display 17 is connected to the artifact correction unit 16. The dashed error indicates an optional use of an output of the artifact detection unit 15 as input for the artifact correction unit 16. Furthermore, an image evaluation unit 19 is connected to the artifact correction unit 16. Various driver assistance units such as a brake assistant unit 20, a parking assistant unit 21 and a traffic sign detection unit 22 are connected to the image evaluation unit 19. The display 18 is connected to the units 20, 21, 22 for displaying output data of the units 20, 21 and 22. The artifact detection unit 15 is operative to execute an ar ¬ tifact detection according to the first embodiment of the present specification and the artifact correction unit 16 is operative to execute an artifact correction method according to the second embodiment of the present specification, for example by providing a computing means such as a microproces ¬ sor, an integrated circuit, an ASIC, a computer readable mem ¬ ory for storing data and computer executable code etc. Although the above description contains much specificity, these should not be construed as limiting the scope of the embodiments but merely providing illustration of the foresee ¬ able embodiments. Especially the above stated advantages of the embodiments should not be construed as limiting the scope of the embodiments but merely to explain possible achieve ¬ ments if the described embodiments are put into practise. Thus, the scope of the embodiments should be determined by the claims and their equivalents, rather than by the examples given .

Among others, the pixel matrix may be traversed column-wise instead of row by row and the direction of traversing the ma ¬ trix may be reversed. The constraint equation for the at ¬ tenuation may be expressed in terms of the preceding pixel (x, y-1) or (x-1, y) instead of being expressed in terms of the next pixel (x, y + 1) or (x + 1, y) . In this case, there is no constraint equation for the first column or for the first row, respectively.