CN112822476A - Automatic white balance method, system and terminal for color cast of large number of monochrome scenes - Google Patents

Automatic white balance method, system and terminal for color cast of large number of monochrome scenes Download PDF

Info

Publication number
CN112822476A
CN112822476A CN202110219893.9A CN202110219893A CN112822476A CN 112822476 A CN112822476 A CN 112822476A CN 202110219893 A CN202110219893 A CN 202110219893A CN 112822476 A CN112822476 A CN 112822476A
Authority
CN
China
Prior art keywords
area
image
color
image small
small block
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
CN202110219893.9A
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.)
Guangdong Yinuo Communication Co Ltd
Original Assignee
Guangdong Yinuo Communication 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 Guangdong Yinuo Communication Co Ltd filed Critical Guangdong Yinuo Communication Co Ltd
Priority to CN202110219893.9A priority Critical patent/CN112822476A/en
Publication of CN112822476A publication Critical patent/CN112822476A/en
Pending legal-status Critical Current

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
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T11/002D [Two Dimensional] image generation
    • G06T11/40Filling a planar surface by adding surface attributes, e.g. colour or texture
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/90Dynamic range modification of images or parts thereof
    • G06T5/94Dynamic range modification of images or parts thereof based on local image properties, e.g. for local contrast enhancement
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/11Region-based segmentation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/187Segmentation; Edge detection involving region growing; involving region merging; involving connected component labelling
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/194Segmentation; Edge detection involving foreground-background segmentation
    • 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/20021Dividing image into blocks, subimages or windows

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Color Television Image Signal Generators (AREA)
  • Processing Of Color Television Signals (AREA)

Abstract

The invention provides a method, a system and a terminal for automatically white balancing a large number of monochrome scenes, wherein the method utilizes an image segmentation method to compare RGB values of small blocks of an image to determine whether an original image is a monochrome background, further, the method more accurately judges whether a shot original image is the monochrome background by carrying out region division on the original image, and for the original image of the monochrome background, the most accurate white balance gain is obtained by utilizing the automatic white balance gain calculated by the small blocks of the image and the automatic white balance gain weighted average calculated by the whole original image.

Description

Automatic white balance method, system and terminal for color cast of large number of monochrome scenes
Technical Field
The invention belongs to the technical field of image processing, and particularly relates to an automatic white balance method, system and terminal for color cast of a large number of monochrome scenes.
Background
In the conventional white balance method, when color correction is performed, the original image can be calibrated only by gray points or white points, and a single pure color is only one color, such as pure red, so that the original image does not have white points and does not have white points as a reference, and therefore, the conventional white balance algorithm cannot calibrate the pure color image.
Some existing algorithms, such as the advanced white balance algorithm: shooting gray card pictures (D75, D65, D50, CWF, H and A) at different color temperatures in a lamp box, filling the gray cards with the whole live picture, then calibrating a white balance reference point at each color temperature, and then determining a reference white point to draw a reference white area; calculating reference white points of the image to be corrected, which currently fall into a reference white area, and calculating white balance color compensation of the image to be corrected according to the gray points and the weight; the above algorithm does not consider the situation of gray point misjudgment, such as scenes with pure blue and pure red backgrounds, and the false identification of the blue and red wrong region points can be taken as gray points, so that the color cast of the live picture is caused.
For another example, the gray world algorithm: counting all pixel points in the live scene as white points, counting Ravg, Bavg and Gavg of all the pixel points, and then respectively using Gavg/Ravg and Gavg/Bavg as the gain compensation of the R, B channel; the algorithm does not consider the identification of a single pure color scene, does not consider the condition that no gray point or few gray points exist in the shot scene, and when a large-area pure color scene almost has no gray point or few gray points, points which are not gray points are mistakenly judged as gray points, and white balance correction is carried out statistically.
Therefore, the color cast phenomenon of the two algorithms can occur in a pure color scene with high probability.
Disclosure of Invention
In order to overcome one or more of the problems, the invention provides an automatic white balance method, system and terminal for color cast of a large number of monochrome scenes.
In order to achieve the purpose, the invention adopts the following technical scheme:
the invention provides a first aspect of an automatic white balance method for color cast of a large number of monochrome scenes, which comprises the following steps:
the method comprises the steps of obtaining an original image, equally dividing the original image into a plurality of image small blocks, dividing a plurality of image small blocks into a first area, and dividing the rest of image small blocks into a second area;
counting the mean value of RGB three channels of each image small block in the first area;
judging whether each image small block is a pure color scene or/and judging whether the image small block in the first area is a pure color scene or not;
identifying the target object in the second area;
distinguishing a solid background area from a non-solid background area;
and carrying out automatic white balance color compensation on the second area or/and carrying out automatic white balance color compensation according to the whole original image.
In a preferred aspect of the first aspect of the present invention, the distinguishing between the solid background area and the non-solid background area includes:
selecting image small blocks adjacent to the first area and the second area, and temporarily dividing the image small blocks adjacent to the first area and the second area into a third area;
traversing each image patch in the third area;
if the RGB value of the pixel point of the image small block in the third area is larger than the preset threshold value, the image small block larger than the preset threshold value is divided into the first area again to form a new first area;
and if the RGB value of the pixel point of the image small block in the third area is smaller than the preset threshold value, the image small block smaller than the preset threshold value is divided into the second area again to form a new second area.
In a preferred embodiment of the first aspect of the present invention, the determining whether each image patch is a solid-color scene includes:
the discrete aggregation of the pixel points is judged by comparing the variance among three channels of the pixels in each image small block in the original image so as to determine whether the image small block is a pure color scene.
In a preferred embodiment of the first aspect of the present invention, the determining whether the image patch in the first area is a solid-color scene includes:
and judging the discrete aggregation of the pixel points by comparing the variance, the brightness and the color temperature among three channels of the image small block in the first region to determine whether the image small block in the first region is a pure color scene.
In a preferred embodiment of the first aspect of the present invention, the determining the white balance gain color compensation of the original image further includes performing a style adjustment according to the color of the pure color scene, where the style adjustment is performed by using the following formula:
Figure BDA0002954347520000031
wherein k1, k2 and k3 respectively represent three-channel scale factors, and b1, b2 and b3 represent three-channel offset quantities.
A second aspect of the invention provides an automatic white balancing system for color cast of a multiplicity of monochrome scenes, the system comprising:
the acquisition module is used for acquiring an original image;
the segmentation module is used for equally dividing the original image into a plurality of image small blocks;
the dividing module is used for dividing a plurality of image small blocks into a first area, and dividing the rest of image small blocks into a second area;
the statistical module is used for counting the mean value of RGB three channels of each image small block in the first area;
the judging module is used for judging whether each image small block is a pure color scene or/and judging whether the image small block in the first area is a pure color scene or not;
the identification module is used for identifying the target object in the second area;
the distinguishing module is used for distinguishing a pure color background area and a non-pure color background area;
and the white balance module is used for carrying out automatic white balance color compensation on the second area or/and carrying out automatic white balance color compensation according to the whole original image.
In a preferred aspect of the second aspect of the present invention, the distinguishing between the solid background area and the non-solid background area includes:
selecting image small blocks adjacent to the first area and the second area, and temporarily dividing the image small blocks adjacent to the first area and the second area into a third area;
traversing each image patch in the third area;
if the RGB value of the pixel point of the image small block in the third area is larger than the preset threshold value, the image small block larger than the preset threshold value is divided into the first area again to form a new first area;
and if the RGB value of the pixel point of the image small block in the third area is smaller than the preset threshold value, the image small block smaller than the preset threshold value is divided into the second area again to form a new second area.
In a preferred embodiment of the second aspect of the present invention, the determining whether each image patch is a solid-color scene includes:
the discrete aggregation of the pixel points is judged by comparing the variance among three channels of the pixels in each image small block in the original image so as to determine whether the image small block is a pure color scene.
In a preferred embodiment of the second aspect of the present invention, the determining whether the image patch in the first area is a solid-color scene includes:
and judging the discrete aggregation of the pixel points by comparing the variance, the brightness and the color temperature among three channels of the image small block in the first region to determine whether the image small block in the first region is a pure color scene.
The invention also provides a terminal, which comprises a processor and a memory, wherein the memory stores the method of any one of the above embodiments and is executed by the processor.
Compared with the prior art, the invention has the beneficial effects that:
the invention provides a method, a system and a terminal for automatically white balancing color cast of a large number of simple color scenes, wherein the method comprises the following steps: the method comprises the steps of obtaining an original image, equally dividing the original image into a plurality of image small blocks, dividing a plurality of image small blocks into a first area, and dividing the rest of image small blocks into a second area; counting the mean value of RGB three channels of each image small block in the first area; judging whether each image small block is a pure color scene or/and judging whether the image small block in the first area is a pure color scene or not; identifying the target object in the second area; distinguishing a solid background area from a non-solid background area; and carrying out automatic white balance color compensation on the second area or/and carrying out automatic white balance color compensation according to the whole original image. The invention utilizes the image segmentation method to compare the RGB values of the small image blocks to determine whether the original image is a pure color background, further, the area division is carried out on the original image to more accurately judge whether the shot original image is the pure color background, and for the original image of the pure color background, the automatic white balance gain calculated by the small image blocks and the automatic white balance gain calculated by the whole original image are weighted and averaged to obtain the most accurate white balance gain.
Drawings
Fig. 1 is a schematic block diagram of a white balance method for a solid color scene according to the present invention.
Fig. 2 is a schematic diagram of distinguishing original images in the present invention.
Fig. 3 is a block diagram schematically illustrating the white balance system of the solid color scene according to the present invention.
The implementation, functional features and advantages of the objects of the present invention will be further explained with reference to the accompanying drawings.
Detailed Description
In order to make the objects, technical solutions and effects of the present invention clearer and clearer, the present invention is further described in detail below with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
It should be noted that, the method mainly aims at shooting a real object scene with a single solid background, and because the existing white balance method cannot accurately solve the problem of color cast, the scene mainly includes: a solid background takes a picture of the identity of a person, a solid background takes a picture of a pet, or a solid background takes a picture of other objects.
Referring to fig. 1, a first aspect of the present invention provides a method for automatic white balancing of color cast in a large number of monochrome scenes, the method comprising the steps of:
s1, obtaining an original image, equally dividing the original image into a plurality of image small blocks, dividing a plurality of image small blocks into a first area, and dividing the rest of image small blocks into a second area;
specifically, as shown in fig. 2, the original image may be divided into 15 × 15 image patches, and a part of the image patches may be divided into a first region, which may be marked as a black region, and the remaining image patches may be divided into a second region, which may be marked as a white region, where the black region is primarily determined as a background region, and the white region is primarily determined as a target region in the image, where the target is an image target to be photographed, such as a portrait, a pet image, or other targets.
It should be noted that, the dividing of the original image into 15 × 15 parts is only a general finger, and the original image can be divided into more image small blocks or less image small blocks according to the needs, and the more the divided parts are, the more accurate the identification of a large number of pure color scenes is, but the workload is increased; on the contrary, although some workload is reduced, the method is not accurate; therefore, this degree needs to be grasped by the user himself.
S2, counting the mean value of RGB three channels of each image small block in the first area;
specifically, the average value of the RGB three channels of each image patch is counted to prepare for judging whether the image patch is a pure color scene and the color of the image patch.
S3, judging whether each image small block is a pure color scene or/and judging whether the image small block in the first area is a pure color scene;
specifically, the judgment basis is judged according to the mean value, the brightness and the color temperature of RGB three channels of the image small block; it can be understood that if each image patch is a solid color scene, the original image is a mixed solid color scene, there are no or few gray points in the image, and no or insufficient reference for white balance, and the image patches in the first area are all solid color scenes, and there are no or few gray points in the first area, and no or insufficient reference for white balance, so that the second area needs to be subjected to object identification.
S4, identifying the target object in the second area;
specifically, in the scheme, the target objects are divided into three types, namely a pure-color background certificate photo with a face, a pure-color background photo with a pet, and a pure-color background photo with other shot objects as targets;
it should be noted that the scheme of the face recognition algorithm, the pet recognition algorithm and the algorithm of other target objects is not introduced too much, and the existing algorithm is directly used.
S5, distinguishing a pure color background area from a non-pure color background area;
it is understood that, in step S3, it is only determined briefly whether each image patch or/and the image patch in the first region is a solid color scene, however, in reality, a solid color background photograph with an object cannot be completely distinguished by the above-mentioned segmentation method, such as a region where the background and the object are adjacent, and therefore, the regions need to be defined by re-dividing again.
And S6, carrying out automatic white balance color compensation on the second area or/and carrying out automatic white balance color compensation according to the whole original image.
Specifically, only two white balance compensation gain calculations are provided here:
firstly, the corresponding automatic white balance color compensation is obtained only according to the second region (target objects, such as human images, pets and the like) by using the advanced gray scale world algorithm, and it can be assumed that the color compensation corresponding to the RGB three channels is R _ k1, G _ k1 and B _ k 1;
secondly, acquiring corresponding automatic white balance color compensation by utilizing a high-level gray world algorithm according to the whole original image, wherein the color compensation corresponding to RGB three channels can be assumed to be R _ k2, G _ k2 and B _ k 2;
the final RGB three channel color compensation gains R _ k2, G _ k2, B _ k2 are:
Figure BDA0002954347520000071
wherein, R _ p1, G _ p1, G _ p1, R _ p2, G _ p2, G _ p2 represent the weights of the first and second compensation gains, respectively.
In the calculation of the first compensation gain, it is assumed that the gain for recognizing a face is R _ p1_ people, the weight for using the gain for recognizing an animal is R _ p1_ dog, and the gain for recognizing a face is R _ p1_ dog, and the following relationships are required:
R_p1_people≥R_p1_dog≥R_p1_dog;
the reason is that the skin color of the face is closer to gray than other objects, so that the determination of white-balanced gray points is more accurate.
In summary, the method of the present invention determines whether the original image is a pure color background by comparing RGB values of image patches through an image segmentation method, further, determines whether the original image is a pure color background more accurately by performing region division on the original image, and obtains the most accurate white balance gain by weighted averaging the automatic white balance gain calculated by the image patches and the automatic white balance gain calculated by the entire original image for the original image with the pure color background.
In a preferred aspect of the first aspect of the present invention, the distinguishing between the solid background area and the non-solid background area includes:
selecting image small blocks adjacent to the first area and the second area, and temporarily dividing the image small blocks adjacent to the first area and the second area into a third area;
traversing each image patch in the third area;
if the RGB value of the pixel point of the image small block in the third area is larger than the preset threshold value, the image small block larger than the preset threshold value is divided into the first area again to form a new first area;
and if the RGB value of the pixel point of the image small block in the third area is smaller than the preset threshold value, the image small block smaller than the preset threshold value is divided into the second area again to form a new second area.
It is understood that the division of the region of the original image in step S3 is relatively coarse, and a finer division can be performed by the principle of a linker;
specifically, boundary image small blocks adjacent to a first area and a second area are selected, the image small blocks are temporarily divided into a third area named as an area A, the number of the image small blocks in the area A is N1, any small block Ai in the area A is selected, then a small block Bj or two image small blocks Bk sharing one edge with Ai are selected in the second area, and if the value of a pixel point RGB in Ai and the value of a pixel point RGB in Bj or Bk meet the following relation:
Figure BDA0002954347520000081
subdividing Bj or Bk into a first region;
wherein, S _ R, S _ G and S _ B respectively represent the judgment of the similarity of R channels in two adjacent image small blocks;
ravg _ i, Gavg _ i and Bavg _ i respectively represent the mean value of RGB in Ai;
ravg _ j, Gavg _ j and Bavg _ j respectively represent the mean value of RGB in Bj;
th1, Th2 and Th3 respectively represent corresponding threshold values;
after traversing the image small blocks in the area A, newly added image small blocks are re-divided into the first area or the second area; thus, the first region (background region) and the second region (target region) can be obtained more accurately.
In a preferred embodiment of the first aspect of the present invention, the determining whether each image patch is a solid-color scene includes:
the discrete aggregation of the pixel points is judged by comparing the variance among three channels of the pixels in each image small block in the original image so as to determine whether the image small block is a pure color scene.
Specifically, whether each image patch is a solid-color scene can be determined by the following formula:
Figure BDA0002954347520000091
wherein i is more than or equal to 1 and less than or equal to C, and C is the number of image small blocks of the first region block;
ci represents the number of pixels of the ith image patch,
th _ R, Th _ G, Th _ B represent variance thresholds of the respective channels, and Th represent a determination of a pure color, such as pure red or pure blue or other pure colors.
I is more than or equal to 1 and less than or equal to Ci; rij, Gij, Bij, YIj respectively represent RGB values of j th pixel of i th image small block in the first area;
k is more than or equal to 1 and less than or equal to Ci; rik, Gik, Bik, Yik represent RGB values of the jth pixel of the ith image patch in the first region, respectively;
when the counted number C1 of the pure color regions satisfies a following equation, it indicates that the entire first region is a single-color scene, a large number of single-color scenes, or a mixed-color scene;
C1/C≥80%;
of course, 80% is only an empirical number and can be adjusted by the user.
In a preferred embodiment of the first aspect of the present invention, the determining whether the image patch in the first area is a solid-color scene includes:
and judging the discrete aggregation of the pixel points by comparing the variance, the brightness and the color temperature among three channels of the image small block in the first region to determine whether the image small block in the first region is a pure color scene.
Specifically, whether the image patch in the first area is a solid scene may be determined by the following formula:
Figure BDA0002954347520000101
wherein N represents the total number of image small blocks of the first area;
s _ R, S _ G, S _ B, S _ Y and S _ T respectively represent RGB variance, brightness and color temperature of the image small blocks in the first region;
ravg _ i, Gavg _ i, Bavg _ i, Yavg _ i, T _ i respectively represent the average values of RGB, brightness and color temperature of the ith image patch in the first area,
th1, Th2 and Th3 respectively represent corresponding thresholds.
It should be noted that, the above lists two judgment methods of the solid background, and both the first judgment and the second judgment are satisfied, the original image can be regarded as the solid background image; the division of the first area is also divided empirically, and may be adjusted in number or/and changed in position according to actual needs.
In a preferred embodiment of the first aspect of the present invention, the determining the white balance gain color compensation of the original image further includes performing a style adjustment according to the color of the pure color scene, where the style adjustment is performed by using the following formula:
Figure BDA0002954347520000111
wherein k1, k2 and k3 respectively represent three-channel scale factors, and b1, b2 and b3 represent three-channel offset quantities.
A second aspect of the invention provides an automatic white balancing system for color cast of a multiplicity of monochrome scenes, the system comprising:
an obtaining module 10, configured to obtain an original image;
it is understood that the original image may be an image to be captured by a digital device or a captured image stored in the digital device.
A segmentation module 20, configured to equally divide an original image into a plurality of image patches;
specifically, the original image may be equally divided into 15 × 15 image patches;
it should be noted that, the dividing of the original image into 15 × 15 parts is only a general finger, and the original image can be divided into more image small blocks or less image small blocks according to the needs, and the more the divided parts are, the more accurate the identification of a large number of pure color scenes is, but the workload is increased; on the contrary, although some workload is reduced, the method is not accurate; therefore, this degree needs to be grasped by the user himself.
A dividing module 30, configured to divide a plurality of image patches into first regions, and divide the rest of image patches into second regions;
some of the image small blocks are divided into a first area which can be marked as a black area, and the rest of the image small blocks are divided into a second area which can be marked as a white area, wherein the black area is primarily judged as a background area, and the white area is primarily judged as a target area in the image, and the target is an image target to be shot, such as a portrait, a pet image or other targets.
The statistical module 40 is used for counting the mean value of the RGB three channels of each image small block in the first area;
it should be noted that, the statistics of the mean value of the RGB three channels of each image patch is to prepare for determining whether the image patch is a pure color scene and the color of the image patch.
A judging module 50, configured to judge whether each image tile is a solid color scene or/and judge whether an image tile in the first area is a solid color scene;
specifically, the judgment basis is judged according to the mean value, the brightness and the color temperature of RGB three channels of the image small block; it can be understood that if each image patch is a solid color scene, the original image is a mixed solid color scene, there are no or few gray points in the image, and no or insufficient reference for white balance, and the image patches in the first area are all solid color scenes, and there are no or few gray points in the first area, and no or insufficient reference for white balance, so that the second area needs to be subjected to object identification.
An identification module 60, configured to perform object identification on the second area;
specifically, in the scheme, the target objects are divided into three types, namely a pure-color background certificate photo with a face, a pure-color background photo with a pet, and a pure-color background photo with other shot objects as targets;
it should be noted that the scheme of the face recognition algorithm, the pet recognition algorithm and the algorithm of other target objects is not introduced too much, and the existing algorithm is directly used.
A distinguishing module 70 for distinguishing a solid background region from a non-solid background region;
it is understood that, in step S3, it is only determined briefly whether each image patch or/and the image patch in the first region is a solid color scene, however, in reality, a solid color background photograph with an object cannot be completely distinguished by the above-mentioned segmentation method, such as a region where the background and the object are adjacent, and therefore, the regions need to be defined by re-dividing again.
And a white balance module 80, configured to perform automatic white balance color compensation on the second region or/and perform automatic white balance color compensation according to the whole original image.
Specifically, only two white balance compensation gain calculations are provided here:
firstly, the corresponding automatic white balance color compensation is obtained only according to the second region (target objects, such as human images, pets and the like) by using the advanced gray scale world algorithm, and it can be assumed that the color compensation corresponding to the RGB three channels is R _ k1, G _ k1 and B _ k 1;
secondly, acquiring corresponding automatic white balance color compensation by utilizing a high-level gray world algorithm according to the whole original image, wherein the color compensation corresponding to RGB three channels can be assumed to be R _ k2, G _ k2 and B _ k 2;
the final RGB three channel color compensation gains R _ k2, G _ k2, B _ k2 are:
Figure BDA0002954347520000131
wherein, R _ p1, G _ p1, G _ p1, R _ p2, G _ p2, G _ p2 represent the weights of the first and second compensation gains, respectively.
In the calculation of the first compensation gain, it is assumed that the gain for recognizing a face is R _ p1_ people, the weight for using the gain for recognizing an animal is R _ p1_ dog, and the gain for recognizing a face is R _ p1_ dog, and the following relationships are required:
R_p1_people≥R_p1_dog≥R_p1_dog;
the reason is that the skin color of the face is closer to gray than other objects, so that the determination of white-balanced gray points is more accurate.
In summary, the method of the present invention utilizes an image segmentation system to compare RGB values of image patches to determine whether an original image is a pure background, further, performs region segmentation on the original image to more accurately determine whether the original image is a pure background, and for the original image with a pure background, obtains the most accurate white balance gain by weighted averaging the automatic white balance gain calculated by the image patches and the automatic white balance gain calculated by the entire original image.
In a preferred aspect of the second aspect of the present invention, the distinguishing between the solid background area and the non-solid background area includes:
selecting image small blocks adjacent to the first area and the second area, and temporarily dividing the image small blocks adjacent to the first area and the second area into a third area;
traversing each image patch in the third area;
if the RGB value of the pixel point of the image small block in the third area is larger than the preset threshold value, the image small block larger than the preset threshold value is divided into the first area again to form a new first area;
and if the RGB value of the pixel point of the image small block in the third area is smaller than the preset threshold value, the image small block smaller than the preset threshold value is divided into the second area again to form a new second area.
It is understood that the division of the region of the original image in step S3 is relatively coarse, and a finer division can be performed by the principle of a linker;
specifically, boundary image small blocks adjacent to a first area and a second area are selected, the image small blocks are temporarily divided into a third area named as an area A, the number of the image small blocks in the area A is N1, any small block Ai in the area A is selected, then a small block Bj or two image small blocks Bk sharing one edge with Ai are selected in the second area, and if the value of a pixel point RGB in Ai and the value of a pixel point RGB in Bj or Bk meet the following relation:
Figure BDA0002954347520000141
subdividing Bj or Bk into a first region;
wherein, S _ R, S _ G and S _ B respectively represent the judgment of the similarity of R channels in two adjacent image small blocks;
ravg _ i, Gavg _ i and Bavg _ i respectively represent the mean value of RGB in Ai;
ravg _ j, Gavg _ j and Bavg _ j respectively represent the mean value of RGB in Bj;
th1, Th2 and Th3 respectively represent corresponding threshold values;
after traversing the image small blocks in the area A, newly added image small blocks are re-divided into the first area or the second area; thus, the first region (background region) and the second region (target region) can be obtained more accurately.
In a preferred embodiment of the second aspect of the present invention, the determining whether each image patch is a solid-color scene includes:
the discrete aggregation of the pixel points is judged by comparing the variance among three channels of the pixels in each image small block in the original image so as to determine whether the image small block is a pure color scene.
Specifically, whether each image patch is a solid-color scene can be determined by the following formula:
Figure BDA0002954347520000151
wherein i is more than or equal to 1 and less than or equal to C, and C is the number of image small blocks of the first region block;
ci represents the number of pixels of the ith image patch,
th _ R, Th _ G, Th _ B represent variance thresholds of the respective channels, and Th represent a determination of a pure color, such as pure red or pure blue or other pure colors.
I is more than or equal to 1 and less than or equal to Ci; rij, Gij, Bij, YIj respectively represent RGB values of j th pixel of i th image small block in the first area;
k is more than or equal to 1 and less than or equal to Ci; rik, Gik, Bik, Yik represent RGB values of the jth pixel of the ith image patch in the first region, respectively;
when the counted number C1 of the pure color regions satisfies a following equation, it indicates that the entire first region is a single-color scene, a large number of single-color scenes, or a mixed-color scene;
C1/C≥80%;
of course, 80% is only an empirical number and can be adjusted by the user.
In a preferred embodiment of the second aspect of the present invention, the determining whether the image patch in the first area is a solid-color scene includes:
and judging the discrete aggregation of the pixel points by comparing the variance, the brightness and the color temperature among three channels of the image small block in the first region to determine whether the image small block in the first region is a pure color scene.
Specifically, whether the image patch in the first area is a solid scene may be determined by the following formula:
Figure BDA0002954347520000161
wherein N represents the total number of image small blocks of the first area;
s _ R, S _ G, S _ B, S _ Y and S _ T respectively represent RGB variance, brightness and color temperature of the image small blocks in the first region;
ravg _ i, Gavg _ i, Bavg _ i, Yavg _ i, T _ i respectively represent the average values of RGB, brightness and color temperature of the ith image patch in the first area,
th1, Th2 and Th3 respectively represent corresponding thresholds.
It should be noted that, the above lists two judgment methods of the solid background, and both the first judgment and the second judgment are satisfied, the original image can be regarded as the solid background image; the division of the first area is also divided empirically, and may be adjusted in number or/and changed in position according to actual needs.
The invention also provides a terminal, which comprises a processor and a memory, wherein the memory stores the method of any one of the above embodiments and is executed by the processor.
It is understood that all or part of the steps of the methods according to the above embodiments may be implemented by a program instructing associated hardware, and the program may be stored in a memory readable by a computer device and used for executing all or part of the steps of the methods according to the above embodiments. The computer devices, including but not limited to: personal computers, servers, general-purpose computers, special-purpose computers, network devices, embedded devices, programmable devices, intelligent mobile terminals, intelligent home devices, wearable intelligent devices, vehicle-mounted intelligent devices, and the like; the memory includes but is not limited to: RAM, ROM, magnetic disk, magnetic tape, optical disk, flash memory, U disk, removable hard disk, memory card, memory stick, network server storage, network cloud storage, etc.
It should be understood that equivalents and modifications of the technical solution and inventive concept thereof may occur to those skilled in the art, and all such modifications and alterations should fall within the scope of the appended claims.

Claims (10)

1. A method for automatic white balancing of color cast in a mass of monochrome scenes, the method comprising:
the method comprises the steps of obtaining an original image, equally dividing the original image into a plurality of image small blocks, dividing a plurality of image small blocks into a first area, and dividing the rest of image small blocks into a second area;
counting the mean value of RGB three channels of each image small block in the first area;
judging whether each image small block is a pure color scene or/and judging whether the image small block in the first area is a pure color scene or not;
identifying the target object in the second area;
distinguishing a solid background area from a non-solid background area;
and carrying out automatic white balance color compensation on the second area or/and carrying out automatic white balance color compensation according to the whole original image.
2. The white balance method according to claim 1, wherein the distinguishing the solid color background region from the non-solid color background region includes:
selecting image small blocks adjacent to the first area and the second area, and temporarily dividing the image small blocks adjacent to the first area and the second area into a third area;
traversing each image patch in the third area;
if the RGB value of the pixel point of the image small block in the third area is larger than the preset threshold value, the image small block larger than the preset threshold value is divided into the first area again to form a new first area;
and if the RGB value of the pixel point of the image small block in the third area is smaller than the preset threshold value, the image small block smaller than the preset threshold value is divided into the second area again to form a new second area.
3. The white balancing method of claim 1, wherein the determining whether each image tile is a solid scene comprises:
the discrete aggregation of the pixel points is judged by comparing the variance among three channels of the pixels in each image small block in the original image so as to determine whether the image small block is a pure color scene.
4. The white balance method according to claim 1, wherein the determining whether the image patch in the first area is a solid scene comprises:
and judging the discrete aggregation of the pixel points by comparing the variance, the brightness and the color temperature among three channels of the image small block in the first region to determine whether the image small block in the first region is a pure color scene.
5. The white balance method of claim 1, wherein determining the white balance gain color compensation of the original image further comprises performing a style adjustment based on the color of the solid color scene, the style adjustment being performed using the following formula:
Figure FDA0002954347510000021
wherein k1, k2 and k3 respectively represent three-channel scale factors, and b1, b2 and b3 represent three-channel offset quantities.
6. An automatic white balance system for color cast of a multiplicity of monochrome scenes, said system comprising:
the acquisition module is used for acquiring an original image;
the segmentation module is used for equally dividing the original image into a plurality of image small blocks;
the dividing module is used for dividing a plurality of image small blocks into a first area, and dividing the rest of image small blocks into a second area;
the statistical module is used for counting the mean value of RGB three channels of each image small block in the first area;
the judging module is used for judging whether each image small block is a pure color scene or/and judging whether the image small block in the first area is a pure color scene or not;
the identification module is used for identifying the target object in the second area;
the distinguishing module is used for distinguishing a pure color background area and a non-pure color background area;
and the white balance module is used for carrying out automatic white balance color compensation on the second area or/and carrying out automatic white balance color compensation according to the whole original image.
7. The system of claim 6, wherein the distinguishing between solid background regions and non-solid background regions comprises:
selecting image small blocks adjacent to the first area and the second area, and temporarily dividing the image small blocks adjacent to the first area and the second area into a third area;
traversing each image patch in the third area;
if the RGB value of the pixel point of the image small block in the third area is larger than the preset threshold value, the image small block larger than the preset threshold value is divided into the first area again to form a new first area;
and if the RGB value of the pixel point of the image small block in the third area is smaller than the preset threshold value, the image small block smaller than the preset threshold value is divided into the second area again to form a new second area.
8. The system of claim 6, wherein the determining whether each image tile is a solid color scene comprises:
the discrete aggregation of the pixel points is judged by comparing the variance among three channels of the pixels in each image small block in the original image so as to determine whether the image small block is a pure color scene.
9. The system of claim 6, wherein the determining whether the image patch in the first region is a solid scene comprises:
and judging the discrete aggregation of the pixel points by comparing the variance, the brightness and the color temperature among three channels of the image small block in the first region to determine whether the image small block in the first region is a pure color scene.
10. A terminal, characterized in that the terminal comprises a processor and a memory, the memory being adapted to store the method according to any of claims 1-6, the processor being adapted to execute the method stored in the memory.
CN202110219893.9A 2021-02-26 2021-02-26 Automatic white balance method, system and terminal for color cast of large number of monochrome scenes Pending CN112822476A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110219893.9A CN112822476A (en) 2021-02-26 2021-02-26 Automatic white balance method, system and terminal for color cast of large number of monochrome scenes

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110219893.9A CN112822476A (en) 2021-02-26 2021-02-26 Automatic white balance method, system and terminal for color cast of large number of monochrome scenes

Publications (1)

Publication Number Publication Date
CN112822476A true CN112822476A (en) 2021-05-18

Family

ID=75864122

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110219893.9A Pending CN112822476A (en) 2021-02-26 2021-02-26 Automatic white balance method, system and terminal for color cast of large number of monochrome scenes

Country Status (1)

Country Link
CN (1) CN112822476A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113473035A (en) * 2021-07-23 2021-10-01 北京字节跳动网络技术有限公司 Ambient brightness determination method and device and electronic equipment
CN113596427A (en) * 2021-09-13 2021-11-02 厦门亿联网络技术股份有限公司 Image white balance improving method and device, electronic equipment and storage medium

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040156544A1 (en) * 2002-11-29 2004-08-12 Tamotsu Kajihara Image processing apparatus and method
CN107563986A (en) * 2017-09-08 2018-01-09 北京进化者机器人科技有限公司 The determination methods and system of image-region
CN108769634A (en) * 2018-07-06 2018-11-06 Oppo(重庆)智能科技有限公司 A kind of image processing method, image processing apparatus and terminal device
CN109151428A (en) * 2018-08-30 2019-01-04 Oppo广东移动通信有限公司 automatic white balance processing method, device and computer storage medium
CN110659683A (en) * 2019-09-20 2020-01-07 杭州智团信息技术有限公司 Image processing method and device and electronic equipment
CN111127480A (en) * 2019-12-18 2020-05-08 上海众源网络有限公司 Image processing method and device, electronic equipment and storage medium

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040156544A1 (en) * 2002-11-29 2004-08-12 Tamotsu Kajihara Image processing apparatus and method
CN107563986A (en) * 2017-09-08 2018-01-09 北京进化者机器人科技有限公司 The determination methods and system of image-region
CN108769634A (en) * 2018-07-06 2018-11-06 Oppo(重庆)智能科技有限公司 A kind of image processing method, image processing apparatus and terminal device
CN109151428A (en) * 2018-08-30 2019-01-04 Oppo广东移动通信有限公司 automatic white balance processing method, device and computer storage medium
CN110659683A (en) * 2019-09-20 2020-01-07 杭州智团信息技术有限公司 Image processing method and device and electronic equipment
CN111127480A (en) * 2019-12-18 2020-05-08 上海众源网络有限公司 Image processing method and device, electronic equipment and storage medium

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113473035A (en) * 2021-07-23 2021-10-01 北京字节跳动网络技术有限公司 Ambient brightness determination method and device and electronic equipment
CN113596427A (en) * 2021-09-13 2021-11-02 厦门亿联网络技术股份有限公司 Image white balance improving method and device, electronic equipment and storage medium
CN113596427B (en) * 2021-09-13 2024-03-15 厦门亿联网络技术股份有限公司 Image white balance improving method and device, electronic equipment and storage medium

Similar Documents

Publication Publication Date Title
CN109361910B (en) Self-adaptive white balance correction method and device
US10929718B2 (en) Image recognition apparatus, learning apparatus, image recognition method, learning method, and storage medium
US10846554B2 (en) Hash-based appearance search
CN110084135B (en) Face recognition method, device, computer equipment and storage medium
CN112822476A (en) Automatic white balance method, system and terminal for color cast of large number of monochrome scenes
WO2017096865A1 (en) Method and device for processing human face-containing image
CN108182421B (en) Video segmentation method and device
WO2019071739A1 (en) Face living body detection method and apparatus, readable storage medium and terminal device
CN110798592B (en) Object movement detection method, device and equipment based on video image and storage medium
CN107358245B (en) Method for detecting image collaborative salient region
CN108551576B (en) White balance method and device
CN110233971B (en) Shooting method, terminal and computer readable storage medium
CN111935479B (en) Target image determination method and device, computer equipment and storage medium
JP4098021B2 (en) Scene identification method, apparatus, and program
CN109919166B (en) Method and device for acquiring classification information of attributes
CN109510946B (en) HDR scene detection method and system
CN113301318B (en) Image white balance processing method and device, storage medium and terminal
CN109766828A (en) A kind of vehicle target dividing method, device and communication equipment
WO2022222575A1 (en) Method and system for target recognition
CN105184771A (en) Adaptive moving target detection system and detection method
WO2018078806A1 (en) Image processing device, image processing method, and image processing program
CN112396016B (en) Face recognition system based on big data technology
CN113868457A (en) Image processing method based on image gathering and related device
CN112101260B (en) Method, device, equipment and storage medium for identifying safety belt of operator
CA3011713A1 (en) Hash-based appearance search

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
WD01 Invention patent application deemed withdrawn after publication

Application publication date: 20210518

WD01 Invention patent application deemed withdrawn after publication