Image color correction method and device based on t-distribution probability model

By using an image color correction method based on a t-distribution probability model, and by optimizing the color mapping function parameters using maximum a posteriori probability modeling and the EM algorithm, the problem of insufficient robustness of color correction in existing technologies is solved, and accurate color correction and image consistency are achieved even in the presence of gross errors.

CN115880166BActive Publication Date: 2026-02-03SHENZHEN SEED SPACE TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210603842.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-05-30
Publication Date
2026-02-03
Estimated Expiration
2042-05-30

AI Technical Summary

Technical Problem

Existing image color correction methods are not robust enough when there are large color differences, especially when there are gross errors, the accuracy of color consistency correction decreases. Existing methods are computationally expensive and have limited robustness.

Method used

An image color correction method based on a t-distribution probability model is adopted. Color correction is modeled by maximum a posteriori probability. It is assumed that the color residual follows a t-distribution and the quality residual follows an exponential family distribution. The EM algorithm is used to optimize the color mapping function parameters and adaptively reduce the influence of gross errors.

Benefits of technology

It improves the robustness of image color correction, enabling accurate color correction even in the presence of gross errors, thereby enhancing color consistency and image quality.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115880166B_ABST
    Figure CN115880166B_ABST
Patent Text Reader

Abstract

The application relates to the technical field of image processing, in particular to an image color correction method and device based on a t-distribution probability model, which comprises the following steps: acquiring an image to be corrected, presetting a color mapping function of each image, and determining color residuals and quality residuals; modeling color consistency as a likelihood function, modeling image quality losslessly as a prior probability, modeling color correction by using maximum posterior probability, assuming that the color residuals are subject to t-distribution and the quality residuals are subject to exponential family distribution, and generating a color correction probability model based on t-distribution; solving the parameters of the color mapping function by using an EM algorithm according to the color correction probability model based on t-distribution, and adaptively reducing the influence of gross errors in the optimization process; and correcting the image to be corrected according to the color mapping function to obtain an image with consistent colors. The method uses t-distribution to make the color correction probability model obtain adaptive robustness, and can accurately correct colors even if there are gross errors in the color residuals of the image to be corrected.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of image processing technology, specifically to an image color correction method and apparatus based on a t-distribution probability model. Background Technology

[0002] In existing technologies, image acquisition systems often suffer from color differences between images due to factors such as shooting time, viewing angle, lighting, equipment, and camera settings, leading to stitching seams in subsequent image mosaicking. To address this issue, when color differences between images are small, existing technologies employ local color correction methods, such as feathering, multi-band fusion, and Poisson fusion, to eliminate color differences. However, if the color differences between images are large, local color correction methods can result in color gradations. Therefore, when color differences between images are significant, existing technologies often use parametric methods for global color consistency correction. This involves assigning a parametric color mapping function to the image, constructing color correspondences across multiple images, and solving for the parameters of the color mapping function with color consistency as the goal. However, existing methods are quite sensitive to gross color errors; if the color correspondences are unreliable, the accuracy of color consistency correction will decrease. To address this problem, existing methods attempt to reduce the sensitivity of color correction to gross errors by constructing reliable color correspondences based on cumulative distribution functions, constructing reliable color correspondences based on change detection, reducing the weight of unreliable color correspondences, and using low-rank matrix factorization. However, these methods are computationally expensive and have limited robustness. The robustness of the method depends on the custom criteria, but universal criteria are difficult to set. In fact, the fundamental reason why existing methods are sensitive to gross errors is that they model color consistency as least squares, that is, the color consistency loss is defined as the sum of squared residuals corresponding to all colors. Least squares is equivalent to maximum likelihood estimation under the Gaussian residual assumption. The accuracy of maximum likelihood estimation depends on whether the Gaussian distribution can fit the residual distribution well. However, the probability of the Gaussian distribution assigning gross errors is very small. When there are many gross errors, it is difficult to accurately fit the residual distribution, the maximum likelihood estimation is inaccurate, and therefore the corresponding least squares solution is also inaccurate, thus affecting the robustness of color correction. Summary of the Invention

[0003] In view of this, this application provides an image color correction method and apparatus based on the t-distribution probability model to solve the problem of how to make color correction more robust when there are many gross errors in the prior art.

[0004] To address the aforementioned technical problems, this application provides an image color correction method based on a t-distribution probability model, comprising:

[0005] The process involves acquiring the images to be corrected, pre-setting color mapping functions for each image, and determining the color residuals and quality residuals. Color correction is modeled using maximum a posteriori probability, assuming the color residuals follow a t-distribution and the quality residuals follow an exponential family distribution, generating a color correction probability model based on the t-distribution. The parameters of the color mapping functions are solved using the EM algorithm based on this t-distribution probability model, where the t-distribution can adaptively reduce the impact of gross errors during optimization. Finally, the images to be corrected are corrected according to the color mapping functions to obtain images with consistent colors.

[0006] Optionally, the step of acquiring the image to be corrected, pre-setting a color mapping function for the image to be corrected, and determining the color residual and quality residual includes: acquiring a set of N images to be corrected that have overlapping regions and color differences; geometrically correcting the N images to be corrected in the image set to the same coordinate system; pre-setting N color mapping functions for the N images to be corrected; and using the color mapping functions to determine the color residual and the quality residual.

[0007] Optionally, determining the color residual using a color mapping function includes:

[0008] Image points are sampled in the overlapping areas between each pair of N images to be corrected, and color correspondences are constructed to obtain a set of residuals that express the color consistency loss between each pair of multiple images to be corrected. The number of color correspondences between each pair of N images to be corrected is counted, the balance factor is calculated, and the balanced residuals are obtained.

[0009] Optionally, the quality residual includes: gradient residual and regularized residual.

[0010] Optionally, determining the quality residual using the color mapping function includes:

[0011] Image points are uniformly sampled on a single image to be corrected to obtain residuals that express the gradient changes of the sampled image points before and after correction. A gradient balance factor is set to obtain balanced gradient residuals. Colors are sampled at fixed intervals within the color value range to obtain residuals that express the color changes of the sampled colors before and after correction. A regularization balance factor is set to obtain balanced regularization residuals.

[0012] Optionally, the correction method further includes traversing all sampled pixels and sampled colors in a single image to be corrected, aggregating all gradient residuals and regularization residuals into a vector; obtaining the vectors of N images to be corrected in the set of images to be corrected, and obtaining a set of quality residuals.

[0013] Optionally, the step of using maximum a posteriori probability to model color correction, making the color residual follow a t-distribution and the quality residual follow an exponential family distribution, and generating a color correction probability model based on the t-distribution, includes: modeling color consistency as a likelihood probability, modeling image quality preservation as a prior probability, and constructing a general framework for probabilistic modeling of color correction based on maximum a posteriori probability; and substituting the prior probability based on the exponential family distribution and the likelihood probability based on the t-distribution into the general framework for probabilistic modeling of color correction to construct a color correction probability model based on the t-distribution.

[0014] Optionally, the step of solving for the parameters of the color mapping function using the EM algorithm based on the color correction probability model of the t-distribution, wherein the t-distribution can adaptively reduce the influence of gross errors during the optimization process, includes:

[0015] Derive the iterative weighted least squares expression for a color correction probability model based on the t-distribution;

[0016] The EM algorithm is used to jointly optimize the color mapping function parameters and the t-distribution parameters.

[0017] This application also provides an image color correction device based on a t-distribution probability model, comprising:

[0018] The first module acquires the image to be corrected, presets a color mapping function for each image, and determines the color residual and quality residual. The second module models color correction using maximum a posteriori probability, assuming that the color residual follows a t-distribution and the quality residual follows an exponential family distribution, and generates a color correction probability model based on the t-distribution. The third module uses the EM algorithm to solve for the parameters of the color mapping function based on the color correction probability model based on the t-distribution. During the optimization process, the t-distribution can adaptively reduce the influence of gross errors. The fourth module corrects the image to be corrected according to the color mapping function to obtain an image with consistent color.

[0019] This application also provides a computer storage medium storing a computer program that, when executed by a processor, implements the image color correction method based on the t-distribution probability model described above.

[0020] As described above, the image color correction method based on the t-distribution probability model of this application obtains the image to be corrected, presets the color mapping function for each image, and determines the color residual and quality residual; models color consistency as a likelihood function and image quality losslessness as a prior probability, and uses the maximum a posteriori probability to model color correction, assuming that the color residual follows a t-distribution and the quality residual follows an exponential family distribution, generating a color correction probability model based on the t-distribution; according to the color correction probability model based on the t-distribution, the EM algorithm is used to solve for the parameters of the color mapping function, and the t-distribution can adaptively reduce the influence of gross errors during the optimization process; the image to be corrected is corrected according to the color mapping function to obtain a color-consistent image. This method uses the t-distribution to make the color correction probability model adaptively robust, and can accurately correct the color even if there are gross errors in the color residual of the image to be corrected. Attached Figure Description

[0021] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application. To more clearly illustrate the technical solutions of the embodiments of this application, the drawings used in the description of the embodiments will be briefly introduced below. Obviously, those skilled in the art can obtain other drawings based on these drawings without any creative effort.

[0022] Figure 1 This is a flowchart of the image color correction method based on the t-distribution probability model provided in this embodiment;

[0023] Figure 2 This is a flowchart of steps S21 to S22 in the image color correction method based on the t-distribution probability model provided in this embodiment;

[0024] Figure 3 This is a flowchart of steps S31 to S32 in the image color correction method based on the t-distribution probability model provided in this embodiment;

[0025] Figure 4 The image provided in this embodiment may contain varying areas of overlapping image coverage.

[0026] Figure 5 The corrected output image provided in this embodiment;

[0027] Figure 6 This embodiment provides an image color correction device based on a t-distribution probability model.

[0028] Figure 7 This is a schematic diagram of the electronic device provided in this embodiment.

[0029] The realization of the objectives, functional features, and advantages of this application will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. The accompanying drawings have illustrated specific embodiments of this application, which will be described in more detail below. These drawings and textual descriptions are not intended to limit the scope of the concept in any way, but rather to illustrate the concepts of this application to those skilled in the art through reference to specific embodiments. Detailed Implementation

[0030] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims.

[0031] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element. Furthermore, components, features, and elements with the same names in different embodiments of this application may have the same meaning or different meanings, the specific meaning of which must be determined by its interpretation in that specific embodiment or further in conjunction with the context of that specific embodiment.

[0032] It should be understood that although the terms first, second, third, etc., may be used herein to describe various information, such information should not be limited to these terms. These terms are used only to distinguish information of the same type from one another. For example, without departing from the scope of this document, first information may also be referred to as second information, and similarly, second information may also be referred to as first information. Depending on the context, the word "if," as used herein, can be interpreted as "when," "when," or "in response to determination." Furthermore, as used herein, the singular forms "a," "an," and "the" are intended to also include the plural forms unless the context indicates otherwise. It should be further understood that the terms "comprising," "including," indicate the presence of the stated feature, step, operation, element, component, item, kind, and / or group, but do not exclude the presence, occurrence, or addition of one or more other features, steps, operations, elements, components, items, kinds, and / or groups. The terms "or" and "and / or" as used herein are to be interpreted as inclusive, or mean any one or any combination thereof. Therefore, "A, B, or C" or "A, B, and / or C" means "any one of the following: A; B; C; A and B; A and C; B and C; A, B, and C". Exceptions to this definition will only occur if the combination of elements, functions, steps, or operations is inherently mutually exclusive in some way.

[0033] It should be understood that although the steps in the flowcharts of this application's embodiments are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some of the steps in the figures may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily completed at the same time, but can be executed at different times, and their execution order is not necessarily sequential, but can be performed alternately or in turn with other steps or at least a portion of the sub-steps or stages of other steps.

[0034] It should be noted that step designations such as S1 and S2 are used in this document for the purpose of more clearly and concisely describing the corresponding content, and do not constitute a substantial limitation on the order. In specific implementation, those skilled in the art may execute S1 first and then S2, etc., but these should all be within the protection scope of this application.

[0035] It should be understood that the specific embodiments described herein are merely illustrative of this application and are not intended to limit this application.

[0036] In the following description, the use of suffixes such as "module," "part," or "unit" to denote elements is solely for the purpose of illustrative purposes and has no specific meaning in itself. Therefore, "module," "part," or "unit" may be used interchangeably.

[0037] This invention provides an image color correction method based on a t-distribution probability model, such as... Figure 1 As shown, Figure 1 This is a flowchart of the image color correction method based on the t-distribution probability model provided in this embodiment. Furthermore, it should be noted that the method provided in this embodiment can be applied to scenarios such as image stitching and image mosaicking.

[0038] The implementation steps of the image color correction method based on the t-distribution probability model provided in this embodiment include:

[0039] S1. Obtain the image to be corrected, preset the color mapping function for each image, and determine the color residual and quality residual.

[0040] S2 uses maximum a posteriori probability to model color correction, assuming that the color residuals follow a t-distribution and the quality residuals follow an exponential family distribution, to generate a color correction probability model based on the t-distribution.

[0041] S3. Based on the color correction probability model based on the t-distribution, the EM algorithm is used to solve for the parameters of the color mapping function. During the optimization process, the t-distribution can adaptively reduce the influence of gross errors.

[0042] S4, Correct the image to be corrected according to the color mapping function to obtain an image with consistent colors.

[0043] By acquiring the image to be corrected, a color mapping function for each image is preset, and color and quality residuals are determined. Color consistency is modeled as a likelihood function, and lossless image quality is modeled as a prior probability. Color correction is modeled using maximum a posteriori probability, assuming the color residual follows a t-distribution and the quality residual follows an exponential family distribution, generating a color correction probability model based on the t-distribution. Based on this t-distribution-based color correction probability model, the parameters of the color mapping function are solved using the EM algorithm. During optimization, the t-distribution can adaptively reduce the influence of gross errors. The image to be corrected is then corrected according to the color mapping function to obtain a color-consistent image. This method uses the t-distribution to make the color correction probability model adaptively robust, and can accurately correct colors even if gross errors exist in the color residuals of the image to be corrected.

[0044] In this embodiment, step S1 may further include:

[0045] S11, Obtain a set of N images to be corrected that have overlapping areas and color differences.

[0046] S12, geometrically correct the N images to be corrected in the image set to the same coordinate system.

[0047] S13 sets N color mapping functions for N images to be corrected.

[0048] S14, use the color mapping function to determine the color residual and the color mapping function to determine the quality residual.

[0049] In this embodiment, it is first necessary to obtain an image set of N images to be corrected that have overlapping regions and color differences.

[0050]

[0051] Among them, I i Let represent the i-th image to be corrected, and N represent the number of images, which is a positive integer and N≥2, meaning there are at least two images to be corrected. In this embodiment, the images to be corrected are by default visible light images, and these images have blue, red, and green color channel values.

[0052] Secondly, it is necessary to perform geometric correction on the images to be corrected in advance, correcting N or all of the images to be corrected in the correction image set to the same coordinate system, so as to obtain the overlapping area formed between each pair of images to be corrected.

[0053] Next, N color mapping functions are preset for N images to be corrected. In this embodiment, the mathematical transformation relationship between the colors of each image before and after correction is expressed by using the color mapping functions.

[0054] It should be noted that, in this embodiment, any image to be corrected satisfies:

[0055]

[0056] In this embodiment, a three-channel linear transformation is used as the color mapping function.

[0057] The color mapping function is expressed as:

[0058]

[0059] Where, x = [BGR] T Let x' represent the color of any pixel in image I, where B, G, and R represent the color values ​​of the blue, green, and red channels of that pixel, respectively; x' = [B' G' R'] T This represents the corrected color of the pixel, where B, G, and R represent the corrected color values ​​of the blue, green, and red channels, respectively; θ1, θ2, ..., θ 12 The parameters of the color mapping function are unknowns and need to be solved.

[0060] In this embodiment, to facilitate the optimization of solving the unknown color mapping function parameters, the corrected color needs to be expressed as a function of the parameters to be determined. For this purpose, a vector θ = [θ1, θ2, ..., θ...] can be used. 12 ] T The parameters of the color mapping function for the image are represented as follows:

[0061] x′=T(x)θ

[0062] Where T(x) is a 3*12 matrix, which is represented as:

[0063]

[0064] In this embodiment, the image parallel correction method used is very flexible and can support any preset color mapping function.

[0065] Optionally, in addition to the three-channel linear transformation provided in this embodiment, this embodiment can also obtain more complex and flexible expressions and achieve higher color correction accuracy by using preset Gamma color mapping functions, spline color mapping functions, etc.

[0066] In this embodiment, determining the color residual using a color mapping function in step S14 can be:

[0067] Image points are sampled in the overlapping areas between each pair of N images to be corrected, and color correspondences are constructed to obtain a set of residuals that express the color consistency loss between each pair of multiple images to be corrected. The number of color correspondences between each pair of N images to be corrected is counted, the balance factor is calculated, and the balanced residuals are obtained.

[0068] Specifically, several image points are sampled in the overlapping area of ​​the image to be corrected I and the image to be corrected I′, and their image point color values ​​on image I and image I′ are extracted to construct the color correspondence between image I and image I′. The color residual r is defined as the difference between the corresponding colors after correction.

[0069] r=T(x)θ-T(x′)θ′

[0070] Where x and x′ represent the colors of the same pixel in the overlapping region on image I and image I′, respectively; θ is the color mapping function parameter of image I, and θ′ is the color mapping function parameter of image I′, both being 12-dimensional vectors that need to be solved. In this embodiment, the smaller the color residual, the more consistent the colors are after correction.

[0071] It should be noted that the image to be calibrated, I, can be understood as any one image in the set of images to be calibrated; the image to be calibrated, I′, can be understood as one or more images that have overlapping areas with the image to be calibrated, I. For example, if there are 10 images in the set of images to be calibrated, one can be randomly selected as the image to be calibrated, I. Then, from the remaining 9 images in the set, images that have overlapping areas with the image to be calibrated, I′, can be selected.

[0072] Then, the overlapping areas of all images are traversed, and the color values ​​of the image points are extracted by uniformly sampling the observation points. Color correspondences are constructed between each pair of images, and color residuals are defined. This yields a set of residuals that express the loss of color consistency between each pair of multiple images to be corrected.

[0073] Because the overlap between pairs of images to be corrected varies in size, the number of color correspondences extracted by uniform sampling also varies. Consequently, the number of color residuals for different image pairs in the residual set differs. This leads to color correction tending to eliminate color differences between two images with a large overlap, while ignoring color differences between other images. To address this issue, in this embodiment, the number of color correspondences between pairs of multiple images is counted, denoted as 'a', and a balance factor is calculated. The residual r after equilibrium is obtained Bal =λr, and denote the balanced residual set as

[0074]

[0075] Where K is the number of all colors.

[0076] In this embodiment, if there is geometric misalignment in the image overlap area, or if there is a changing area in the image overlap area, the image content in the image overlap area will be inconsistent, the constructed color correspondence will be inaccurate, and there will be gross errors in the color residual.

[0077] In this embodiment, the quality residual may include: gradient residual and regularized residual. The step S14, determining the quality residual using a color mapping function, may be as follows:

[0078] Image points are uniformly sampled on a single image to be corrected to obtain the residuals that express the gradient changes of the sampled image points before and after correction. A gradient balancing factor is set to obtain the balanced gradient residuals.

[0079] Colors are sampled at fixed intervals within the color value range to obtain residuals that express the color changes before and after color correction. A regularization balance factor is then set to obtain the balanced regularized residuals.

[0080] Specifically, low-contrast, blurry images reduce color differences between images, resulting in a loss of geometric details. To preserve these details, this embodiment defines a gradient residual to ensure the contrast and sharpness of the corrected image. Specifically, this can be achieved by uniformly sampling image points in the image to be corrected (I), defining the gradient residual as the change in color gradient of the sampled image points before and after correction.

[0081]

[0082] Where p represents the image point sampled from image I; x = I(p) is the RGB color value of p; N(p) is the set of four neighboring image points of image point p; |N(p)| represents the number of four neighboring image points, which has a value of 4; and x′ represents the RGB color value of the four neighboring image point p′ of image point p. To control the influence of gradient constraints, a balance factor λ is set. grad The balanced residuals are obtained.

[0083] In this embodiment, if the color mapping function parameter vectors of all corrected images are zero vectors, then the corresponding colors between the images are completely consistent. However, after correction, all images are completely black, so the zero vector is an invalid solution. If there is a set of valid solution vectors that can make the colors between the images consistent, then more solutions can be obtained by applying the same transformation to all valid solution vectors, which can also make the colors between the images consistent. Therefore, the solution is not unique.

[0084] To avoid invalid solutions and non-unique solutions, this embodiment defines a regularized residual to encourage the corrected color to approximate the original image color. Specifically, this can be achieved by uniformly sampling the color values ​​of the B, G, and R channels at fixed intervals within the range [0, 255], and defining a regularized residual r. reg The change in sampled color before and after correction:

[0085] r reg =T(x)θ-x

[0086] Where x represents the color value of a sample, and θ is the color model parameter of image I. To control the influence of the regularization constraint, a balance factor λ is set. reg (>0), to obtain the balanced residual. The smaller the regular residual, the closer the sampled color is to the original image after correction.

[0087] Optionally, after obtaining the gradient residuals and regularization residuals, it is also necessary to aggregate the gradient residuals and regularization residuals of all images into a quality residual set. The quality residual set can be obtained by:

[0088] Traverse the single image to be corrected I (where, All sampled colors and sampled image points are used to aggregate all gradient residuals and regularization residuals into a single vector q, called the quality residual. Then, the quality residuals of N images to be corrected are obtained, resulting in a quality residual set.

[0089]

[0090] Where, q i Image I i The quality residual.

[0091] like Figure 2 As shown, Figure 2 This is a flowchart of steps S21 to S22 in the image color correction method based on the t-distribution probability model provided in this embodiment. In this embodiment, steps S21 to S22 include:

[0092] S21. Color consistency is modeled as likelihood probability, image quality preservation is modeled as prior probability, and a general probabilistic modeling framework for color correction is constructed based on maximum a posteriori probability.

[0093] S22, Substitute the prior probability based on the exponential family distribution and the likelihood probability based on the t-distribution into the general framework for probabilistic modeling of color correction to construct a color correction probabilistic model based on the t-distribution.

[0094] It should be noted that existing global color consistency correction methods typically construct an energy equation with color consistency as the primary objective, minimize the energy equation to solve for the color mapping function parameters, and correct the image color accordingly. The energy equation usually includes a color consistency term (mandatory) and an image quality preservation term (not necessarily present), in order to eliminate color differences between images without compromising image quality.

[0095] The embodiments of this application model global color correction based on maximum a posteriori probability. Color consistency is modeled as a likelihood probability, while image quality preservation is modeled as a prior probability.

[0096] Specifically, it could be that we first memorize θ. i For image I i The color mapping function parameter vector, all images to be corrected The corresponding color mapping function parameter set is The set of residuals representing the color consistency loss is as follows (K is the number of all colors), and the residual set representing the image quality loss is: Global color consistency correction can then be modeled as maximum a posteriori probability estimation.

[0097]

[0098] in, The color residual is observed when the color mapping function parameter Θ is given. The likelihood probability is given by P(Θ), where P(Θ) represents the prior probability of the color mapping function parameter Θ.

[0099] Assuming the residuals corresponding to different colors are independent and identically distributed, the likelihood probability can be expressed as:

[0100]

[0101] Assume r i The likelihood probability can be expressed by the fact that (i = 1, 2, ..., K) follows a certain distribution. The most common distribution is the Gaussian distribution.

[0102] Assuming the color mapping function parameters of different images are independent and identically distributed, the prior probability can be expressed as:

[0103]

[0104] Assume θ i The prior probability can be expressed by assuming that the values ​​(i = 1, 2, ..., N) follow a certain distribution. For example, if we assume that the values ​​follow a uniform distribution, then P(Θ) is a constant. In this case, color correction does not consider image quality, and we assume that its distribution is the same as the quality residual. This is relevant, and can prevent color correction from compromising image quality.

[0105] Remove the terms in formula (1) that are irrelevant to the parameter Θ to be determined. And by replacing the maximum a posteriori with the minimum negative logarithm a posteriori, we can derive the following from formula (1):

[0106]

[0107] Substituting formulas (2) and (3) into formula (4), we can obtain...

[0108]

[0109] In the formula

[0110]

[0111] Formula (5) is the general framework for probabilistic modeling of global color correction, and Formula (6) is the energy equation of the general framework. Given a specific distribution and a preset color mapping function, the specific expression of the energy equation can be obtained. Minimizing the energy equation can yield the optimal color mapping function parameter Θ. * .

[0112] In this embodiment, the maximum a posteriori probability model used is a general probabilistic modeling framework for global color consistency correction, which is very flexible: it supports assuming that the residuals follow any distribution and preset any color mapping function; it can interpret any existing global color consistency correction method; it can be given different color correction capabilities by preset different color mapping functions; it can be given different color correction robustness by assuming different color residual distributions; and it can be given different image quality preservation capabilities by assuming different quality residual distributions.

[0113] After obtaining a general framework for probabilistic modeling, it is necessary to construct a color correction probabilistic model based on the t-distribution. Existing technologies employ a global color consistency correction method, using least squares to model color consistency, which is equivalent to assuming that the color residuals follow a Gaussian distribution. However, the Gaussian distribution assigns very few probabilities to outliers, thus reducing the accuracy of color mapping function parameter solving when there are many outliers.

[0114] Therefore, in this embodiment, to make color correction robust to gross errors, under the general probabilistic modeling framework for global color consistency correction constructed in the previous step, it is assumed that the color residuals follow a t-distribution. The t-distribution can assign a greater probability to gross errors, thus making color correction robust to gross errors based on the t-distribution residual assumption.

[0115] Assuming color residual If the t-distribution follows a multivariate t-distribution t(0, ∑, v), then the likelihood probability P(r) i |Θ) is

[0116]

[0117] In the formula, Γ is the Gamma function, ∑ is a 3×3 matrix; d is the number of color channels, d=3; v is the degrees of freedom, controlling the robustness of the t distribution. Since the three channels of the residual are uncorrelated, ∑=σ is set. 2 E is a 3×3 identity matrix. Therefore, the parameters to be determined for the t-distribution are v and σ.

[0118] Assuming quality residual If it follows an exponential family multivariate distribution, then the prior probability P(θ) i )for

[0119]

[0120] Substituting equations (7) and (8) into the energy equation of the general framework (equation (6)) completes the construction of a color correction probability model based on the t-distribution.

[0121] In this embodiment, as Figure 3 As shown, Figure 3This is a flowchart of steps S31 to S32 in the image color correction method based on the t-distribution probability model provided in this embodiment. Steps S31 to S32 can also be:

[0122] S31, Derive the iterative weighted least squares expression for the color correction probability model based on the t-distribution.

[0123] In this embodiment, to facilitate the solution of the color mapping function parameters Θ and the t-distribution parameters v and σ, it is necessary to first derive the equivalent iterative weighted least squares (IRLS) method based on the t-distribution color correction probability model. This expression is as follows:

[0124]

[0125] Wherein, the weight function w(r) i ) and w(q i The expression for ) is:

[0126]

[0127] w(q i ) = 1

[0128] The first term in the formula represents a robust color consistency constraint applied to corresponding colors between images. Its robustness can be explained by the weighting function: the weight is related to the color residual; the larger the color residual, the smaller the weight, thus suppressing the influence of large residuals caused by unreliable color correspondences. Furthermore, the robustness varies flexibly with the degrees of freedom v of the t-distribution; the smaller v is, the stronger the robustness.

[0129] The second term in the formula represents the quality preservation constraint imposed on the image: on the one hand, the gradient after correction is constrained to be close to the gradient before correction, ensuring that the image after correction is clear and has fine geometric details; on the other hand, the color after correction is constrained to be close to the color before correction, ensuring the validity and uniqueness of the solution.

[0130] S32 uses the EM algorithm to jointly optimize the color mapping function parameters and the t-distribution parameters.

[0131] In this embodiment, the ultimate goal is to solve for the color mapping function parameters and correct the image based on them. To ensure the color correction is robust to data containing varying degrees of gross errors, this embodiment treats the color mapping function parameters Θ and the t-distribution parameters σ and v as unknown variables, minimizing the minimized E derived in step S31. IRLS The optimal value is obtained.

[0132] In this embodiment, the Expectation-Maximization (EM) algorithm is used to jointly optimize the color mapping function parameters and the t-distribution parameters. The EM algorithm mainly consists of two steps: the expectation step (E-step) and the maximization step (M-step). After setting initial values, the E-step and M-step are iterated repeatedly until convergence to obtain the optimal color mapping function parameters and t-distribution parameters. Specifically:

[0133] First, set initial values: set the initial value v of the t-distribution parameter. (0) =3, The initial value of the color mapping function parameter for all images is set to... in Image I i Initial values ​​for the color mapping function parameters. Set the initial iteration round number t = 0.

[0134] Secondly, execute E-step:

[0135] In round (t+1), based on the estimated value v of the t-distribution parameter obtained in round (t) iteration... (t) σ (t) and based on the color mapping function parameter Θ (t) Calculated color residual r (t) Update weights:

[0136]

[0137] To estimate the t-distribution parameter v later, the intermediate value S is calculated additionally. w and S q The calculation formula is as follows:

[0138]

[0139] In the formula

[0140]

[0141] in, This is the digamma function.

[0142] Next, execute M-step:

[0143] In round (t+1), firstly, based on the weights updated in round (t+1), minimize E. IRLS To obtain the optimal color mapping function parameters:

[0144]

[0145] Next, the t-distribution parameter σ is optimized, as shown in the following formula:

[0146]

[0147] Finally, the optimized t-distribution parameter v is obtained according to the following formula:

[0148]

[0149] Where v > 0 so that Valid. Taking the derivative of this expression and setting it to 0, we can find that v (t+1) satisfy:

[0150]

[0151] Solving this formula will ultimately yield the optimized t-distribution parameter v.

[0152] Optionally, step S4, correcting the image to be corrected according to the color mapping function to obtain an image with consistent colors, can be achieved by substituting the optimized color mapping function parameters obtained through the above steps into the color mapping function, and then applying the corrected image... Using the color mapping function x′=T(x)θ i Corrected image I i Given the given color, output N images with the same color.

[0153] like Figures 4 to 5 As shown, Figure 4 The input image to be corrected has already undergone geometric correction to a coordinate system, and corresponding regions of the images overlap. To ensure color consistency across multiple images, we need to extract colors from different images directly in the overlapping areas to establish color correspondences, ensuring that the colors were inconsistent before correction but remain consistent after. We assume that a mathematical transformation is applied to the colors of each image to make the corresponding colors consistent after the transformation. Based on the premise of consistent colors between images after color correction and that the correction cannot compromise image quality, we construct equations to solve for the corresponding parameters. These parameters are then used to transform the colors of the image to be corrected, ultimately resulting in multiple images with consistent colors, such as... Figure 5 As shown, Figure 5 This is the corrected output image. Through image correction, the colors of multiple images tend to be consistent. In this embodiment, to obtain better robustness, the influence of gross errors can be adaptively eliminated by utilizing the t-distribution, thus obtaining the correct parameters and outputting the corrected image.

[0154] like Figure 6 As shown, Figure 6 The image color correction device based on the t-distribution probability model provided in this embodiment includes:

[0155] The first module 1 is used to acquire the image to be corrected, preset the color mapping function for each image, and determine the color residual and quality residual.

[0156] The second module 2 is used to model color correction using the maximum a posteriori probability. It assumes that the color residuals follow a t-distribution and the quality residuals follow an exponential family distribution, and generates a color correction probability model based on the t-distribution.

[0157] The third module 3 is used to solve the parameters of the color mapping function using the EM algorithm based on the color correction probability model based on the t-distribution. During the optimization process, the t-distribution can adaptively reduce the influence of gross errors.

[0158] The fourth module 4 is used to correct the image to be corrected according to the color mapping function to obtain an image with consistent colors.

[0159] This invention also provides an electronic device, such as... Figure 7 As shown, the electronic device may include a processor 7 and a memory 8, wherein the processor 7 and the memory 8 may be connected via a bus 8 or other means. Figure 7 Taking the example of a connection between China and Israel via a bus.

[0160] Processor 7 can be a Central Processing Unit (CPU). Processor 7 can also be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or combinations of the above types of chips.

[0161] Memory 8, as a non-transitory computer-readable storage medium, can be used to store non-transitory software programs, non-transitory computer-executable programs, and modules, such as the deep learning-based ship feature optimization device in this embodiment of the invention, whose execution method corresponds to program instructions / modules (e.g., Figure 6 The first module 1, the second module 2, the third module 3, and the fourth module 4 are shown. The processor 7 executes various functional applications and data processing by running non-transitory software programs, instructions, and modules stored in the memory 8, thereby realizing the method for determining the source of heavy metals on the road surface in the above method embodiment.

[0162] The memory 8 may include a program storage area and a data storage area. The program storage area may store the operating system and applications required for at least one function; the data storage area may store data created by the processor 7, etc. Furthermore, the memory 8 may include high-speed random access memory and may also include non-transitory memory, such as at least one disk storage device, flash memory device, or other non-transitory solid-state storage device. In some embodiments, the memory 8 may optionally include memory remotely located relative to the processor 7, and these remote memories may be connected to the processor 7 via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.

[0163] One or more modules are stored in memory 8, and when executed by processor 7, they perform actions such as... Figure 1-3 The method for determining the source of heavy metals on the road surface in the illustrated embodiment.

[0164] For details regarding the image color correction device based on the t-distribution probability model mentioned above, please refer to the relevant documentation. Figures 1 to 3 The relevant descriptions and effects in the illustrated embodiments are for understanding purposes only and will not be repeated here.

[0165] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The program can be stored in a computer-readable storage medium, and when executed, it can include the processes of the embodiments of the methods described above. The storage medium can be a magnetic disk, optical disk, read-only memory (ROM), random access memory (RAM), flash memory, hard disk drive (HDD), or solid-state drive (SSD), etc.; the storage medium can also include combinations of the above types of memory.

[0166] The above are merely preferred embodiments of this application and do not limit the patent scope of this application. Any equivalent structural or procedural transformations made using the content of this application's specification and drawings, or direct or indirect applications in other related technical fields, are similarly included within the patent protection scope of this application.

Claims

1. An image color correction method based on a t-distribution probability model, characterized in that, include: Acquire the image to be corrected, preset a color mapping function for the image to be corrected, and determine the color residual and quality residual, including: Obtain a set of N images to be corrected that have overlapping regions and color differences; Perform geometric correction on the N images to be corrected in the image set to the same coordinate system; for Zhang's image to be corrected (preset) One color mapping function; Determining color residuals and determining quality residuals using color mapping functions, wherein determining color residuals using color mapping functions includes: Image points are sampled in the overlapping areas between each pair of N images to be corrected, and color correspondences are constructed to obtain a residual set that expresses the loss of color consistency between each pair of multiple images to be corrected. Count the number of color correspondences between each pair of N images to be corrected, calculate the balance factor, and obtain the color residuals after balance. The quality residuals include gradient residuals and regularized residuals; A color correction probability model is established using the maximum a posteriori probability, such that the color residuals follow a t-distribution and the quality residuals follow an exponential family distribution, thus generating a color correction probability model based on the t-distribution; Based on the t-distribution-based color correction probability model, the EM algorithm is used to solve for the parameters of the color mapping function, including: Derive the iterative weighted least squares expression for a color correction probability model based on the t-distribution; The EM algorithm is used to jointly optimize the color mapping function parameters and the t-distribution parameters. The image to be corrected is corrected according to the color mapping function to obtain an image with consistent colors.

2. The image color correction method based on the t-distribution probability model according to claim 1, characterized in that determining the quality residual using the color mapping function includes: Image points are uniformly sampled on a single image to be corrected to obtain the residuals that express the gradient changes of the sampled image points before and after correction. A gradient balancing factor is set to obtain the balanced gradient residuals. Color values ​​are sampled at fixed intervals within the color value range to obtain the residuals that express the color changes before and after color correction. A regularization balance factor is then set to obtain the balanced regularized residuals.

3. The image color correction method based on the t-distribution probability model according to claim 2, characterized in that it further includes: Iterate through all sampled pixels and sampled colors in a single image to be corrected, and aggregate all gradient residuals and regularized residuals into a single vector; Obtain the vectors of N images to be corrected from the set of images to be corrected, and obtain the quality residual set.

4. The image color correction method based on the t-distribution probability model according to claim 1, characterized in that, The step of establishing a color correction probability model using the maximum a posteriori probability, such that the color residuals follow a t-distribution and the quality residuals follow an exponential family distribution, generates a color correction probability model based on the t-distribution, including: By modeling color consistency as likelihood probability, image quality preservation as prior probability, and modeling based on maximum a posteriori probability, a general framework for probabilistic modeling of color correction is constructed. By substituting the prior probability based on the exponential family distribution and the likelihood probability based on the t-distribution into the general framework for probabilistic modeling of color correction, a color correction probabilistic model based on the t-distribution is constructed.

5. An image color correction device based on a t-distribution probability model, characterized in that, include: The first module is used to acquire the images to be corrected, preset color mapping functions for each image, and determine the color residuals and quality residuals, including: Obtain a set of N images to be corrected that have overlapping regions and color differences; Perform geometric correction on the N images to be corrected in the image set to the same coordinate system; for Zhang's image to be corrected (preset) One color mapping function; Determining color residuals and determining quality residuals using color mapping functions, wherein determining color residuals using color mapping functions includes: Image points are sampled in the overlapping areas between each pair of N images to be corrected, and color correspondences are constructed to obtain a residual set that expresses the loss of color consistency between each pair of multiple images to be corrected. Count the number of color correspondences between each pair of N images to be corrected, calculate the balance factor, and obtain the color residuals after balance. The quality residuals include gradient residuals and regularized residuals; The second module is used to establish a color correction probability model using the maximum a posteriori probability. It assumes that the color residuals follow a t-distribution and the quality residuals follow an exponential family distribution, and generates a color correction probability model based on the t-distribution. The third module is used to solve for the parameters of the color mapping function using the EM algorithm based on the t-distribution-based color correction probability model, including: Derive the iterative weighted least squares expression for a color correction probability model based on the t-distribution; The EM algorithm is used to jointly optimize the color mapping function parameters and the t-distribution parameters. The fourth module is used to correct the image to be corrected according to the color mapping function to obtain an image with consistent colors.

6. A readable storage medium, characterized in that, The readable storage medium stores a computer program that, when executed by a processor, implements the image color correction method based on the t-distribution probability model as described in any one of claims 1 to 4.

Citation Information

Patent Citations

  • Image color correction method and device, storage medium and mobile terminal

    CN109523485A

  • Model training method, color difference correction method and device, medium and electronic equipment

    CN109903256A