CN110365949B - Image color cast correction method and device and electronic equipment - Google Patents
Image color cast correction method and device and electronic equipment Download PDFInfo
- Publication number
- CN110365949B CN110365949B CN201810252674.9A CN201810252674A CN110365949B CN 110365949 B CN110365949 B CN 110365949B CN 201810252674 A CN201810252674 A CN 201810252674A CN 110365949 B CN110365949 B CN 110365949B
- Authority
- CN
- China
- Prior art keywords
- pixel
- overexposure
- pixel point
- overexposed
- value
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N23/00—Cameras or camera modules comprising electronic image sensors; Control thereof
- H04N23/10—Cameras or camera modules comprising electronic image sensors; Control thereof for generating image signals from different wavelengths
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N23/00—Cameras or camera modules comprising electronic image sensors; Control thereof
- H04N23/70—Circuitry for compensating brightness variation in the scene
- H04N23/73—Circuitry for compensating brightness variation in the scene by influencing the exposure time
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N23/00—Cameras or camera modules comprising electronic image sensors; Control thereof
- H04N23/80—Camera processing pipelines; Components thereof
- H04N23/84—Camera processing pipelines; Components thereof for processing colour signals
- H04N23/88—Camera processing pipelines; Components thereof for processing colour signals for colour balance, e.g. white-balance circuits or colour temperature control
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N9/00—Details of colour television systems
- H04N9/64—Circuits for processing colour signals
- H04N9/646—Circuits for processing colour signals for image enhancement, e.g. vertical detail restoration, cross-colour elimination, contour correction, chrominance trapping filters
Landscapes
- Engineering & Computer Science (AREA)
- Multimedia (AREA)
- Signal Processing (AREA)
- Image Processing (AREA)
- Color Television Image Signal Generators (AREA)
- Studio Devices (AREA)
Abstract
The invention provides a method and a device for correcting image color cast and electronic equipment, wherein the method comprises the following steps: acquiring overexposed pixel points of an input image; judging the overexposure type of the overexposure pixel point; and selecting the pixel value of the overexposed pixel point to carry out tone mapping conversion processing or reserving the overexposed pixel point and carrying out position marking according to the overexposure type of the overexposed pixel point. The invention can provide a simple image color cast correction algorithm, so that the correction of the image color cast is simple and easy, meanwhile, the hardware resource occupancy rate is also reduced, and the hardware realization is facilitated; and moreover, the color cast region caused by overexposure of a certain channel can be well corrected, and the image quality is further enhanced.
Description
Technical Field
The present invention relates to the field of image processing technologies, and in particular, to a method and an apparatus for correcting color cast of an image, and an electronic device.
Background
At present, the existing Image system mainly uses Image Signal Processing (ISP) to perform lens shading correction, white balance, dead pixel repairing, denoising, gamma correction, color interpolation, edge enhancement and other Processing on the front-end Image sensor output Signal (Rawdata). In both Digital cameras and camera phones, after data obtained by a sensor (sensor) is processed by an Analog-to-Digital Converter (ADC), the data needs to be processed by an ISP, but in the process, the following situations may cause an overexposure situation:
(1) if the exposure parameters when the sensor (sensor) in the camera obtains data are not appropriate, the data obtained by the sensor (sensor) exceeds the maximum value of the pixel values that can be accommodated by the sensor unit, at this time, the data needs to be clipped (i.e. clip), and the pixel value of the pixel changes, and the data is lost.
(2) If the exposure parameter when the sensor (sensor) in the camera obtains data is such that no pixel of the sensor (sensor) exceeds the maximum value that can be accommodated by the sensor unit when obtaining data, and in the process of ISP processing, the pixel value exceeds the maximum value that can be accommodated on the pipeline of the ISP processor through module processing such as lens shading correction and white balance, and the like, the gain compensation is applied, so that the data also needs to be clipped (i.e. clip), and the pixel value of the pixel changes, and the data is lost. If some pixels are clipped (i.e., clip), overexposure occurs, or color cast due to clip directly affects the image quality and reduces the user experience.
However, in the prior art, post-processing is performed on an overexposed image formed by processing of modules such as lens shading correction and white balance, but a large template is often needed for iterative computation, so that the processing is complex and the resource occupancy rate is large; meanwhile, the effect is not ideal for a large-area overexposure area.
Disclosure of Invention
The method, the device and the electronic equipment for correcting the image color cast can provide a simple image color cast correction algorithm, so that the correction of the image color cast is simple and easy, meanwhile, the hardware resource occupancy rate is reduced, and the hardware realization is facilitated; and the method can also have a better correction effect on a color cast area caused by overexposure of a certain channel, thereby enhancing the image quality.
In a first aspect, the present invention provides a method for correcting color cast of an image, including:
acquiring overexposed pixel points of an input image;
judging the overexposure type of the overexposure pixel point;
and selecting to carry out tone mapping transformation processing on the pixel value of the overexposure pixel point or reserving and marking the position of the overexposure pixel point according to the overexposure type of the overexposure pixel point.
Optionally, the selecting, according to the overexposure type of the overexposure pixel point, to perform tone mapping transformation on the pixel value of the overexposure pixel point, or to reserve and perform position marking on the overexposure pixel point includes:
when the overexposure pixel point is subjected to the overexposure treatment after the gain compensation treatment, carrying out tone mapping transformation treatment on the pixel value of the overexposure pixel point;
and when the overexposure pixel point is overexposed due to automatic exposure of the sensor, reserving the overexposure pixel point and marking the position.
Optionally, when the overexposure pixel point is caused by overexposure after the gain compensation processing, performing tone mapping transformation processing on the pixel value of the overexposure pixel point includes:
determining a threshold v from overexposed region information of an input image max ;
The first pixel value R of the overexposed pixel point 1 Mapping the tone mapping curve to obtain a second pixel value R 2 ;
Wherein, a is a first preset parameter and corresponds to the data range of the sensor, th2 is a second preset parameter, and sigma is a third preset parameter, and is calculated from f (th2) th 2.
Optionally, before the obtaining of the overexposed pixel points of the input image, the method further includes:
acquiring all pixel points of an input image;
and calculating the overexposure degree value corresponding to each pixel point according to the pixel value of each pixel point.
Optionally, the calculating the overexposure degree value corresponding to each pixel point according to the pixel value of each pixel point includes:
respectively carrying out interpolation calculation on each pixel point to obtain the pixel value of each channel of RGB corresponding to each pixel point, and comparing to obtain the maximum value p of the channel cmax ;
Maximum value p of the channel cmax Calculating the overexposure value R according to the following formula oe ;
Wherein a is a fourth preset parameter and a is more than 0, l th1 For a fifth predetermined parameter, h th1 Is a sixth preset parameter, and th1 <h th1 。
optionally, after the selecting, according to the overexposure type of the overexposure pixel point, to perform tone mapping transformation on the pixel value of the overexposure pixel point, or reserving and position-marking the overexposure pixel point, the method further includes:
the second pixel value R 2 And the overexposure degree R of the pixel point oe And a first pixel value R of the pixel point 1 Calculating a final pixel value R according to the following formula out ;
According to the final pixel value R out And outputting the image.
In a second aspect, the present invention provides an apparatus for correcting color cast of an image, comprising:
the first acquisition unit is used for acquiring overexposed pixel points of the input image;
the judging unit is used for judging the overexposure type of the overexposure pixel point;
and the control unit is used for selecting to carry out tone mapping conversion processing on the pixel value of the overexposure pixel point or reserving and marking the position of the overexposure pixel point according to the overexposure type of the overexposure pixel point.
Optionally, the control unit comprises:
the processing module is used for carrying out tone mapping transformation processing on the pixel value of the overexposed pixel point when the overexposed pixel point is subjected to the gain compensation processing and then leads to overexposure;
and the reservation module is used for reserving the overexposure pixel points and marking the positions when the overexposure pixel points are overexposed due to automatic exposure of the sensor.
Optionally, the processing module includes:
a threshold determination submodule for determining a threshold v from the information of the overexposed area of the input image max ;
A processing submodule for converting the first pixel value R of the overexposed pixel point 1 Mapping the tone mapping curve to obtain a second pixel value R 2 ;
Wherein, a is a first preset parameter and corresponds to the data range of the sensor, th2 is a second preset parameter, and sigma is a third preset parameter, and is calculated from f (th2) th 2.
Optionally, the apparatus further comprises:
the second acquisition unit is used for acquiring all pixel points of the input image;
a first calculating unit for calculating an overexposure degree value R corresponding to each pixel point according to the pixel value of each pixel point oe ;
A second calculation unit for calculating the second pixel value R 2 The overexposure degree R of the pixel point oe And a first pixel value R of the pixel point 1 Calculating a final pixel value R according to the following formula out ;
Wherein a is a fourth preset parameter and a is more than 0;
an output unit for outputting the final pixel value R out And outputting the image.
In a third aspect, the present invention provides an electronic device, which includes the above-mentioned device for correcting image color cast.
The method, the device and the electronic equipment for correcting the image color cast provided by the embodiment of the invention mainly analyze the reason of the overexposure of the image, wherein the method can analyze the reason of the overexposure of a certain channel or the overexposure of all three channels of RGB in the input image and judge the overexposure type of the overexposure pixel point, for example, the overexposure of the pixel point (such as through lens shadow correction or after white balance correction module processing) is caused by improper sensor exposure parameter setting or limitation of an ISP processing module. The method of the embodiment separately processes overexposure of overexposure pixel points of different overexposure types, and restores the original color and details of the image through adaptive tone mapping transformation, thereby realizing the correction of color cast of the image. The method has simple calculation and small hardware resource occupation, and is very beneficial to hardware realization; and the color cast area caused by overexposure of a certain channel can be well corrected.
Drawings
FIG. 1 is a flowchart illustrating a method for correcting color cast of an image according to an embodiment of the present invention;
FIG. 2 is a flowchart illustrating a method for correcting color cast of an image according to another embodiment of the present invention;
FIG. 3 is a schematic diagram illustrating an overexposure level of an image pixel according to an embodiment of the present invention;
FIG. 4 is a schematic diagram of a tone mapping curve in a tone mapping transformation process according to an embodiment of the present invention;
FIG. 5 is a schematic diagram illustrating an exemplary structure of a device for correcting color cast of an image according to the present invention;
FIG. 6 is a schematic structural diagram of a device for correcting color cast of an image according to another embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all the embodiments. All other embodiments, which can be obtained by a person skilled in the art without making any creative effort based on the embodiments in the present invention, belong to the protection scope of the present invention.
An embodiment of the present invention provides a method for correcting color cast of an image, as shown in fig. 1, the method includes:
s11, acquiring overexposed pixel points of the input image;
s12, judging the overexposure type of the overexposure pixel point;
s13, selecting to perform tone mapping transformation processing on the pixel value of the overexposed pixel point according to the overexposed type of the overexposed pixel point, or reserving and position marking the overexposed pixel point.
The method for correcting the color cast of the image provided by the embodiment of the invention mainly analyzes the reason of the overexposure of the image, wherein the method can analyze the reason of the overexposure of a certain channel or the overexposure of all three channels of RGB in the input image, and judge the overexposure type of the overexposure pixel point, for example, the overexposure of the pixel point (such as lens shading correction or white balance correction module processing) is caused by improper sensor exposure parameter setting or the limitation of an ISP processing module. The method of the embodiment separately processes overexposure of overexposure pixel points of different overexposure types, and restores the original color and detail of the image through adaptive tone mapping transformation, thereby realizing the correction of color cast of the image. The method of the embodiment has simple calculation and small hardware resource occupation, and is very beneficial to hardware realization; and the color cast area caused by overexposure of a certain channel can be well corrected.
Optionally, as shown in fig. 2, the selecting, according to the overexposure type of the overexposed pixel, to perform tone mapping transformation on the pixel value of the overexposed pixel, or to reserve and position-mark the overexposed pixel includes:
when the overexposure pixel point is subjected to the overexposure treatment after the gain compensation treatment, carrying out tone mapping transformation treatment on the pixel value of the overexposure pixel point;
and when the overexposure pixel point is overexposed due to automatic exposure of the sensor, reserving the overexposure pixel point and marking the position.
Specifically, the method of this embodiment mainly analyzes the root cause of pixel overexposure caused by inappropriate sensor exposure parameter setting and the limitation of the ISP processing module (for example, after lens shading correction or white balance correction module processing) and separately processes the pixel overexposure by adopting different processing modes, wherein, on one hand, the method of this embodiment only reserves and marks the position of the overexposed pixel because the pixel value of the pixel overexposed by inappropriate sensor exposure parameter setting is already inaccurate and has no need for processing; in the subsequent process, the marked overexposed pixel points can be further utilized to enable transition between the pixel points subjected to correction processing and the pixel points not subjected to correction processing to be smooth, and the effect of image color correction is improved; and on the other hand, the correlation among channels in the overexposed pixel points after lens shading correction or white balance correction and gain compensation processing is utilized, and the overexposed channels are corrected by adopting equal-scale reduction processing. For example, in the method described in this embodiment, for raw data of the sensor input image, when the lens shading correction is performed, dark angles around the gain compensation lens due to insufficient light and color cast due to the difference of the light refractive indexes of different colors need to be multiplied. Therefore, for raw data of an input image, pixels which are not overexposed after automatic exposure are multiplied by gain compensation after lens shading correction, so that the pixel value exceeds the maximum range and is then clipped, and information is lost.
Therefore, the method of the embodiment judges and analyzes the overexposure reason of the overexposure pixel point, and corrects and compensates the overexposure pixel after the lens shadow correction and white balance correction; the data coming out of the sensor as a result of improper exposure parameter settings is only marked as non-correction for already overexposed pixels. And further, the calculated amount in the correction process of the image color cast is reduced, the image color cast correction algorithm is simplified, and the correction effect of the image color cast area is improved.
Optionally, as shown in fig. 4, when the overexposure pixel is caused by overexposure after the gain compensation processing, the performing the tone mapping transformation processing on the pixel value of the overexposure pixel includes:
determining a threshold v from overexposed region information of an input image max ;
The first pixel value R of the overexposed pixel point 1 Mapping the tone mapping curve to obtain a second pixel value R 2 ;
Wherein, a is a first preset parameter and corresponds to the data range of the sensor, th2 is a second preset parameter, and sigma is a third preset parameter, and is calculated from f (th2) th 2.
Specifically, as shown in fig. 4, the method of the present embodiment maps the data with high bits into the data with low bits through an adaptive tone mapping transformation process; for example, 14-bit data is mapped to 10-bit data.
In this embodiment, if the first pixel value R of the over-exposed pixel is larger than the second pixel value R of the over-exposed pixel 1 < th2, the original pixel value is kept unchanged (i.e. the second pixel value R 2 Equal to the first pixel value R 1 ) (ii) a If the first pixel value th2 < R of the overexposed pixel 1 <v max Then use the curve to sum up [ th2, v max ]First pixel value R of 1 Mapping to [ th2, A]Second pixel value R 2 (ii) a If the first pixel value R of the overexposed pixel point 1 >v max Then the second pixel value R 2 =A。
Further, the method of the present embodiment can adjust the [ th2, v ] according to the input image information and the device information max ]First pixel value R of 1 Mapping to [ th2, A]Second pixel value R of 2 The curve of (c); wherein the curve is required to satisfy a): monotonically increasing; b) the method comprises the following steps f (th2) th 2; c) the method comprises the following steps f (v) max )=A。
Further, the threshold value v is found by experimental tests max Too small, which may result in a large overexposed area remaining, if the threshold v is too low max Too large, too flat a curve, may result in reduced color saturation in certain highlight areas, and may result in a smaller dynamic range for the entire image. Therefore, in order to better improve the color cast correction effect of the image, the method of the embodiment can further determine the threshold v according to the information of the overexposed area of the input image max (ii) a For example, the average value v of the overexposed (greater than A) region of the whole input image after the white balance gain is counted mean ;v max =v mean ×v ratio ;v ratio Is a seventh preset parameter and may correspond to a scene.
Optionally, before the obtaining of the overexposed pixel points of the input image, the method further includes:
acquiring all pixel points of an input image;
and calculating the overexposure degree value corresponding to each pixel point according to the pixel value of each pixel point.
Specifically, because the data Rawdata output by the ISP is raw image data in Bayer (Bayer) format, and each pixel point has only a single color channel value, in the method of this embodiment, interpolation calculation needs to be performed on the single color channel value of the overexposed pixel point to obtain a first pixel value having three color channel values corresponding to the pixel point; for example, assuming that the current point is an R channel, a typical bayer format is as shown in the following table, and values of two other channels of the current R channel are obtained to obtain values of three channels of R, G, and B of the overexposed pixel point, then the B and G channels of the current point are obtained by interpolating from surrounding pixels:
B | G | B |
G | R | G |
B | G | B |
in addition, when RGB three-channel values are obtained, 4 x 4 and 5 x 5 … … n x n templates can be used for interpolation calculation.
Optionally, as shown in fig. 3, the calculating an overexposure value corresponding to each pixel point according to the pixel value of each pixel point includes:
respectively carrying out interpolation calculation on each pixel point to obtain the pixel value of each channel of RGB corresponding to each pixel point, and comparing to obtain the maximum value p of the channel cmax ;
Maximum value p of the channel cmax Calculating the overexposure value R according to the following formula oe ;
Wherein a is a fourth preset parameter and a is more than 0, l th1 For a fifth predetermined parameter, h th1 Is a sixth preset parameter, and th1 <h th1 。
specifically, in the method of this embodiment, in order to make the transition between the pixel points which are subjected to the correction processing and the pixel points which are not subjected to the correction processing smooth, the overexposure degree curve of the pixel points is expressed by the above formula to make the transition between the overexposed region and the non-overexposed region smooth, where smooth transition can be realized by all three curves as shown in fig. 3.
Optionally, after the selecting, according to the overexposure type of the overexposed pixel, to perform tone mapping transformation on the pixel value of the overexposed pixel, or to reserve and mark the position of the overexposed pixel, the method further includes:
the second pixel value R 2 The overexposure degree R of the pixel point oe And a first pixel value R of the pixel point 1 The final pixel value R is calculated according to the following formula out ;
According to the final pixel value R out And outputting the image.
Specifically, in the method of this embodiment, through overexposure pixel points caused by improper setting of sensor exposure parameters, when Rawdata is generated, information is lost, that is, the proportions of R, G, and B are incorrect, and the color is not the original color, so that the effect of color restoration through color correction is poor and the hardware resource occupancy rate is increased. Therefore, the method of this embodiment utilizes the overexposure degree R for the overexposure pixel point that is overexposed due to the automatic exposure of the sensor and retains the overexposure pixel point and marks the position oe And adjacent second pixel value R after tone mapping conversion processing 2 Smoothing the transition between the pixel points after correction processing and the pixel points without correction processing, wherein the final pixel value R is obtained as the overexposure degree of the pixel points is higher and higher out And the original value R 1 (i.e., the first pixel values, wherein the first pixel values of the pixel points comprise the first pixel values of the over-exposed pixel points and the first pixel values of the non-over-exposed pixel points) are getting closer.
In summary, in the method of this embodiment, the overexposure type of the overexposure pixel point is determined, and the optimal correction mode is selected according to the overexposure type to perform the color cast correction, on one hand, the method can increase the storage bit width after the lens shading correction module, for example, the storage bit width is increased from 10 bits to 14 bits, and the complete information after the lens shading correction is retained. And then, after the lens shading is corrected, color correction is carried out on the over-exposed pixel points after the clip in an equal-proportion reduction mode, and the original color of the over-exposed pixel points is restored.
Further, after the method is subjected to lens shading correction, white balance correction is required to compensate the influence of different color temperatures on color cast of the object. The white balance correction also requires multiplying R, G, and B by a gain. Moreover, after the gain compensation of white balance correction, the pixel value may exceed the maximum range, which may cause the pixel point to be overexposed and then clipped, which may cause information loss. Therefore, the method of the embodiment can also perform color correction on the overexposed pixel point after clip by using an equal scaling-down mode after white balance correction, and restore the original color of the overexposed pixel point.
Therefore, the method of the embodiment can also avoid that any module which needs to be multiplied by the gain is multiplied by the gain, so that the pixel value exceeds the maximum range contained by the ISP processor and an overexposed pixel appears and is clip, thereby causing information loss and color cast, and color correction can be performed on the overexposed pixel through color correction in a tone mapping conversion mode.
On the other hand, the method of the embodiment reserves and marks the overexposed pixel points caused by improper setting of the exposure parameters, and then utilizes the overexposure degree R oe And adjacent second pixel value R after equal scaling down cb And the transition between the processed pixel points and the unprocessed pixel points is smooth, so that the correction effect of the color cast region of the image is improved.
Therefore, the method can respectively carry out color correction processing on the overexposed pixel points according to the overexposed types of the overexposed pixel points, thereby simplifying the image color cast correction algorithm and reducing the consumption rate of hardware resources; the correction effect of the image color cast region can be further improved.
An embodiment of the present invention further provides a device for correcting color cast of an image, as shown in fig. 5, the device includes:
a first obtaining unit 11, configured to obtain an overexposed pixel point of an input image;
a judging unit 12, configured to judge an overexposure type of the overexposure pixel;
and the control unit 13 is configured to select to perform tone mapping conversion processing on the pixel value of the overexposed pixel according to the overexposed type of the overexposed pixel, or to reserve and position-mark the overexposed pixel.
The correction device for color cast of an image provided in the embodiment of the present invention mainly analyzes the reason of overexposure of an image, wherein the determination unit 12 of the device in this embodiment can analyze the reason of overexposure of a certain channel or overexposure of all three channels of RGB in an input image, and determine the overexposure type of the overexposure pixel, for example, overexposure of the pixel (for example, after lens shading correction or white balance correction module processing) is caused by improper sensor exposure parameter setting or limitation of an ISP processing module itself. The control unit 13 of the apparatus in this embodiment separately processes overexposure of overexposure pixel points of different overexposure types, and restores the original color and detail of the image through adaptive tone mapping conversion, thereby implementing color cast correction of the image. The device of the embodiment has simple calculation and small hardware resource occupation, and is very beneficial to hardware realization; and the color cast area caused by overexposure of a certain channel can be well corrected.
Alternatively, as shown in fig. 6, the control unit 13 includes:
the processing module 131 is configured to perform tone mapping transformation on the pixel value of the overexposed pixel when the overexposed pixel is caused by gain compensation;
the retaining module 132 is configured to retain the overexposure pixel point and perform position marking when the overexposure pixel point is overexposed due to automatic sensor exposure.
Optionally, the processing module 131 includes:
a threshold value determining sub-module 1311 for determining the threshold value v from the overexposed region information of the input image max ;
A processing submodule 1312 for converting the first pixel value R of the overexposed pixel point 1 Mapping the tone mapping curve to obtain a second pixel value R 2 ;
Where a is a first preset parameter and corresponds to a data range of the sensor, th2 is a second preset parameter, and sigma is a third preset parameter, and is calculated from f (th2) ═ th 2.
Optionally, the apparatus further comprises:
a second obtaining unit 14, configured to obtain all pixel points of the input image;
a first calculating unit 15, configured to calculate, according to the pixel value of each pixel point, a corresponding point of each pixel pointIs over-exposure degree value R oe ;
A second calculation unit 16 for calculating said second pixel value R 2 And the overexposure degree R of the pixel point oe And a first pixel value R of the pixel point 1 Calculating a final pixel value R according to the following formula out ;
Wherein a is a fourth preset parameter and a is more than 0;
an output unit 17 for outputting the final pixel value R out And outputting the image.
The apparatus of this embodiment may be configured to implement the technical solutions of the above method embodiments, and the implementation principles and technical effects are similar, which are not described herein again.
The embodiment of the invention also provides electronic equipment, and the user equipment comprises the device for correcting the image color cast.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by a computer program, which can be stored in a computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. The storage medium may be a magnetic disk, an optical disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), or the like.
The above description is only for the specific embodiment of the present invention, but the scope of the present invention is not limited thereto, and any changes or substitutions that can be easily conceived by those skilled in the art within the technical scope of the present invention are included in the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.
Claims (7)
1. A method for correcting color cast in an image, comprising:
acquiring overexposed pixel points of an input image;
judging the overexposure type of the overexposure pixel point;
selecting to carry out tone mapping transformation processing on the pixel value of the overexposed pixel point or to reserve and position mark the overexposed pixel point according to the overexposed type of the overexposed pixel point;
the selecting the pixel value of the overexposure pixel point to be subjected to tone mapping conversion processing or the reserving and position marking of the overexposure pixel point according to the overexposure type of the overexposure pixel point comprises the following steps: when the overexposure pixel point is caused by the gain compensation processing, carrying out tone mapping conversion processing on the pixel value of the overexposure pixel point; when the overexposure pixel point is overexposed due to automatic exposure of the sensor, reserving the overexposure pixel point and marking the position;
when the overexposure pixel point is caused by overexposure after gain compensation processing, the tone mapping conversion processing on the pixel value of the overexposure pixel point comprises the following steps: determining a threshold v from overexposed region information of an input image max (ii) a The first pixel value R of the overexposed pixel point 1 Mapping the tone mapping curve to obtain a second pixel value R 2 ;
Where a is a first preset parameter and corresponds to a data range of the sensor, th2 is a second preset parameter, and sigma is a third preset parameter, and is calculated from f (th2) ═ th 2.
2. The method of claim 1, wherein prior to said obtaining overexposed pixels of the input image, the method further comprises:
acquiring all pixel points of an input image;
and calculating the overexposure degree value corresponding to each pixel point according to the pixel value of each pixel point.
3. The method of claim 2, wherein the calculating the overexposure value corresponding to each pixel point according to the pixel value of each pixel point comprises:
respectively carrying out interpolation calculation on each pixel point to obtain RGB channel pixel values corresponding to each pixel point, and comparing to obtain a channel maximum value p cmax ;
Maximum value p of the channel cmax Calculating the overexposure value R according to the following formula oe ;
Wherein a is a fourth preset parameter and a>0,l th1 For the fifth preset parameter, h th1 Is a sixth preset parameter, and th1 <h th1 。
4. the method of claim 3, wherein after selecting to perform tone mapping transformation on the pixel value of the overexposed pixel point according to the overexposed type of the overexposed pixel point, or reserving and position-marking the overexposed pixel point, the method further comprises:
the second pixel value R 2 And the overexposure degree R of the pixel point oe And a first pixel value R of the pixel point 1 The final pixel value R is calculated according to the following formula out ;
According to the final pixel value R out And outputting the image.
5. An apparatus for correcting color cast in an image, comprising:
the first acquisition unit is used for acquiring overexposure pixel points of the input image;
the judging unit is used for judging the overexposure type of the overexposure pixel point;
the control unit is used for selecting to carry out tone mapping conversion processing on the pixel value of the overexposed pixel point or reserving and marking the position of the overexposed pixel point according to the overexposed type of the overexposed pixel point;
the control unit includes: the processing module is used for carrying out tone mapping conversion processing on the pixel value of the overexposed pixel point when the overexposed pixel point is caused by gain compensation processing; the reservation module is used for reserving the overexposure pixel points and marking the positions when the overexposure pixel points are overexposed due to automatic exposure of the sensor;
the processing module comprises: a threshold value determining sub-module for determining a threshold value v based on the overexposed region information of the input image max (ii) a A processing submodule for converting the first pixel value R of the overexposed pixel point 1 Mapping the tone mapping curve to obtain a second pixel value R 2 ;
Wherein, a is a first preset parameter and corresponds to the data range of the sensor, th2 is a second preset parameter, and sigma is a third preset parameter, and is calculated from f (th2) th 2.
6. The apparatus of claim 5, further comprising:
the second acquisition unit is used for acquiring all pixel points of the input image;
a first calculating unit for calculating the overexposure degree value R corresponding to each pixel point according to the pixel value of each pixel point oe Specifically, interpolation calculation is performed on each pixel point to obtain pixel values of each channel of RGB corresponding to each pixel point, and the pixel values are compared to obtain a channel maximum value p cmax The maximum value p of the channel cmax As followsCalculating to obtain an overexposure degree value R by a formula oe ;
Wherein a is a fourth preset parameter and a>0,l th1 For the fifth preset parameter, h th1 Is a sixth preset parameter, and th1 <h th1 ;
a second calculation unit for calculating the second pixel value R 2 And the overexposure degree R of the pixel point oe And a first pixel value R of the pixel point 1 Calculating a final pixel value R according to the following formula out ;
Wherein a is a fourth preset parameter and a is greater than 0;
an output unit for outputting the final pixel value R out And outputting the image.
7. An electronic device characterized in that it comprises correction means of image color shift according to any one of claims 5 to 6.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810252674.9A CN110365949B (en) | 2018-03-26 | 2018-03-26 | Image color cast correction method and device and electronic equipment |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810252674.9A CN110365949B (en) | 2018-03-26 | 2018-03-26 | Image color cast correction method and device and electronic equipment |
Publications (2)
Publication Number | Publication Date |
---|---|
CN110365949A CN110365949A (en) | 2019-10-22 |
CN110365949B true CN110365949B (en) | 2022-07-26 |
Family
ID=68212150
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201810252674.9A Active CN110365949B (en) | 2018-03-26 | 2018-03-26 | Image color cast correction method and device and electronic equipment |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110365949B (en) |
Families Citing this family (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113472997B (en) * | 2020-03-31 | 2022-11-04 | 北京小米移动软件有限公司 | Image processing method and device, mobile terminal and storage medium |
CN114078168B (en) * | 2020-08-19 | 2025-03-14 | Oppo广东移动通信有限公司 | Image processing model training method, image processing method and electronic device |
CN113132562B (en) * | 2021-04-21 | 2023-09-29 | 维沃移动通信有限公司 | Lens shading correction method and device and electronic equipment |
Family Cites Families (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP4403397B2 (en) * | 2004-07-21 | 2010-01-27 | ソニー株式会社 | User interface providing device |
CN110232659B (en) * | 2018-03-06 | 2022-09-20 | 展讯通信(天津)有限公司 | Image color cast correction method and device and electronic equipment |
-
2018
- 2018-03-26 CN CN201810252674.9A patent/CN110365949B/en active Active
Also Published As
Publication number | Publication date |
---|---|
CN110365949A (en) | 2019-10-22 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US8368779B2 (en) | Image processing apparatus for performing gradation correction on subject image | |
US8126285B2 (en) | Tone correcting apparatus providing improved tone correction on image | |
KR100990904B1 (en) | Image correction device and its method through generation and synthesis of multiple images | |
JP5148989B2 (en) | Imaging device | |
JP6116272B2 (en) | Image processing apparatus, image processing method, program, and storage medium | |
CN101916431B (en) | Low-illumination image data processing method and system | |
TWI497320B (en) | Automatic tone mapping method and image processing device | |
CN110232659B (en) | Image color cast correction method and device and electronic equipment | |
KR100621414B1 (en) | Chroma Adaptive Image Enhancer and Method | |
JP5392560B2 (en) | Image processing apparatus and image processing method | |
US7421120B2 (en) | Apparatus correcting image by luminance histogram | |
US8526736B2 (en) | Image processing apparatus for correcting luminance and method thereof | |
JP6097588B2 (en) | Image processing apparatus and image processing method | |
US8160383B2 (en) | Tone correcting apparatus providing improved tone correction on image | |
CN110365949B (en) | Image color cast correction method and device and electronic equipment | |
CN112819721B (en) | Method and system for reducing noise of image color noise | |
JP5901667B2 (en) | Image processing apparatus and method, image processing program, and imaging apparatus | |
KR101113483B1 (en) | Apparatus for enhancing visibility of color image | |
JP5358344B2 (en) | Imaging apparatus and imaging method | |
WO2015156041A1 (en) | Image processing apparatus and method, recording medium on which temporarily computer-readable image processing program has been stored, and image pickup apparatus | |
JP5932392B2 (en) | Image processing apparatus and image processing method | |
JP2019040382A (en) | Image processing device | |
CN115330621A (en) | Image processing method, apparatus, device, storage medium, and program product | |
JP2010252002A (en) | Gradation correction apparatus and imaging apparatus | |
CN116939374B (en) | Lens shading correction method and device and electronic equipment |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |