CN112954290B - 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
CN112954290B
CN112954290B CN202110242124.0A CN202110242124A CN112954290B CN 112954290 B CN112954290 B CN 112954290B CN 202110242124 A CN202110242124 A CN 202110242124A CN 112954290 B CN112954290 B CN 112954290B
Authority
CN
China
Prior art keywords
value
white
image
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.)
Active
Application number
CN202110242124.0A
Other languages
Chinese (zh)
Other versions
CN112954290A (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 an 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 device 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 an image after white balance correction.
In a preferred embodiment of the present invention, in step S100, m is a pixel size of the tile in the horizontal direction, n is a pixel size of the tile in the vertical direction, and both of the 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 an 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, P i,j Is 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: 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*WT x );
GSUM=GSUM+(G*WT x );
BSUM=BSUM+(B*WT x );
WTSUM=WTSUM+WT x
RSUM is the accumulated sum of the R values of the white points, GSUM is the accumulated sum of the G values of the white points, BSUM is the accumulated sum of the B values of the white points, and 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 is AVG Average value of R value of white point, G AVG Average value of white point G value, B AVG The 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 is gain White balance compensation gain value, G, for white point R value gain White balance compensation gain value for white point G value, B gain The 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 is out R value, R, of the image corrected for white balance in R value, G, of the image before white balance correction out Value of G for the white balance corrected image, G in Is the G value, B of the image before white balance correction out B value of the image corrected for white balance, B in The B value of the image before the white balance correction.
Through the technical scheme, the invention has the following beneficial effects:
the method has reasonable design, and greatly improves the reliability of the found reference white point by adopting the method of firstly finding the smooth region block in the image and then finding the reference white point in the smooth region block, thereby greatly improving 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 further described in 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, P i,j For 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 a weight coefficient of the small block, and the smoother small block is obtained according to the theoretical assumption, wherein the probability of reference white points is higher, so that a smaller weight coefficient is given to the small block with a larger smooth coefficient, a larger weight coefficient is given to the small block with a smaller smooth coefficient, N is a maximum weight value, alpha is a constant coefficient, and Threshold is a smooth Threshold value, and the value is obtained by correcting 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 a 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=log 2 B-log 2 G;
Cr=log 2 R-log 2 G;
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*WT x );
GSUM=GSUM+(G*WT x );
BSUM=BSUM+(B*WT x );
WTSUM=WTSUM+WT x
RSUM is the accumulated sum of the R values of the white points, GSUM is the accumulated sum of the G values of the white points, BSUM is the accumulated sum of the B values of the white points, and 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 is AVG Average value of R value of white point, G AVG Average value of white point G value, B AVG The 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 is gain White balance compensation gain value, G, for white point R value gain White balance compensation gain value for white point G value, B gain White balance compensation for white point B valueCompensating the gain 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 is out R value, R, of the image corrected for white balance in R value, G, of an image before white balance correction out Value of G for the white balance corrected image, G in Is the G value, B of the image before white balance correction out B value of the image corrected for white balance, B in Is 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 (7)

1. A white balance correction method based on image smoothness is characterized by comprising the following steps:
s100, averagely dividing the whole frame image into L m x n small blocks, wherein m is the size of a pixel in the horizontal direction of the small blocks, and n is the size of a pixel in the vertical direction of the small blocks;
s200, calculating a smoothing coefficient of each small block, wherein the calculation formula of the smoothing coefficient is as follows:
Figure FDA0003809579090000011
wherein, VAR x Is the smoothing coefficient, P, of the small block i,j Pixel values within each tile;
s300, calculating a weight value of each small block according to the smoothing coefficient, wherein the weight value calculation formula is as follows:
Figure FDA0003809579090000012
wherein, WT x The weight coefficient of the small block is N, the maximum weight value is N, alpha is a constant coefficient, and Threshold is a smooth Threshold value;
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 a 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.
2. The image smoothness-based white balance correction method of claim 1, wherein in step S100, neither of the values of m and n is less than 16.
3. The image smoothness-based white balance correction method of claim 1, wherein in step S100, the image format is in an RGB format.
4. The image smoothness-based white balance correction method of claim 1, 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.
5. The method for correcting white balance based on image smoothness as claimed in claim 1, wherein in step S400, said accumulated statistics include the sum of the R/G/B values of white dots and the sum of the weight values of the small blocks where white dots are located, and the specific calculation formula is:
RSUM=RSUM+(R*WT x );
GSUM=GSUM+(G*WT x );
BSUM=BSUM+(B*WT x );
WTSUM=WTSUM+WT x
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.
6. The image smoothness-based white balance correction method of claim 5, wherein in step S500, the white balance gain calculation comprises 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 FDA0003809579090000021
Figure FDA0003809579090000022
Figure FDA0003809579090000023
wherein R is AVG Average value of R value of white point, G AVG Average value of white point G value, B AVG The average value of the white point B value is obtained;
s502, calculating white balance gain according to the average value of the white point R/G/B value, wherein the specific calculation formula is as follows:
Figure FDA0003809579090000024
Figure FDA0003809579090000025
Figure FDA0003809579090000026
wherein R is gain White balance compensation gain value, G, for white point R value gain White balance compensation gain value for white point G value, B gain The gain value is compensated for white balance for the white point B value.
7. The image smoothness-based white balance correction method according to claim 6, wherein in step S600, the formula for calculating the R/G/B value of the white balance-corrected image is:
Figure FDA0003809579090000031
Figure FDA0003809579090000032
Figure FDA0003809579090000033
wherein R is out R value, R, of the image corrected for white balance in R value, G, of the image before white balance correction out Value of G for the white balance corrected image, G in Is the G value, B of the image before white balance correction out B value of the image corrected for white balance, B in Is 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 CN112954290A (en) 2021-06-11
CN112954290B true 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 (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105282530A (en) * 2014-05-28 2016-01-27 深圳中兴力维技术有限公司 Method and device for implementing automatic white balance based on background modeling

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP4063418B2 (en) * 1998-09-11 2008-03-19 イーストマン コダック カンパニー Auto white balance device
US20070047803A1 (en) * 2005-08-30 2007-03-01 Nokia Corporation Image processing device with automatic white balance
CN103093429B (en) * 2013-01-18 2016-03-02 金三立视频科技(深圳)有限公司 Image enchancing method
US9661290B2 (en) * 2014-11-21 2017-05-23 Samsung Electronics Co., Ltd. Image processing apparatus and method
CN104581105B (en) * 2015-02-03 2016-01-20 中国人民解放军国防科学技术大学 Based on the auto white balance method of colour temperature range conversion weight map and the correction of block reliability
KR102346522B1 (en) * 2015-09-10 2022-01-03 삼성전자주식회사 Image processing device and auto white balancing metohd thereof
CN106506905B (en) * 2016-10-20 2019-07-16 湖南国科微电子股份有限公司 Camera lens shadow correction method

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105282530A (en) * 2014-05-28 2016-01-27 深圳中兴力维技术有限公司 Method and device for implementing automatic white balance based on background modeling

Also Published As

Publication number Publication date
CN112954290A (en) 2021-06-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
CN109525847B (en) Just noticeable distortion model threshold calculation method
CN104732578B (en) A kind of building texture optimization method based on oblique photograph technology
CN106651897B (en) Parallax correction method based on super-pixel segmentation
WO2020124873A1 (en) Image processing method
KR20130094626A (en) Method and apparatus for stereo matching
CN108460792B (en) Efficient focusing stereo matching method based on image segmentation
CN113808193A (en) Light spot centroid positioning method based on block threshold
CN117152163B (en) Bridge construction quality visual detection method
CN110763306A (en) Monocular vision-based liquid level measurement system and 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
CN104038752B (en) Multi-view point video rectangular histogram color correction based on three-dimensional Gaussian mixed model
CN109671084B (en) Method for measuring shape of workpiece
CN112396016B (en) Face recognition system based on big data technology
TWI383690B (en) Method for image processing
CN112954290B (en) White balance correction device and method based on image smoothness
CN114049320A (en) Device missing AI quality inspection method and device based on picture similarity
CN105989583A (en) Image defogging method
CN112991329A (en) Image shadow detection and elimination method based on GAN
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
CN108647620B (en) Gamma transform-based illumination normalization method for weber face

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