CN115546068A - Method and device for correcting purple fringing of image - Google Patents

Method and device for correcting purple fringing of image Download PDF

Info

Publication number
CN115546068A
CN115546068A CN202211383009.6A CN202211383009A CN115546068A CN 115546068 A CN115546068 A CN 115546068A CN 202211383009 A CN202211383009 A CN 202211383009A CN 115546068 A CN115546068 A CN 115546068A
Authority
CN
China
Prior art keywords
purple
area
image
data
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.)
Pending
Application number
CN202211383009.6A
Other languages
Chinese (zh)
Inventor
贺光辉
林啸
任一帆
黄腾
李阳
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Huixi Intelligent Technology Shanghai Co ltd
Original Assignee
Huixi Intelligent Technology Shanghai Co ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Huixi Intelligent Technology Shanghai Co ltd filed Critical Huixi Intelligent Technology Shanghai Co ltd
Priority to CN202211383009.6A priority Critical patent/CN115546068A/en
Publication of CN115546068A publication Critical patent/CN115546068A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • G06T5/94
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/20Image enhancement or restoration by the use of local operators
    • G06T5/30Erosion or dilatation, e.g. thinning
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/13Edge detection
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/90Determination of colour characteristics
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/10Image acquisition modality
    • G06T2207/10024Color image
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20036Morphological image processing

Abstract

The invention discloses a method and a device for correcting purple fringing of an image, wherein the method comprises the following steps: selecting a high-contrast area according to RGB data of an image, and judging whether the high-contrast area is a purple boundary area or not; when the high-contrast area is a purple boundary area, selecting a seed pixel area which is not polluted by purple boundaries and has a correct color; converting the RGB data of the seed pixel region and the purple-edge region into YUV data, wherein the YUV data comprises a brightness value and a chromatic value of an image in a YUV space; and correcting the purple fringe area according to the YUV data. The method can effectively detect and correct the purple fringing effect caused by the color difference and other reasons, can effectively correct the purple fringing through the algorithm under the condition of not changing the design of the lens, reduces the design cost of a scheme for correcting the purple fringing, and simultaneously effectively improves the image quality.

Description

Method and device for correcting purple fringing of image
Technical Field
The invention relates to the technical field of image processing, in particular to a method and a device for correcting purple fringing of an image.
Background
The digital camera can generate purple fringing in the shooting process, the purple fringing is one of image color fringing, and the dispersion phenomenon appears at the boundary of a bright part and a dark part of an image due to the large contrast of a shot object.
The purple fringing phenomenon has a large influence on image quality, and can be corrected by improving an optical lens, but the method has high cost, so that the purple fringing phenomenon is often improved by adopting a purple fringing correction technology.
The purple fringing correction technology is generally divided into purple fringing pixel point detection and purple fringing pixel point correction. The commonly used purple border pixel point detection technology directly utilizes the color attribute to detect, is easy to detect by mistake, and detects the originally purple pixel point. The common purple-fringed pixel point correction technology adopts a desaturation mode to correct purple-fringed pixel points into neutral gray points, however, for some large-scale purple-fringed pixel points, the purple-fringed pixel points are often colored instead of the neutral gray points, and the direct desaturation method can directly cause color distortion of transition band images.
Disclosure of Invention
In order to solve the above technical problems, the present invention provides a purple fringing correcting method and apparatus.
Specifically, the technical scheme of the invention is as follows:
the invention provides a method for correcting purple fringing of an image, which comprises the following steps:
selecting a high-contrast area according to RGB data of the image;
judging whether the high-contrast area is a purple fringed area;
when the high-contrast area is the purple fringed area, selecting a seed pixel area which is an area which is not polluted by the purple fringed area and has a correct color;
converting the RGB data of the seed pixel region and the purple-edge region into YUV data, wherein the YUV data comprises a brightness value and a chromatic value of an image in a YUV space;
and correcting the purple fringing region according to the YUV data.
In some embodiments, the rectifying the purple fringing field according to the YUV data includes:
calculating a weight function between the purple fringed area and the seed pixel area according to the brightness value of the purple fringed area, the standard deviation of the brightness value in a specified area around the purple fringed area and the brightness value of the seed pixel area in the specified area around the purple fringed area;
and calculating the chroma correction value of the purple boundary area according to the chroma value of the seed pixel area and the weight function.
In some embodiments, the selecting the high contrast area according to the RGB data of the image includes:
acquiring RGB data of an image and normalizing the RGB data;
converting the normalized RGB data into an HIS brightness component, and filtering the HIS brightness component;
calculating the gradient intensity of each pixel point in the image according to the filtering result;
according to the gradient strength, calculating the local gradient and the local standard deviation of each pixel point in the image;
calculating a gradient threshold value of each pixel point in the image according to the local gradient and the local standard deviation;
and selecting the area with the gradient threshold value smaller than the gradient strength as the high-contrast area.
In some embodiments, the normalized RGB image data is converted to the HIS luminance component according to the following formula:
C max =max(max(R n ,G n ),B n );
C min =min(min(R n ,G n ),B n );
Figure BDA0003929333390000021
wherein max is a comparison selection function of selecting a larger value from the two, min is a comparison selection function of selecting a smaller value from the two, R n 、G n 、B n For normalized RGB image data, C max Is R n 、G n 、B n Maximum value of (1), C min Is R n 、G n 、B n Minimum value of (a), I n Is the HIS luminance component.
In some embodiments, the selecting a seed pixel region includes:
performing morphological expansion operation on the purple fringed area to obtain boundary points of the expanded purple fringed area;
and calculating to obtain the seed pixel region according to the boundary point and the high-contrast region.
In some embodiments, the determining whether the high contrast region is a purple fringing region includes:
converting the RGB data of all the pixel points in the high-contrast area into CIE-xyY data;
and when the CIE-xyY data are in a preset range, the high-contrast area is a purple boundary area.
In some embodiments, the converting the RGB image data of all the pixels in the high contrast region into CIE-xyY image data includes:
normalizing the RGB data of all the pixel points in the high-contrast area;
converting the RGB image data after all pixel points in the high-contrast area are normalized into linear RGB image data;
converting the linear RGB image data to CIE-xyY image data according to the following formula:
Figure BDA0003929333390000031
Figure BDA0003929333390000032
wherein R is L 、G L 、B L For linearizing RGB image data, X, Y, Z are X, Y, Z components in CIE-XYZ space, and X, Y are components in CIE-xyY space.
The invention provides a device for correcting purple fringing of an image, which comprises:
the first selection module is used for selecting a high-contrast area according to RGB data of the image;
the judging module is used for judging whether the high-contrast area is a purple boundary area or not;
the second selection module is used for selecting a seed pixel area when the high-contrast area is a purple fringed area, wherein the seed pixel area is an area which is not polluted by the purple fringed area and has a correct color;
the conversion module is used for converting the RGB data of the seed pixel area and the purple-edge area into YUV data, and the YUV data comprises a brightness value and a chromatic value of an image in a YUV space;
and the correction module is used for correcting the purple fringe area according to the YUV data.
In some embodiments, the orthotic module comprises:
a first calculating unit, configured to calculate a weight function between the purple fringing pixel point and the seed pixel point according to the luminance value of the purple fringing region, a standard deviation of the luminance value in a specified field around the purple fringing region, and the luminance value of the seed pixel region in the specified field around the purple fringing region;
a second calculating unit, configured to calculate a chroma correction value of the purple-fringed area according to the chroma value of the purple-fringed area, the chroma value of the seed pixel area, and the weight function.
In some embodiments, the first selecting module comprises:
the processing unit is used for acquiring RGB data and normalizing the RGB data;
the conversion unit is used for converting the normalized RGB data into HIS brightness components;
and the selection unit is used for selecting a high-contrast area according to the HIS brightness component.
Compared with the prior art, the invention has at least one of the following beneficial effects:
1. the method and the device utilize the contrast to detect the purple fringing of the image, and can effectively detect the purple fringing and simultaneously avoid false detection of the originally purple pixel points.
2. The method selects the seed pixel area with the correct color, corrects the purple fringing by using the chromaticity value of the seed pixel area, can avoid color distortion of a correction point, and improves the correction accuracy.
3. The method can effectively correct the purple fringing through the algorithm under the condition of not changing the lens design, and reduces the design cost of the scheme for correcting the purple fringing.
Drawings
The above features, technical features, advantages and modes of implementing the present invention will be further described in the following detailed description of preferred embodiments in a clearly understandable manner by referring to the accompanying drawings.
FIG. 1 is a flow chart of one embodiment of a method of image purple fringing correction of the present invention;
FIG. 2 is a flow chart of another embodiment of a method of image purple fringing correction of the present invention;
FIG. 3 is a block diagram of an embodiment of the apparatus for purple fringing image correction according to the invention;
fig. 4 is a block diagram of another embodiment of the apparatus for image purple fringing correction according to the present invention.
The reference numbers indicate:
the system comprises a first selection module 10, a second selection module 20, a transformation module 30, a correction module 40, a first calculation unit 41 and a second calculation unit 42.
Detailed Description
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following description will be made with reference to the accompanying drawings. It is obvious that the drawings in the following description are only some examples of the invention, and that for a person skilled in the art, other drawings and embodiments can be derived from them without inventive effort.
For the sake of simplicity, only those parts relevant to the invention are schematically shown in the drawings, and they do not represent the actual structure as a product. Moreover, in the interest of brevity and understanding, only one of the components having the same structure or function is illustrated schematically or designated in some of the drawings. In this document, "one" means not only "only one" but also a case of "more than one".
It should be further understood that the term "and/or" as used in this specification and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.
In this context, it is to be understood that, unless otherwise explicitly stated or limited, the terms "mounted," "connected," and "connected" are to be construed broadly, e.g., as meaning either a fixed connection, a removable connection, or an integral connection; can be mechanically or electrically connected; they may be connected directly or indirectly through intervening media, or they may be interconnected between two elements. The specific meanings of the above terms in the present invention can be understood in specific cases to those skilled in the art.
In addition, in the description of the present application, the terms "first", "second", and the like are used only for distinguishing the description, and are not intended to indicate or imply relative importance.
The RGB color scheme is a color standard in the industry, which obtains various colors by changing three color channels of red (R), green (G) and blue (B) and superimposing them with each other, where RGB represents the colors of the three channels of red, green and blue, and the standard includes almost all colors that can be perceived by human vision, and is one of the most widely used color systems at present.
YUV is a color coding method in which the Y component is a luminance value, the U and V components are chrominance values, and luminance and chrominance are separated in YUV space, and if only the Y component and not the U and V components, the image thus represented is a black-and-white gray image, and YUV has an advantage in that bandwidth can be saved compared to RGB.
The CIE color system is a set of standard chromaticity systems defined by the international commission on illumination (CIE), defines a device-independent color model from primary colors, and mathematically derives theoretical three primary colors from real primary colors to create a new color system.
In one embodiment, as shown in fig. 1, a method for purple fringing correction of an image includes:
s100, selecting a high-contrast area according to RGB data of an image;
specifically, in the purple boundary detection process, pixels possibly having purple boundaries need to be detected by means of contrast, processing can be performed in a YCbCr color space or a HIS color space, and a high-contrast area is selected by using gradient information of an image brightness value.
S200, judging whether the high contrast area is a purple boundary area or not;
specifically, because RGB is a color space related to the device, purple fringing color judgment is performed in a CIE-xyY space that is not related to the device, RGB data of a high-contrast area is converted into CIE-xyY data, and if the CIE-xyY data falls in a purple distribution area in the CIE-xyY space, the high-contrast area corresponding to the CIE-xyY data is a purple fringing area.
S300, when the high-contrast area is a purple boundary area, selecting a seed pixel area which is not polluted by purple boundaries and has a correct color;
specifically, the seed pixel region is obtained through calculation by morphological dilation operation.
S400, converting RGB data of the seed pixel region and the purple edge region into YUV data, wherein the YUV data comprises a brightness value and a chromatic value of an image in a YUV space;
s500, according to the YUV data, the purple fringing zone is corrected.
Specifically, all pixel points and surrounding points in the purple boundary region are weighted, a least square loss function is established according to the weighting result, the loss function is solved, the color component of a certain pixel point in the purple boundary region, namely the correction value of the purple boundary pixel point is obtained, and the purple boundary correction is completed through the calculation.
According to the embodiment, the area where purple fringing possibly exists in the image is detected through the contrast, and the color and the brightness of the seed pixel points are utilized to correct the pixel points in the purple fringing area, so that the false detection can be reduced, and the correction accuracy is improved.
In one embodiment, as shown in fig. 2, on the basis of the above embodiment, step S500 includes:
s501, calculating a weight function between a purple fringed pixel point and a seed pixel point according to the brightness value of the purple fringed area, the standard deviation of the brightness value in the designated area around the purple fringed area and the brightness value of the seed pixel area in the designated area around the purple fringed area;
specifically, based on the square of the difference between the purple edge pixel point and the seed pixel point, a weight function w (r) is calculated:
Figure BDA0003929333390000071
wherein, the r point is purple edge pixel point, the s point is seed pixel point in the r point field in space position, Y (r) and Y(s) are brightness values of the r point and the s point, sigma r A common area is a 3x3 window centered around the r point for the standard deviation of the luminance in a specified area around the r point.
S502, according to the chroma value of the seed pixel area and the weight function, the chroma correction value of the purple boundary area is calculated.
Specifically, the above-mentioned weighting function is used to minimize the following loss function J (x):
J(x)=∑ r∈R (x(r)-∑ s∈N(r) w(r)x(s)) 2
the R point is a purple edge pixel point, R is all purple edge areas, x (R) is a color component of the purple edge area at the position R, x(s) is a color component of the seed pixel area at the position s, and N (R) is a neighborhood taking the R pixel as the center.
In this embodiment, since the seed pixel region is a region having a correct color, and although the chroma value of the purple-fringed region is incorrect, the brightness value thereof is correct, a weight function between the purple-fringed pixel point and the seed pixel point is calculated, and the least square loss function is solved by the weight, so that the obtained result is a corrected value of the purple fringed of the image.
In one embodiment, on the basis of the above embodiment, the step S200 includes:
s201, converting the RGB data of all pixel points in the high-contrast area into CIE-xyY data.
Specifically, the RGB data of all the pixels in the high contrast region is normalized, and each component of the RGB data obtained after normalization is converted into a linear RGB domain, which can be calculated according to the following formula:
Figure BDA0003929333390000081
wherein C represents the normalized RGB components, C L Representing linear RGB components.
The linear RGB components are converted to the CIE-xyY domain according to the following formula:
Figure BDA0003929333390000082
Figure BDA0003929333390000083
wherein, R is L 、G L 、B L For linearizing RGB image data, X, Y, Z are X, Y, Z components in CIE-XYZ space, and X, Y are CIE-Component of the xyY space.
S202, judging whether the CIE-xyY data are in a preset range or not, if so, determining that pixel points corresponding to the CIE-xyY data are purple fringed pixel points, and determining that the set of all purple fringed pixel points is a purple fringed area.
Specifically, the distribution area of purple in the CIE-xyY space is:
Reagion purple ={(x,y)|y≤1.6533x-0.1880,y≤-0.2048x+0.3930,y≥0.5510x-0.0227};
if the CIE-xyY data of the high contrast pixel point falls on the Region purple And if so, the pixel point is a purple edge pixel point, and the set of all purple edge pixel points is a purple edge area.
In this embodiment, since RGB is a color space related to a device and CIE is a color space unrelated to a device, the color determination of the purple-fringed region is performed in the CIE color space.
In one embodiment, a method of purple fringing correction for an image includes:
s101 acquires RGB data of an image and normalizes the RGB data.
Specifically, since the RGB data of the image is greatly affected by the illumination and the shadow, the RGB data of the image needs to be normalized, and each component in the normalized RGB data is recorded as R n ,G n ,B n ∈[0,1]。
S102, converting the normalized RGB data into HIS brightness components;
specifically, the HIS luminance component I is calculated by comparing the selection functions n
C max =max(max(R n ,G n ),B n );
C min =min(min(R n ,G n ),B n );
Figure BDA0003929333390000091
Wherein max is a comparison selection function for selecting the larger value of the two, and similarly min is the twoOf a comparison selection function of selecting a smaller value, C max Is R n 、G n 、B n Maximum value of (1), C min Is R n 、G n 、B n Minimum value of (1).
S103, calculating the gradient strength of each pixel point in the image according to the HIS brightness component.
Specifically, to avoid the effect of noise on the gradient calculation, a bilateral filter may be used to apply to the HIS luminance component I n And performing noise reduction treatment, wherein a filter calculation formula is as follows:
Figure BDA0003929333390000092
Figure BDA0003929333390000093
wherein, I smooth For the filtered HIS luminance component, G is the Gaussian filter kernel, σ s Is a spatially filtered kernel variance, σ r Is the variance of the filtering kernel in the range direction, p is the pixel point to be filtered, q is the pixel point in the S field of the p point, W p Are normalized parameters.
Respectively calculating I according to the following formula smooth Difference in horizontal and vertical directions:
I h (x,y)=I smooth (x,y)*Kernel h (x,y);
I v (x,y)=I smooth (x,y)*Kernel v (x,y);
wherein, I h (x, y) is a horizontal gradient, I v (x, y) is the gradient in the vertical direction, kernel h Computing a convolution Kernel, kernel, for the horizontal direction gradient v And calculating a convolution kernel for the gradient in the vertical direction, wherein the two-dimensional convolution operation is adopted, and the gradient convolution kernel is an arbitrary direct calculation gradient convolution kernel without weighting processing, such as a common Sobel operator.
Calculating the gradient strength of the pixel point (x, y) according to the operation result:
Grad I (x,y)=|I h (x,y)|+|I v (x,y)|。
s104, according to the gradient strength, calculating the local gradient and the local standard deviation of each pixel point in the image. Specifically, a box filter is adopted to smooth the gradient image to obtain a local gradient mu grad
μ grad =BoxFilter k (Grad I );
Where BoxFilter is a local averaging smoothing filter, the subscript k indicates the size of the filter kernel, and we set k to an odd number as usual, and we filter by box to obtain the local gradient of the image.
S105, calculating a gradient threshold value of each pixel point in the image according to the local gradient and the local standard deviation.
Specifically, the local standard deviation σ of each pixel point (x, y) in the image is calculated by using the gradient strength and the local gradient grad (x,y):
Figure BDA0003929333390000101
Where m is the sliding range of the window with x as the center, n is the sliding range of the window with y as the center, and k is the size of the filter kernel of the box filter in step S104.
Then calculating the gradient threshold value T of each pixel point grad (x,y):
T grad (x,y)=μ grad (x,y)+ασ grad (x,y);
Wherein, alpha belongs to [0,3] is an adjustable parameter for screening the pixel point where the larger gradient is located, and the common experience range is alpha belongs to [0.5,3].
S106, selecting the area with the gradient threshold value smaller than the gradient intensity as the high-contrast area.
Specifically, the calculation is performed on each pixel point in the image to obtain the gradient strength and the gradient threshold of each pixel point, the gradient strength corresponding to the pixel points is compared with the gradient threshold, if the gradient strength of a certain pixel point is greater than the gradient threshold, the pixel point is a high-contrast pixel point, and the set of all high-contrast areas is a high-contrast area.
S200, judging whether the high-contrast area is a purple fringed area.
Specifically, the RGB data of all pixel points in the high-contrast area is converted into CIE-xyY data, whether the CIE-xyY data is in a preset range or not is judged, if yes, the pixel points corresponding to the CIE-xyY data are purple-fringed pixel points, and the set of all purple-fringed pixel points is a purple-fringed area.
S300, when the high-contrast area is a purple fringed area, selecting a seed pixel area, wherein the seed pixel area is an area which is not polluted by purple fringed and has a correct color;
specifically, after purple fringing detection step finishes, need select the seed point, the seed point must be the point that has the correct colour by purple fringing damage not, detect purple fringing region back, based on this purple fringing region and aforementioned high contrast region, utilize morphological dilation operation, select seed pixel region, seed pixel in this region is used for carrying out the coloring operation to purple fringing pixel, the chromatic value of with purple fringing pixel is replaced for the chromatic value of seed pixel, realize that purple fringing is corrected.
S400, converting the RGB data of the seed pixel area and the purple-edge area into YUV data, wherein the YUV data comprises a brightness value and a chromatic value of an image in a YUV space;
specifically, RGB data of all pixel points in the seed pixel area and the purple boundary area are converted into YUV data, compared with the RGB data, the compatibility of the YUV data is better, and the data processing amount is reduced when purple boundary correction is performed.
S500, correcting the purple fringing zone according to the YUV data.
Specifically, the standard deviation sigma of the brightness values in the designated field around the purple fringed pixel point is calculated according to the brightness value Y (r) of the purple fringed pixel point r, the brightness value Y(s) of the seed pixel point s in the designated field around the purple fringed pixel point and the brightness value in the designated field around the purple fringed pixel point r Calculating purple edge pixel point and seed pixel pointAnd (4) solving a least square loss function according to the weight function and by combining the chromatic value x(s) of the seed pixel area to obtain a corrected value x (r) of the purple fringed area.
In the embodiment, the brightness value of each pixel point in the HIS space is obtained based on the RGB data of the image, the separation of brightness and chroma is realized, the high-contrast area is screened out, the purple edge of the image is detected by utilizing the gradient information of the high-contrast area, and the false detection can be avoided; and selecting seed pixel points by adopting morphological expansion operation, and calculating to obtain a correction value of the purple border of the image according to a weight function and a loss function between the purple border pixel points and the seed pixel points, so that the phenomenon of color distortion can be avoided.
In one embodiment, on the basis of the above embodiment, step S300 includes:
s301, performing morphological expansion operation on the purple fringed area to obtain boundary points of the expanded purple fringed area.
Specifically, the detected purple fringed region is PFR (purple fringing region), and the PFR is morphologically dilated by the following operation, and the dilated purple fringed region is referred to as PFR dilation SE is the morphological filtering kernel:
Figure BDA0003929333390000121
followed by PFR dilation Subtracting the original PFR to obtain the PFR dilation Is marked as PFR D-boundary
S302, according to the boundary point and the high contrast area, a seed pixel area is obtained through calculation.
Specifically, a high contrast region is denoted as NSR (near saturation region), and all the pixels in the region have high luminance values, so that the PFR dilation The high probability of the pixel point in (1) is not a complete and pollution-free point, so that the NSR region needs to be separated from the PFR D-boundary And (3) medium elimination, wherein Seed is marked as a Seed pixel area:
Seed=PFR D-boundary -NSR
in this embodiment, based on the purple fringing field PFR and the high contrast field NSR, the seed pixel field is obtained through the above operation, and the chromatic values of the pixels in the field are used to correct the pixels in the purple fringing field.
In one embodiment, as shown in fig. 3, an apparatus for purple fringing image correction includes a first selecting module 10, a second selecting module 20, a transforming module 30, and a correcting module 40, wherein:
the first selection module 10 is configured to select a high-contrast area according to RGB data of an image, and determine whether the high-contrast area is a purple boundary area;
a second selecting module 20, configured to select a seed pixel region when the high-contrast region is a purple fringed region, where the seed pixel region is a region with a correct color and not polluted by purple fringed regions;
a conversion module 30, configured to convert the RGB data of the seed pixel region and the purple-fringing region into YUV data, where the YUV data includes a luminance value and a chrominance value of an image in a YUV space;
and the correcting module 40 is used for correcting the purple fringe area according to the YUV data.
In one embodiment, as shown in fig. 4, on the basis of the above embodiment, the corrective module 40 comprises a first calculation unit 41 and a second calculation unit 42, wherein:
a first calculating unit 41, configured to calculate a weight function between the purple fringing pixel point and the seed pixel point according to the luminance value of the purple fringing region, a standard deviation of the luminance value in a specified field around the purple fringing region, and the luminance value of the seed pixel region in the specified field around the purple fringing region;
a second calculating unit 42, configured to calculate a chrominance correction value of the purple-fringed region according to the chrominance value of the purple-fringed region, the chrominance value of the seed-pixel region, and the weighting function.
In one embodiment, the first selecting module 20 includes a processing unit 21, a converting unit 22, a selecting unit 23, and a determining unit 24, where:
a processing unit 21, configured to acquire RGB data and normalize the RGB data;
a conversion unit 22, configured to convert the normalized RGB data into an HIS luminance component;
a selecting unit 23, configured to select a high contrast area according to the HIS luminance component;
a judging unit 24, configured to judge whether the high contrast area is a purple boundary area.
Any of the above-mentioned image purple fringing correction devices and the method of the above-mentioned image purple fringing correction device in the present invention are based on the same technical concept, and the technical effects brought by the device are the same as those of the above-mentioned method embodiments of the present invention, and specific contents can be referred to the description of the method embodiments of the present invention, and are not described herein again.
It should be noted that the above embodiments can be freely combined as necessary. The foregoing is only a preferred embodiment of the present invention, and it should be noted that it is obvious to those skilled in the art that various modifications and improvements can be made without departing from the principle of the present invention, and these modifications and improvements should also be considered as the protection scope of the present invention.

Claims (10)

1. A method of purple fringing correction for an image, comprising:
selecting a high-contrast area according to RGB data of the image;
judging whether the high-contrast area is a purple boundary area or not;
when the high-contrast area is the purple fringed area, selecting a seed pixel area which is an area which is not polluted by the purple fringed area and has a correct color;
converting the RGB data of the seed pixel region and the purple-edge region into YUV data, wherein the YUV data comprises a brightness value and a chromatic value of an image in a YUV space;
and correcting the purple fringing region according to the YUV data.
2. The method for purple fringing image correction according to claim 1, wherein the correcting the purple fringing field according to the YUV data includes:
calculating a weight function between the purple fringing region and the seed pixel region according to the brightness value of the purple fringing region, the standard deviation of the brightness value in a specified area around the purple fringing region and the brightness value of the seed pixel region in the specified area around the purple fringing region;
and calculating the chroma correction value of the purple boundary area according to the chroma value of the seed pixel area and the weight function.
3. The method for purple fringing rectification of an image according to claim 1, wherein the selecting a high contrast area according to RGB data of the image comprises:
acquiring RGB data of an image and normalizing the RGB data;
converting the normalized RGB data into HIS brightness components, and filtering the HIS brightness components;
calculating the gradient strength of each pixel point in the image according to the filtering result;
according to the gradient intensity, calculating the local gradient and the local standard deviation of each pixel point in the image;
calculating a gradient threshold value of each pixel point in the image according to the local gradient and the local standard deviation;
and selecting the area of which the gradient threshold value is smaller than the gradient intensity as the high-contrast area.
4. The method of claim 3, wherein the normalized RGB image data is converted into the HIS luminance component according to the following formula:
C max =max(max(R n ,G n ),B n );
C min =min(min(R n ,G n ),B n );
Figure FDA0003929333380000021
wherein max is a comparison selection function of selecting a larger value from the two, min is a comparison selection function of selecting a smaller value from the two, R n 、G n 、B n For normalized RGB image data, C max Is R n 、G n 、B n Maximum value of (1), C min Is R n 、G n 、B n Minimum value of (1), I n Is the HIS luminance component.
5. The method for purple fringing image correction according to claim 1, wherein the selecting a seed pixel region includes:
performing morphological expansion operation on the purple fringed area to obtain boundary points of the expanded purple fringed area;
and calculating to obtain the seed pixel region according to the boundary point and the high-contrast region.
6. The method for purple fringing rectification on an image according to claim 1, wherein the determining whether the high-contrast area is a purple fringed area includes:
converting the RGB data of all the pixel points in the high-contrast area into CIE-xyY data;
and when the CIE-xyY data are in a preset range, the high-contrast area is a purple boundary area.
7. The method of claim 6, wherein said converting the RGB image data of all pixels in the high contrast region into CIE-xyY image data comprises:
normalizing the RGB data of all the pixel points in the high-contrast area;
converting the RGB image data after all pixel points in the high-contrast area are normalized into linear RGB image data;
converting the linear RGB image data to CIE-xyY image data according to the following formula:
Figure FDA0003929333380000031
Figure FDA0003929333380000032
wherein R is L 、G L 、B L For linearizing RGB image data, X, Y, Z are X, Y, Z components in CIE-XYZ space, and X, Y are components in CIE-xyY space.
8. An apparatus for purple fringing correction of an image, comprising:
the first selection module is used for selecting a high-contrast area according to RGB data of an image;
the judging module is used for judging whether the high-contrast area is a purple boundary area or not;
the second selection module is used for selecting a seed pixel area when the high-contrast area is a purple fringed area, wherein the seed pixel area is an area which is not polluted by the purple fringed area and has a correct color;
the conversion module is used for converting the RGB data of the seed pixel area and the purple-edge area into YUV data, and the YUV data comprises a brightness value and a chromatic value of an image in a YUV space;
and the correction module is used for correcting the purple fringe area according to the YUV data.
9. The apparatus for purple fringing image correction according to claim 8, wherein the correction module comprises:
a first calculating unit, configured to calculate a weight function between the purple fringing pixel point and the seed pixel point according to the luminance value of the purple fringing region, a standard deviation of the luminance value in a specified field around the purple fringing region, and the luminance value of the seed pixel region in the specified field around the purple fringing region;
a second calculating unit, configured to calculate a chroma correction value of the purple-fringed area according to the chroma value of the purple-fringed area, the chroma value of the seed pixel area, and the weight function.
10. The apparatus of claim 8, wherein the first selecting module comprises:
the processing unit is used for acquiring RGB data and normalizing the RGB data;
the conversion unit is used for converting the normalized RGB data into HIS brightness components;
and the selecting unit is used for selecting a high-contrast area according to the HIS brightness component.
CN202211383009.6A 2022-11-07 2022-11-07 Method and device for correcting purple fringing of image Pending CN115546068A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211383009.6A CN115546068A (en) 2022-11-07 2022-11-07 Method and device for correcting purple fringing of image

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211383009.6A CN115546068A (en) 2022-11-07 2022-11-07 Method and device for correcting purple fringing of image

Publications (1)

Publication Number Publication Date
CN115546068A true CN115546068A (en) 2022-12-30

Family

ID=84720441

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211383009.6A Pending CN115546068A (en) 2022-11-07 2022-11-07 Method and device for correcting purple fringing of image

Country Status (1)

Country Link
CN (1) CN115546068A (en)

Similar Documents

Publication Publication Date Title
JP4666274B2 (en) Color image processing apparatus and method
US7418132B2 (en) Signal processing apparatus, signal processing program and electronic camera
US7057768B2 (en) Automatic color balance
JP4154847B2 (en) Image processing apparatus, image processing method, and computer-readable recording medium storing image processing program
TWI511559B (en) Image processing method
JP2007110576A (en) Color correction device for subject image data and control method thereof
US20080284916A1 (en) Signal processing method and apparatus, and image sensing apparatus
Jang et al. Adaptive color enhancement based on multi-scaled Retinex using local contrast of the input image
EP2953340B1 (en) Image processing device, image processing method, program, and recording medium
JP2000224607A (en) Image processor
CN103379346A (en) Chrominance information processing method, device and system of images in YUV format
CN113850738A (en) Device and method for correcting purple border of image
Jang et al. Color correction by estimation of dominant chromaticity in multi-scaled retinex
JP2003123063A (en) Image processor
CN110298812B (en) Image fusion processing method and device
CN105208362B (en) Image colour cast auto-correction method based on gray balance principle
KR100915598B1 (en) Automatic white balance apparatus and method thereof
JP2009111947A (en) Image correction device
EP2802139B1 (en) Image color adjusting method and electronic device using the same
JP6143575B2 (en) Image processing apparatus, image processing method, and image processing program
CN115546068A (en) Method and device for correcting purple fringing of image
KR20120042988A (en) Image processing method, image processing device, and program
WO2006106750A1 (en) Image processing device, image processing method, and image processing program
CN114283098A (en) Histogram equalization method
JP3061614B1 (en) Color image quality improvement method and apparatus

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