CN112954290A - White balance correction device and method based on image smoothness - Google Patents

White balance correction device and method based on image smoothness Download PDF

Info

Publication number
CN112954290A
CN112954290A CN202110242124.0A CN202110242124A CN112954290A CN 112954290 A CN112954290 A CN 112954290A CN 202110242124 A CN202110242124 A CN 202110242124A CN 112954290 A CN112954290 A CN 112954290A
Authority
CN
China
Prior art keywords
white
image
value
white balance
point
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.)
Granted
Application number
CN202110242124.0A
Other languages
Chinese (zh)
Other versions
CN112954290B (en
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.)
Chongqing Xinqi Artificial Intelligence Chip Technology Co Ltd
Original Assignee
Chongqing Xinqi Artificial Intelligence Chip Technology 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 Chongqing Xinqi Artificial Intelligence Chip Technology Co Ltd filed Critical Chongqing Xinqi Artificial Intelligence Chip Technology Co Ltd
Priority to CN202110242124.0A priority Critical patent/CN112954290B/en
Publication of CN112954290A publication Critical patent/CN112954290A/en
Application granted granted Critical
Publication of CN112954290B publication Critical patent/CN112954290B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N9/00Details of colour television systems
    • H04N9/64Circuits for processing colour signals
    • H04N9/73Colour balance circuits, e.g. white balance circuits or colour temperature control

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Color Television Image Signal Generators (AREA)
  • Processing Of Color Television Signals (AREA)

Abstract

The invention provides a white balance correction device based on image smoothness, which comprises an image blocking weight value calculation module, a white point counting module, a white balance gain calculation module and a white balance correction module, wherein the image blocking weight value calculation module is used for dividing an image equally and calculating the weight value of each divided image, the white point counting module is used for judging whether each pixel point in the image is white point according to the weight value of each image and carrying out accumulation counting on all white points, the white balance gain calculation module is used for accumulating and calculating white balance gain according to the white points, and the white balance correction module is used for carrying out image correction. The invention greatly improves the reliability of the found reference white point, thereby greatly improving the accuracy of the white balance correction of the image.

Description

White balance correction device and method based on image smoothness
Technical Field
The present invention relates to the field of image processing, and in particular, to a white balance correction device and method based on image smoothness.
Background
The color of an object observed by the human eye is not only related to the color of the object itself, but also to the light source illuminated. Due to the visual characteristics of human eyes, the human eyes can still perceive the correct color of the object under different light sources, and the characteristic of the human eyes is called 'color constancy'. In the process of imaging by a digital camera, as the light source of the shooting environment varies, the same object may appear in various colors, which are inconsistent with the colors observed by human eyes. This requires the white balance correction means to correct the image so that the object exhibits its own color.
The key point of the white balance correction device is to find a reference white point in an image, then calculate a gain value of white balance correction according to the accumulated value of each R/G/B component of all the reference white points in the image, and perform white balance correction on an original image according to the white balance gain value. At present, a reference white point is found in the whole image by common white balance correction devices and methods, and many irrelevant pixel points are often mistakenly determined as the reference white point, so that the white balance correction result is not accurate enough and has certain defects.
Disclosure of Invention
In view of the above-mentioned deficiencies of the prior art, an object of the present invention is to provide a white balance correction apparatus and method based on image smoothness, which can improve the reliability of the found reference white point, thereby improving the accuracy of the white balance correction of the image.
In order to achieve the purpose, the invention adopts the following technical scheme:
the white balance correction device based on the image smoothness comprises an image block weight value calculation module, a white point counting module, a white balance gain calculation module and a white balance correction module, wherein the image block weight value calculation module is used for dividing an image into halves and calculating the weight value of each divided image, the white point counting module is used for judging whether each pixel point in the image is white point or not according to the weight value of each image and carrying out accumulation counting on all white points, the white balance gain calculation module is used for accumulating and calculating white balance gain according to the white points, and the white balance correction module is used for carrying out image correction.
A white balance correction method based on image smoothness comprises the following steps:
s100, averagely dividing the whole frame of image into L m x n small blocks;
s200, calculating a smooth coefficient of each small block;
s300, calculating the weight value of each small block according to the smoothing coefficient;
s400, respectively judging whether each pixel point in the whole frame image belongs to a white point, and performing accumulation statistics according to the weight value of the small block where the pixel point is located;
s500, calculating white balance gain according to the white point accumulated statistical data;
and S600, applying the white balance gain to the original image to obtain the image after white balance correction.
In a preferred embodiment of the present invention, in step S100, m is a pixel size of the horizontal direction of the small block, n is a pixel size of the vertical direction of the small block, and both values of m and n are not less than 16.
In a preferred embodiment of the present invention, in step S100, the image format is in RGB format.
In a preferred embodiment of the present invention, in step S200, the smoothing coefficient calculation formula is:
Figure BDA0002962577290000021
wherein VAR is the smoothing coefficient of the small block, Pi,jIs the pixel value within each tile.
In a preferred embodiment of the present invention, in step S300, the weight value calculation formula is:
Figure BDA0002962577290000022
wherein, WT is the weight coefficient of the small block, N is the maximum weight value, α is a constant coefficient, and Threshold is the smoothing Threshold.
In a preferred embodiment of the present invention, in step S400, the method for determining the white point is as follows: traversing each pixel point in the image, calculating the coordinate value of the pixel point according to the R/G/B value of the pixel point, judging whether the pixel point is located in the specified range, if the coordinate value of the pixel point is located in the specified range, judging the pixel point to be a reference white point, otherwise, judging the pixel point not to be the reference white point.
In a preferred embodiment of the present invention, in step S400, the accumulated statistics includes accumulating and summing R/G/B values of white points and accumulating and summing weight values of small blocks where white points are located, and a specific calculation formula is as follows:
RSUM=RSUM+(R*WTx);
GSUM=GSUM+(G*WTx);
BSUM=BSUM+(B*WTx);
WTSUM=WTSUM+WTx
the RSUM is the accumulated sum of the R values of the white points, the GSUM is the accumulated sum of the G values of the white points, the BSUM is the accumulated sum of the B values of the white points, and the WTSUM is the accumulated sum of the weight values of the small blocks where the white points are located.
In a preferred embodiment of the present invention, in step S500, the white balance gain calculation includes the steps of:
s501, carrying out average calculation on the R/G/B value of the white point, wherein the specific calculation formula is as follows:
Figure BDA0002962577290000031
Figure BDA0002962577290000032
Figure BDA0002962577290000033
wherein R isAVGAverage value of R value of white point, GAVGAverage value of white point G value, BAVGThe average value of the white point B value is;
s502, calculating white balance gain according to the average value of the R/G/B value of the white point, wherein the specific calculation formula is as follows:
Figure BDA0002962577290000041
Figure BDA0002962577290000042
Figure BDA0002962577290000043
wherein R isgainWhite balance compensation gain value, G, for white point R valuegainWhite balance compensation gain value for white point G value, BgainThe gain value is compensated for white balance for the white point B value.
In a preferred embodiment of the present invention, in step S600, the formula for calculating the R/G/B value of the white balance corrected image is:
Figure BDA0002962577290000044
Figure BDA0002962577290000045
Figure BDA0002962577290000046
wherein R isoutR value, R, of the image corrected for white balanceinR value, G, of the image before white balance correctionoutValue of G for the white balance corrected image, GinIs the G value, B of the image before white balance correctionoutB value of the image corrected for white balance, BinIs the B value of the image before white balance correction.
Through the technical scheme, the invention has the following beneficial effects:
the method has reasonable design, adopts the method of firstly searching the smooth region block in the image and then searching the reference white point in the smooth region block, greatly improves the reliability of the searched reference white point, and further greatly improves the accuracy of the white balance correction of the image.
Drawings
FIG. 1 is a block diagram of a white balance correction apparatus based on image smoothness according to the present invention;
FIG. 2 is a flow chart of a method of white balance correction based on image smoothness according to the present invention;
FIG. 3 is a schematic diagram of averaging an entire image frame in a white balance correction method based on image smoothness according to the present invention.
FIG. 4 is a chromaticity coordinate diagram of a white balance correction method based on image smoothness according to the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention is described in further detail below with reference to the accompanying drawings and embodiments.
The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the disclosure. As used in this disclosure and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise.
As shown in fig. 1, an embodiment of a white balance correction apparatus based on image smoothness according to the present invention is shown. In this embodiment, the white balance correction device includes an image blocking weight value calculation module, a white point statistics module, a white balance gain calculation module, and a white balance correction module, where the image blocking weight value calculation module is configured to divide an image equally and calculate a weight value of each divided image, the white point statistics module is configured to determine whether each pixel point in the image is a white point according to the weight value of each image, and perform accumulation statistics on all white points, the white balance gain calculation module is configured to accumulate and calculate a white balance gain according to the white points, and the white balance correction module is configured to perform image correction.
As shown in fig. 2-4, an embodiment of a white balance correction method based on image smoothness according to the present invention is shown. In the present embodiment, the white balance correction includes the steps of:
s100, averagely dividing the whole frame of image into L m x n small blocks; the image format adopts an RGB format, according to the graph shown in FIG. 3, m is the pixel size of the small block in the horizontal direction, n is the pixel size of the small block in the vertical direction, and the values of m and n are not less than 16;
s200, calculating a smooth coefficient of each small block; the smoothing coefficient calculation formula is as follows:
Figure BDA0002962577290000061
wherein VAR is the smoothing coefficient of the small block, Pi,jFor the pixel value in each small block, the smoothing coefficient VAR represents the smoothing degree of the small block, the smaller the value is, the smoother the small block is on the surface, and the higher the probability of the reference white point appearing in the small block is;
s300, calculating the weight value of each small block according to the smoothing coefficient; the weighted value calculation formula is as follows:
Figure BDA0002962577290000062
WT is the weight coefficient of the small block, and according to the theoretical assumption, the smoother small block is the one with higher possibility of reference white point, so for the small block with larger smooth coefficient, smaller weight coefficient is given, for the small block with smaller smooth coefficient, larger weight coefficient is given, N is the maximum weight value, alpha is a constant coefficient, Threshold is a smooth Threshold value, and the value should be obtained by correction and debugging according to different digital camera models;
s400, respectively judging whether each pixel point in the whole frame image belongs to a white point, and performing accumulation statistics according to the weight value of the small block where the pixel point is located; the method for judging the white point comprises the following steps: traversing each pixel point in the image, calculating the coordinate value of the pixel point according to the R/G/B value of the pixel point, judging whether the pixel point is located in a specified range, if the coordinate value of the pixel point is located in the specified range, judging that the pixel point is a reference white point, otherwise, judging that the pixel point is not the reference white point, and the specific steps are as follows: assuming that the pixel point belongs to the small block x, calculating the coordinate value of the pixel point according to the R/G/B value of the pixel point as follows:
Cb=log2B-log2G;
Cr=log2R-log2G;
and judging whether the pixel point is located in a specified range or not according to the calculated Cb and Cr values, referring to a chromaticity coordinate diagram shown in FIG. 4, and if the Cb/Cr coordinate value of the pixel point is located in an irregular polygon surrounded by ABCDEF, judging that the pixel point is a reference white point. The coordinate value of ABCDEF needs to be obtained by debugging and correcting according to different digital camera models; the accumulation statistics comprises accumulation of R/G/B values of white points and accumulation of weighted values of small blocks where the white points are located, and the specific calculation formula is as follows:
RSUM=RSUM+(R*WTx);
GSUM=GSUM+(G*WTx);
BSUM=BSUM+(B*WTx);
WTSUM=WTSUM+WTx
the RSUM is the accumulated sum of the R values of the white points, the GSUM is the accumulated sum of the G values of the white points, the BSUM is the accumulated sum of the B values of the white points, and the WTSUM is the accumulated sum of the weight values of the small blocks where the white points are located.
S500, calculating white balance gain according to the white point accumulated statistical data; the white balance gain calculation includes the steps of:
s501, carrying out average calculation on the R/G/B value of the white point, wherein the specific calculation formula is as follows:
Figure BDA0002962577290000071
Figure BDA0002962577290000072
Figure BDA0002962577290000073
wherein R isAVGAverage value of R value of white point, GAVGAverage value of white point G value, BAVGThe average value of the white point B value is;
s502, calculating white balance gain according to the average value of the R/G/B value of the white point, wherein the specific calculation formula is as follows:
Figure BDA0002962577290000074
Figure BDA0002962577290000075
Figure BDA0002962577290000076
wherein R isgainWhite balance compensation gain value, G, for white point R valuegainWhite balance compensation gain value for white point G value, BgainA white balance compensation gain value which is a white point B value;
s600, applying white balance gain to the original image to obtain an image after white balance correction; the R/G/B value of the image after white balance correction is calculated according to the formula:
Figure BDA0002962577290000081
Figure BDA0002962577290000082
Figure BDA0002962577290000083
wherein R isoutR value, R, of the image corrected for white balanceinR value, G, of the image before white balance correctionoutValue of G for the white balance corrected image, GinIs the G value, B of the image before white balance correctionoutB value of the image corrected for white balance, BinIs the B value of the image before white balance correction.
Compared with the prior art, the invention has the following beneficial effects:
the method of searching the smooth region block in the image and then searching the reference white point in the smooth region block greatly improves the reliability of the searched reference white point, thereby greatly improving the accuracy of the white balance correction of the image.
While the invention has been described with respect to a preferred embodiment, it will be understood by those skilled in the art that the foregoing and other changes, omissions and deviations in the form and detail thereof may be made without departing from the scope of this invention. Those skilled in the art can make various changes, modifications and equivalent arrangements, which are equivalent to the embodiments of the present invention, without departing from the spirit and scope of the present invention, and which may be made by utilizing the techniques disclosed above; meanwhile, any changes, modifications and variations of the above-described embodiments, which are equivalent to those of the technical spirit of the present invention, are within the scope of the technical solution of the present invention.

Claims (10)

1. The white balance correction device based on the image smoothness is characterized by comprising an image blocking weight value calculation module, a white point counting module, a white balance gain calculation module and a white balance correction module, wherein the image blocking weight value calculation module is used for dividing an image in half and calculating the weight value of each divided image, the white point counting module is used for judging whether each pixel point in the image is white point according to the weight value of each image and carrying out accumulation counting on all white points, the white balance gain calculation module is used for accumulating and calculating white balance gain according to the white points, and the white balance correction module is used for correcting the image.
2. A white balance correction method based on image smoothness is characterized by comprising the following steps:
s100, averagely dividing the whole frame of image into L m x n small blocks;
s200, calculating a smooth coefficient of each small block;
s300, calculating the weight value of each small block according to the smoothing coefficient;
s400, respectively judging whether each pixel point in the whole frame image belongs to a white point, and performing accumulation statistics according to the weight value of the small block where the pixel point is located;
s500, calculating white balance gain according to the white point accumulated statistical data;
and S600, applying the white balance gain to the original image to obtain the image after white balance correction.
3. The image smoothness-based white balance correction method of claim 2, wherein in step S100, m is a pixel size of a horizontal direction of the tile, n is a pixel size of a vertical direction of the tile, and a value of each of m and n is not less than 16.
4. The image smoothness-based white balance correction method according to claim 2, wherein in step S100, the image format is an RGB format.
5. The white balance correction method based on image smoothness according to claim 2, wherein in step S200, the smoothing coefficient calculation formula is:
Figure FDA0002962577280000011
wherein VAR is the smoothing coefficient of the small block, Pi,jIs the pixel value within each tile.
6. The method of claim 2, wherein in step S300, the weight value calculation formula is:
Figure FDA0002962577280000021
wherein, WT is the weight coefficient of the small block, N is the maximum weight value, α is a constant coefficient, and Threshold is the smoothing Threshold.
7. The image smoothness-based white balance correction method of claim 2, wherein in step S400, the white point is determined by: traversing each pixel point in the image, calculating the coordinate value of the pixel point according to the R/G/B value of the pixel point, judging whether the pixel point is located in the specified range, if the coordinate value of the pixel point is located in the specified range, judging the pixel point to be a reference white point, otherwise, judging the pixel point not to be the reference white point.
8. The method as claimed in claim 2, wherein in step S400, the accumulated statistics include an accumulated sum of R/G/B values of white dots and an accumulated sum of weight values of small blocks with white dots, and the specific calculation formula is as follows:
RSUM=RSUM+(R*WTx);
GSUM=GSUM+(G*WTx);
BSUM=BSUM+(B*WTx);
WTSUM=WTSUM+WTx
the RSUM is the accumulated sum of the R values of the white points, the GSUM is the accumulated sum of the G values of the white points, the BSUM is the accumulated sum of the B values of the white points, and the WTSUM is the accumulated sum of the weight values of the small blocks where the white points are located.
9. The image smoothness-based white balance correction method of claim 2, wherein in step S500, the white balance gain calculation includes the steps of:
s501, carrying out average calculation on the R/G/B value of the white point, wherein the specific calculation formula is as follows:
Figure FDA0002962577280000031
Figure FDA0002962577280000032
Figure FDA0002962577280000033
wherein R isAVGAverage value of R value of white point, GAVGAverage value of white point G value, BAVGThe average value of the white point B value is;
s502, calculating white balance gain according to the average value of the R/G/B value of the white point, wherein the specific calculation formula is as follows:
Figure FDA0002962577280000034
Figure FDA0002962577280000035
Figure FDA0002962577280000036
wherein R isgainWhite balance compensation gain value, G, for white point R valuegainWhite balance compensation gain value for white point G value, BgainThe gain value is compensated for white balance for the white point B value.
10. The method for white balance correction based on image smoothness according to claim 2, wherein in step S600, the formula for calculating R/G/B value of the white balance corrected image is:
Figure FDA0002962577280000037
Figure FDA0002962577280000038
Figure FDA0002962577280000039
wherein R isoutR value, R, of the image corrected for white balanceinR value, G, of the image before white balance correctionoutValue of G for the white balance corrected image, GinIs the G value, B of the image before white balance correctionoutB value of the image corrected for white balance, BinIs the B value of the image before white balance correction.
CN202110242124.0A 2021-03-04 2021-03-04 White balance correction device and method based on image smoothness Active CN112954290B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110242124.0A CN112954290B (en) 2021-03-04 2021-03-04 White balance correction device and method based on image smoothness

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110242124.0A CN112954290B (en) 2021-03-04 2021-03-04 White balance correction device and method based on image smoothness

Publications (2)

Publication Number Publication Date
CN112954290A true CN112954290A (en) 2021-06-11
CN112954290B CN112954290B (en) 2022-11-11

Family

ID=76247775

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110242124.0A Active CN112954290B (en) 2021-03-04 2021-03-04 White balance correction device and method based on image smoothness

Country Status (1)

Country Link
CN (1) CN112954290B (en)

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6727942B1 (en) * 1998-09-11 2004-04-27 Eastman Kodak Company Auto white balance apparatus
CN101283604A (en) * 2005-08-30 2008-10-08 诺基亚公司 Image processing device with automatic white balance
CN103093429A (en) * 2013-01-18 2013-05-08 金三立视频科技(深圳)有限公司 Image intensification method
CN104581105A (en) * 2015-02-03 2015-04-29 中国人民解放军国防科学技术大学 Automatic white balance method based on color temperature range conversion weight map
CN105282530A (en) * 2014-05-28 2016-01-27 深圳中兴力维技术有限公司 Method and device for implementing automatic white balance based on background modeling
US20160155217A1 (en) * 2014-11-21 2016-06-02 Samsung Electronics Co., Ltd. Image processing apparatus and method
CN106506905A (en) * 2016-10-20 2017-03-15 湖南国科微电子股份有限公司 Camera lens shadow correction method
US20170078636A1 (en) * 2015-09-10 2017-03-16 Samsung Electronics Co., Ltd. Image processing device and auto white balancing method

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6727942B1 (en) * 1998-09-11 2004-04-27 Eastman Kodak Company Auto white balance apparatus
CN101283604A (en) * 2005-08-30 2008-10-08 诺基亚公司 Image processing device with automatic white balance
CN103093429A (en) * 2013-01-18 2013-05-08 金三立视频科技(深圳)有限公司 Image intensification method
CN105282530A (en) * 2014-05-28 2016-01-27 深圳中兴力维技术有限公司 Method and device for implementing automatic white balance based on background modeling
US20160155217A1 (en) * 2014-11-21 2016-06-02 Samsung Electronics Co., Ltd. Image processing apparatus and method
CN104581105A (en) * 2015-02-03 2015-04-29 中国人民解放军国防科学技术大学 Automatic white balance method based on color temperature range conversion weight map
US20170078636A1 (en) * 2015-09-10 2017-03-16 Samsung Electronics Co., Ltd. Image processing device and auto white balancing method
CN106534821A (en) * 2015-09-10 2017-03-22 三星电子株式会社 Image processing device and auto white balancing method
CN106506905A (en) * 2016-10-20 2017-03-15 湖南国科微电子股份有限公司 Camera lens shadow correction method

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
王晓: "基于Retinex理论的图像颜色校正算法", 《中国优秀硕士学位论文全文数据库(电子期刊)》 *

Also Published As

Publication number Publication date
CN112954290B (en) 2022-11-11

Similar Documents

Publication Publication Date Title
CN109785291B (en) Lane line self-adaptive detection method
US8035871B2 (en) Determining target luminance value of an image using predicted noise amount
CN111583198A (en) Insulator picture defect detection method combining FasterR-CNN + ResNet101+ FPN
CN109525847B (en) Just noticeable distortion model threshold calculation method
CN104732578B (en) A kind of building texture optimization method based on oblique photograph technology
CN109345502B (en) Stereo image quality evaluation method based on disparity map stereo structure information extraction
WO2020124873A1 (en) Image processing method
CN106651897B (en) Parallax correction method based on super-pixel segmentation
KR20130094626A (en) Method and apparatus for stereo matching
CN117152163B (en) Bridge construction quality visual detection method
CN109978858B (en) Double-frame thumbnail image quality evaluation method based on foreground detection
CN115731166A (en) High-voltage cable connector polishing defect detection method based on deep learning
CN105989583A (en) Image defogging method
CN104038752B (en) Multi-view point video rectangular histogram color correction based on three-dimensional Gaussian mixed model
CN113344796A (en) Image processing method, device, equipment and storage medium
CN112396016B (en) Face recognition system based on big data technology
CN109671084B (en) Method for measuring shape of workpiece
CN112954290B (en) White balance correction device and method based on image smoothness
CN116958092A (en) Power transmission line sag rapid measurement method based on improved stereo matching algorithm
CN116758447A (en) Digital twinning-based substation equipment fault analysis system
WO2022252697A1 (en) Camera image fusion method and camera image fusion system
CN115170437A (en) Fire scene low-quality image recovery method for rescue robot
CN115222652A (en) Method for identifying, counting and centering end faces of bundled steel bars and memory thereof
CN108647620B (en) Gamma transform-based illumination normalization method for weber face
CN109685114B (en) Image similarity judgment method based on pre-screening method and PHash

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