This application is the U.S. national phase of International Application PCT/FR2021/052157, filed Dec. 1, 2021, which designated the U.S. and claims priority to French patent application FR 20 13027, filed Dec. 10, 2020, the entire contents of which is incorporated by reference.
This application relates to a method for demosaicing an image. The method applies in particular to the demosaicing of images whose components are arranged according to a Bayer pattern in the RGB domain.
An image obtained by a multi-spectral sensor array is generally mosaiced. An image is for example acquired in the form of pixels with one color component, or “single color luminescence”, and transformed by demosaicing into pixels with several spectral bands, or “multicolor luminescence”. The initial image is thus formed of a set of pixels where each pixel of the image corresponds to only one spectral band among the spectral bands that may be captured at other pixels of the multi-spectral sensor array, each pixel of the multi-spectral sensor array only capturing a portion of the multi-spectral information.
A typical case is that of sensors organized according to the Bayer matrix, which is composed of green filters at 50% and red and blue filters at 25% each. In a Bayer matrix, each square group of four pixels comprises two green pixels on one diagonal, and one red and one blue pixel on the other diagonal. In this example, demosaicing therefore aims to interpolate the two missing values among red, green, and blue, for each pixel of the initial image.
Various demosaicing techniques have already been proposed. In particular, what is referred to as the Hamilton-Adams method is known, described in the publication by J. Hamilton Jr. and J. Adams Jr., “Adaptive color plane interpolation in single sensor color-electronic camera”, U.S. Pat. No. 5,629,734 (1997).
Also known is the publication by A. Buades et al., “Self-similarity Driven Demosaicking”, in Image Processing On Line, 2011-06-01, ISSN 2105-1232.
However, the proposed methods generally only allow obtaining limited image quality, insufficient in particular for space applications such as observation of the Earth.
In view of the above, an object of the invention is to propose a method for demosaicing images that is improved compared to the state of the art.
In this respect, the invention proposes a method for demosaicing applied to an initial image having pixels each corresponding to an initial spectral band, in order to obtain a demosaiced image with several spectral bands having pixels each corresponding to said initial spectral band or to an interpolated spectral band, characterized in that it comprises:
In some embodiments, the predetermined reference patches are distributed so as to cover a determined proportion of the image.
In some embodiments, during the determination of the covariance matrix for the set of similar patches, the similar patches comprise initial spectral bands and intermediate spectral bands, these intermediate spectral bands being derived from a prior demosaicing by linear interpolation applied to the initial image.
In some embodiments, the determination of said set of patches which are similar to each reference patch is determined by a similarity function applied to an intermediate image resulting from prior demosaicing by linear interpolation of the initial image.
In some embodiments, during the determination of the covariance matrix for the set of similar patches, the similar patches comprise initial spectral bands and intermediate spectral bands, these intermediate spectral bands being derived from a prior demosaicing by linear interpolation and a prior denoising which are applied to the initial image.
In some embodiments, the determination of said set of patches which are similar to each reference patch is determined by a similarity function applied to an intermediate image resulting from prior demosaicing by linear interpolation and prior denoising of the initial image.
The denoising may consist of a local denoising function applied to each patch and as a function of said set of patches which are similar to the patch considered.
In some embodiments, the spectral bands correspond to the RGB or YUV color space.
In some embodiments, the spectral bands correspond to the RGB color space and the pixels of the initial image are organized according to a Bayer pattern.
In some embodiments, the aggregation of estimates of the interpolated spectral bands is carried out by calculating an average of these estimates of the interpolated spectral bands.
In some embodiments, the deconstruction into four blocks according to the phasing of said similar patch is a function of the pair (L, C) corresponding to the Lth pixel and Cth pixel of said similar patch, each value of the matrix at row L and at column C being, depending on whether it concerns:
In some embodiments, for each similar patch in said set of similar patches, the calculation of estimates of the interpolated spectral bands is carried out as follows:
where:
In some embodiments, during the calculation of estimates of the interpolated spectral bands for similar patches having a same phasing, a same deconstruction of the covariance matrix into blocks occurs, these blocks being stored and reused for all these similar patches having the same phasing.
This disclosure also relates to a computer program product, comprising code instructions for implementing the method according to the preceding description, when it is executed by a computer.
This disclosure also relates to an image processing device comprising a computer, characterized in that it is configured to implement the method according to the preceding description.
Advantageously, this method makes it possible to obtain improved results in terms of reconstruction quality and robustness to noise. The method according to the invention makes it possible in particular to reduce or even eliminate iridescent-type inaccuracies.
Also advantageously, the invention makes it possible to improve the quality of a demosaiced image obtained from a sensor equipped with a Bayer filter.
The described method also makes it possible to take into account spatial distribution in the variation in accuracy, which is not necessarily isotropic, due to the covariance matrix. The method is indeed advantageously non-local and is based on the similarities between a patch of pixels of the image and a set of similar patches, which may be positioned nearby or far away in the initial image.
Other features, details, and advantages will become apparent upon reading the detailed description below, made in reference to the figures given as an example, in which:
With reference to
The demosaicing method according to the invention may be implemented by an image processing device 1 represented schematically in
The initial image is formed of a set of pixels each having an initial spectral band corresponding for example to a specific value for a color detected among a set of colors of the multi-spectral sensor.
The multi-spectral sensor may for example be of the RGB type where spectral bands detected in each pixel of the image are red, green, or blue, the sensor being equipped for this purpose with a color filter array adapted to allow only a portion of the light spectrum to pass through for each pixel of the array.
According to another embodiment, the detected spectral bands correspond to the YUV color space.
The demosaicing method may be applied to several spectral bands, such as in the color space for example, the values of certain pixels being available in the form of the initial spectral band while other missing ones are to be interpolated.
The sensor generating the initial image may, for example, have a Bayer configuration, as shown in
As represented in
This demosaicing by linear interpolation 100 may be selected from the demosaicing methods known to those skilled in the art. For example, in the case where the color space is RGB, demosaicing by linear interpolation may be implemented by means of the Hamilton-Adams algorithm, as described in U.S. Pat. No. 5,652,621.
In another embodiment, as represented in
This denoising processing 200 may be selected from the denoising processing methods known to those skilled in the art, for example such as an NL-Bayes type algorithm, as described in the article by M. Lebrun et al., “Implementation of the ‘Non-Local Bayes’ (NL-Bayes) Image Denoising Algorithm”. The NL-Bayes denoising algorithm includes for example the repetition, two times in succession, of an identification of a set of similar patches of the image in order to calculate a covariance matrix for the set of similar patches, an estimation of a denoised version, based on the covariance matrix, and an aggregation in order to obtain a denoised image. Denoising is for example implemented twice in a row, the first time on the image obtained after demosaicing by linear interpolation and the second time on the denoised image.
The denoising algorithm performs, for example, one processing per patch of the image.
It is also conceivable to perform denoising processing that does not include calculating a covariance matrix.
Throughout the remainder of the description, a patch is a square-shaped piece of the image comprising a subset of pixels of the image. A patch may comprise between 2 and 10 pixels per side and typically comprises between 3 and 5. A patch of k=5 pixels per side is used as an example in this description.
The demosaicing method then comprises, for example, a set of steps implemented on at least one patch of the image and preferably on the set of patches of the image, considered successively. Some reference patches are for example determined in advance and there are overlaps between two successive patches, so that the entire image is covered. The reference patches for example may or may not be contiguous. Contiguous reference patches for example may or may not overlap. Non-contiguous reference patches for example may be spaced more or less apart from one another. For non-contiguous reference patches, an uncovered area of the image is for example less than 50% of the image, possibly less than 25% of the image, or even possibly less than 5% of the image. The choice of proportion of the image covered by the reference patches and their possible overlap will be optimized according to the use cases. The proportion of the image covered by the reference patches is for example between 50% and 100%.
For each patch considered, designated as a reference patch, a step 310 of identifying a set of patches of the image which are similar to the reference patch is carried out. The step 310 of identifying a set of patches of the image which are similar to the patch considered may be implemented by calculating a distance between the patch considered and each of the patches of the image that are in the vicinity of the patch considered, the vicinity being defined as a portion of the image of size n×n, where n is a number of pixels strictly greater than the number of pixels k in one side of a patch, and less than or equal to the number of pixels in the smallest side of the image.
The distance may for example be a Euclidean distance or a normalized quadratic distance, which is calculated as follows between a patch P and a patch Q:
The distance may be calculated for all of patches P and Q concerned or for only a portion of them, for example a horizontal or vertical band.
The distance may be calculated in native radiometry, i.e. from the initial spectral bands in the initial image. As a non-limiting example, in the case where this space is the RGB space, the normalized quadratic distance can be calculated as the sum, over all pixels i of patches P and Q, of the distance (Pi,R−Qi,R)2+(Pi,G−Qi,G)2+(Pi,B−Qi,B)2 where the index R, G, B respectively corresponds to the component in the red, green, or blue color of patch P or Q respectively.
Alternatively, the initial image may be converted beforehand into another color space during a step 205, and the normalized quadratic distance may be calculated in this space. For example, if the initial image is in the RGB domain, the image may be converted into the YUV domain according to a transformation known to those skilled in the art. In this case, the normalized quadratic distance can be calculated on the one luminance component Y.
The distance is for example compared to a determined threshold, below which the patches are considered to be similar.
It is also possible to provide for a minimum number of similar patches corresponding to the calculated minimum distances.
It is also possible to provide for a minimum number of similar patches corresponding to the calculated minimum distances, to which are added the patches whose distance is less than the determined threshold.
According to a variant embodiment, the identification of a set of patches similar to the patch considered may comprise the application of a principal component analysis of the image in native or transformed coordinates, and the calculation of a distance (e.g. Euclidean) for the most significant components resulting from this analysis.
According to another embodiment, similar patches may be determined and stored during a prior denoising step.
The demosaicing method comprises a following step 320 of calculating a covariance matrix for the set of patches similar to the reference patch.
The covariance matrix may be calculated on the values of the pixels of the patches in the initial spectral bands represented in the initial image, or in other words in native radiometry.
According to another embodiment, the covariance matrix may also be calculated on the pixels of an intermediate image obtained via demosaicing by linear interpolation, as represented in
A covariance matrix calculated during a previous processing may possibly be reused.
For the calculation of the covariance matrix for a given set of patches, each patch P is represented by a vector (P(1) . . . P(n)) where n corresponds to the multiplication of the number of pixels contained in the patch by the number of spectral bands. For example, for the three-color space, the coordinates of the vector from 1 to n/3 correspond to the values of the pixels of the patch for the first color, the coordinates from n/3+1 to 2n/3 correspond to the values of the pixels of the patch for the second color, and the coordinates from 2n/3+1 to n correspond to the values of the pixels of the patch for the third color. Each value of a coordinate of a patch is for example:
For example, for patches in RGB colorimetry which are 5 pixels by 5 pixels in size, the patches comprise 3×5×5=75 spectral bands, of which 25 are available in the initial image and 50 are missing.
Each patch of k pixels on a side in the initial image is represented as a vector in which the first k2 terms correspond to one spectral band, for example the color red, the following k2 terms correspond to another spectral band, for example the color green, and the last k2 terms correspond to a third spectral band, for example the color blue.
The covariance matrix is therefore a matrix where each term is defined as follows:
where:
The covariance matrix therefore quantifies the covariance of the values of pixels of similar patches.
In the remainder of the method, the availability of a pixel, meaning having an initial spectral band, or the unavailability of a pixel, meaning not having an initial spectral band, is exploited for an image having several spectral bands. The locations of pixels that are available or unavailable depend on the phasing of the patch. To determine the phasing of a patch, one must consider the location on the sensor array of a corresponding patch in the initial image. In the case for example of a Bayer pattern, there are four possible phasings, of which two examples are represented in
The demosaicing method then comprises, in step 330, for each similar patch of said set of similar patches, a calculation of estimates of the interpolated spectral bands according to a block-based deconstruction of the covariance matrix, where the deconstruction into four blocks is according to the phasing of each similar patch.
With reference to
In the case of a Bayer pattern for which there are four possible phasings for the patches, all the various block-based deconstructions of the covariance matrix may be calculated and stored for later calculations.
Next, for each block-based deconstruction obtained, the missing values of each patch of a subset of patches of the set E for which the phasing corresponds to the block-based deconstruction, are estimated during a step 340 with a Bayesian estimator of the MAP type (maximum a posteriori):
where:
The estimates of the interpolated spectral bands are obtained by the following calculation:
where:
The demosaicing method then includes an aggregation step 350 in which estimates of the interpolated spectral bands for pixels of patches belonging to different sets of similar patches in relation to different reference patches. Aggregation is understood to mean the combining of different measurements into a single variable, either by simple addition of the values obtained, or by addition of weighted values. Aggregation is implemented for example by calculating an average of the estimates made for a pixel and a component.
The set of interpolated spectral bands is thus obtained. The demosaiced image according to the invention is of improved quality and has a significant reduction or even an absence of iridescence, in particular for applications requiring observation at high altitudes such as observation of the Earth.
The maximum a posteriori estimator of xm, the available noisy data yd being known, is given by:
Using the Bayes formula the following results are obtained:
is the covariance matrix of the missing data (not noisy) and available data (noisy).
We can write:
with A, B, C, D of the matrices respectively corresponding to matrices Σmm, Σmd, Σdm and Σdd.
The last term does not depend on xm and can therefore be deleted. By differentiating with respect to xm we therefore obtain:
2(xm−
2(xm−
2(xm−
As the covariance matrix is symmetric, then its inverse is also symmetric. We therefore have BT=C. Using formulas for block inversion (Shur complement) we can show that
We obtain
It is assumed that similar patches have been chosen such that
If we use denoised data to calculate the covariance matrix for the available data, we can use the approximation:
where Σdddenoised is the block of the covariance matrix calculated on the available denoised data, I is the identity matrix, and σ2 is the variance for the noise. We can show that Σmd is unchanged in this case. We obtain:
Number | Date | Country | Kind |
---|---|---|---|
20 13027 | Dec 2020 | FR | national |
Filing Document | Filing Date | Country | Kind |
---|---|---|---|
PCT/FR2021/052157 | 12/1/2021 | WO |
Publishing Document | Publishing Date | Country | Kind |
---|---|---|---|
WO2022/123145 | 6/16/2022 | WO | A |
Number | Name | Date | Kind |
---|---|---|---|
5629734 | Hamilton, Jr. et al. | May 1997 | A |
5652621 | Adams, Jr. et al. | Jul 1997 | A |
20090295934 | Au | Dec 2009 | A1 |
20190164008 | Yahata | May 2019 | A1 |
Entry |
---|
Portilla et al. (“Low-complexity linear demosaicing using joint spatial-chromatic image statistics,” IEEE International Conference on Image Processing; Date of Conference: Sep. 14-14, 2005) (Year: 2005). |
Oaknin (“A statistical learning approach to color demosaicing,” arXiv:0905.2958v3; Feb. 12, 2010) (Year: 2010). |
Muresan et al. (“Demosaicing using optimal recovery,” IEEE Transactions on Image Processing, vol. 14, No. 2, Feb. 2005) (Year: 2005). |
Antoni Buades et al., “Self-Similarity Driven Demosaicking”, https://doi.org/10.5201/ipol.2011.bcms-ssddages, Image Processing On Line, 1 (2011), 6 pages. |
Daniel Keren et al., “Restoring Subsampled Color Images”, https://www.researchgate.net/publication/220465060, Machine Vision and Applications, Dec. 1999, vol. 11, No. 4, pp. 197-202. |
Marc Lebrun et al., “Implementation of the “Non-Local Bayes” (NL-Bayes) Image Denoising Algorithm”, Image Processing On Line, 3 (2013) pp. 1-42. |
Wing-Shan Tam et al., “Modified Edge-Directed Interpolation For Images”, Journal of Electronic Imaging, 19(1), 013011 (Jan.-Mar. 2010), 20 pages. |
Xin Li et al., “New Edge-Directed Interpolation”, IEEE Transactions on Image Processing, Oct. 1, 2001, vol. 10, No. 10, pp. 1521-1527. |
International Search Report for PCT/FR2021/052157 dated Mar. 28, 2022, 3 pages. |
Written Opinion of the ISA with English Translation for PCT/FR2021/052157 dated Mar. 28, 2022, 7 pages. |
Number | Date | Country | |
---|---|---|---|
20230325970 A1 | Oct 2023 | US |