White balance control method and device, equipment and medium
By acquiring RGB images and four polarization channels, extracting feature parameters and filtering candidate regions, calculating confidence levels, and determining the white balance (AWB) strategy, the problem of inaccurate white balance adjustment under complex lighting conditions is solved, thus improving image quality.
Patent Information
- Application Number
- CN202511759197.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-26
- Publication Date
- 2026-03-17
AI Technical Summary
Existing AWB technology struggles to achieve precise white balance adjustment under complex lighting and reflection environments, resulting in poor image quality.
By acquiring RGB and four-polarization channel images from a mobile terminal, image feature parameters are extracted, candidate regions are selected based on preset feature constraints, region confidence is calculated, and white balance (AWB) strategy is determined and adjusted according to the confidence.
It significantly improves the accuracy and visual consistency of automatic white balance in images under complex lighting conditions, adapting to the white balance adjustment needs under different lighting conditions.
Smart Images

Figure CN121691944A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of image processing, and in particular to a white balance control method and device, equipment and a medium. BACKGROUND
[0002] With the increasing popularity of intelligent cameras, AR glasses and mobile shooting devices, users' demand for high-quality image automatic acquisition and Auto White Balance (AWB) experience is increasing.
[0003] The current mainstream AWB technology mainly relies on RGB channel information for gray point detection or statistical histogram estimation of light sources. However, the related AWB technology has poor white balance adjustment effect for different regions in the collected image when processing scene images with different lighting conditions, especially in complex lighting environments, strong reflection areas (such as windows, water surfaces), and multi-light source scenes: for high-reflectance areas in the scene image, such as windows, glass, water surfaces, etc., due to the mirror reflection effect, it will cause obvious color cast of RGB AWB, and the white balance is invalid, and the RGB AWB estimation for low brightness areas is unstable, and color cast is prone to occur. That is, the current AWB technology for white balance control of images collected in scenes with multiple different lighting conditions can only achieve effective white balance adjustment for part of the region, and cannot adapt to the white balance control needs of dynamic complex scenes, resulting in poor overall white balance adjustment effect of images in complex scenes and low imaging quality.
[0004] In summary, it is currently not possible to achieve accurate automatic white balance in complex lighting and reflection environments, therefore, how to maintain the accuracy of automatic white balance under different lighting conditions has become a technical problem to be solved. SUMMARY
[0005] The present application provides a white balance control method, device, equipment and storage medium, which aims to solve the technical problem of low accuracy of automatic white balance in complex lighting and reflection environments in the prior art.
[0006] In a first aspect, the present application provides a white balance control method, comprising: obtaining an RGB image and a four-polarization channel image of an original scene image corresponding to a current scene of a mobile terminal; performing image feature extraction on the RGB image based on the four-polarization channel image to obtain image feature parameters corresponding to the RGB image; performing filtering on the image feature parameters corresponding to the RGB image based on a preset feature constraint to obtain at least one candidate region; determine a region confidence corresponding to each of the candidate regions, and obtain a comparison result of comparing the region confidence corresponding to each of the candidate regions with a preset confidence threshold; determine an auto white balance (AWB) strategy corresponding to each of the candidate regions according to the comparison result, and perform AWB adjustment on each of the candidate regions according to the AWB strategy.
[0007] In a second aspect, the present application further provides a white balance control device, comprising: an image information extraction module configured to obtain an RGB image and four-polarization channel images of an original scene image corresponding to a current scene of a mobile terminal; an image feature extraction module configured to perform image feature extraction on the RGB image based on the four-polarization channel images, and obtain image feature parameters corresponding to the RGB image; a candidate region screening module configured to screen the image feature parameters corresponding to the RGB image based on a preset feature constraint, and obtain at least one candidate region; a region confidence comparison module configured to determine a region confidence corresponding to each of the candidate regions, and obtain a comparison result of comparing the region confidence corresponding to each of the candidate regions with a preset confidence threshold; an AWB strategy determination module configured to determine an auto white balance (AWB) strategy corresponding to each of the candidate regions according to the comparison result, and perform AWB adjustment on each of the candidate regions according to the AWB strategy.
[0008] In a third aspect, the present application further provides a computer device, comprising a processor, a memory, and a computer program stored in the memory and executable by the processor, wherein the computer program is executed by the processor to implement the steps of the white balance control method as described above.
[0009] In a fourth aspect, the present application further provides a computer readable storage medium, wherein a computer program is stored in the computer readable storage medium, and the computer program is executed by a processor to implement the steps of the white balance control method as described above.
[0010] The application provides a white balance control method, device, equipment and storage medium, the application method extracts an RGB image and a four-polarization channel image from an original scene image collected by a mobile terminal, and rich color and polarization information of the collected image is obtained. Image feature extraction is performed on the RGB image in combination with the four-polarization channel image, image feature parameters are obtained, and multi-dimensional image feature parameters are comprehensively considered, thereby providing accurate data basis for evaluation and screening of an image region. The image feature parameters are screened according to a preset feature constraint, at least one candidate region is identified, gray confidence feature extraction is performed on each candidate region, and a region confidence is calculated, so that the selected region is representative in the current scene, thereby providing a reliable white balance reference in a complex lighting environment. The region confidence of each candidate region is compared with a preset threshold, the most suitable AWB strategy is determined, and automatic white balance adjustment is performed on the candidate region, thereby adapting to white balance adjustment requirements under different lighting conditions, and the accuracy and visual consistency of automatic white balance of the image are significantly improved. BRIEF DESCRIPTION OF DRAWINGS
[0011] In order to more clearly illustrate the technical solutions of the embodiments of the application, the drawings needed in the embodiment description will be briefly introduced. Obviously, the drawings in the following description are some embodiments of the application, and other drawings can be obtained by those skilled in the art without creative labor.
[0012] Figure 1 A flowchart of a first embodiment of a white balance control method provided by the application is shown in the figure. Figure 2 A flowchart of a second embodiment of a white balance control method provided by the application is shown in the figure. Figure 3 A structure diagram of a first embodiment of a white balance control device provided by the application is shown in the figure. Figure 4 A structure diagram of a computer device provided by the embodiment of the application is shown in the figure.
[0013] The purpose, functional characteristics and advantages of the application will be further described with reference to the embodiments and the drawings. DETAILED DESCRIPTION
[0014] The technical solutions in the embodiments of the application will be described clearly and completely with reference to the drawings in the embodiments of the application. Obviously, the described embodiments are some embodiments of the application, but not all the embodiments. Based on the embodiments in the application, all other embodiments obtained by those skilled in the art without creative labor are within the protection scope of the application.
[0015] The flowchart shown in the attached diagram is for illustrative purposes only and does not necessarily include all content and operations / steps, nor does it necessarily have to be performed in the order described. For example, some operations / steps can be broken down, combined, or partially merged, so the actual execution order may change depending on the actual situation.
[0016] The following detailed description of some embodiments of this application is provided in conjunction with the accompanying drawings. Unless otherwise specified, the following embodiments and features can be combined with each other.
[0017] Please refer to Figure 1 , Figure 1 This is a flowchart illustrating a first embodiment of a white balance control method provided in this application.
[0018] like Figure 1 As shown, the white balance control method includes steps S101 to S106.
[0019] S101. Obtain the RGB image and four polarization channel image of the original scene image corresponding to the current scene of the mobile terminal; The mobile terminal can be a device with image acquisition capabilities, such as a mobile phone, camera, AR glasses, or VR glasses. This terminal device can be equipped with a microprocessor for image processing of the acquired images, such as image feature extraction and automatic white balance, to facilitate the implementation of the white balance control method provided in this application on the mobile terminal. The terminal device can also have communication capabilities, enabling it to communicate with a cloud server to transmit the acquired images to the cloud server for execution of the white balance control method provided in this application, and to receive the images processed by the white balance control method.
[0020] In one embodiment, the user initiates the shooting mode via a mobile terminal, enters the camera preview state, and captures an image of the current scene in the user's current environment. Specifically, the mobile terminal captures the original scene image of the current scene through the image sensor in the camera. The image sensor is an RGB (three primary colors) sensor with polarization sensing capability, capable of capturing an original scene image composed of synchronized RGB images and four polarization channel images. This facilitates the extraction of RGB information corresponding to the RGB images and the extraction of four polarization channel information corresponding to the four polarization channel images from the original scene image.
[0021] For example, a digital image sensor that acquires images in RGB format can be used. This digital image sensor can capture red, green, and blue light and convert them into digital signals. A pixel-level polarizing filter array or a rotatable mechanical polarizer can be equipped in this digital image sensor to allow the image sensor to capture the polarization state of light in the current scene. A single shot can simultaneously acquire images in four polarization directions: 0°, 45°, 90°, and 135°, giving the original scene image four polarization channels. These four polarization channels need to be acquired synchronously at the hardware level to avoid timing differences between channels caused by moving scenes.
[0022] After acquiring the original scene images, image preprocessing, such as noise reduction and sharpening, can be performed to improve the accuracy of subsequent processing.
[0023] RGB image information extraction is based on the RGB color model, an additive color model that generates various colors by combining different intensities of red, green, and blue. Polarization image information extraction, on the other hand, is based on polarization imaging technology, which obtains the polarization information of a scene by measuring the polarization state of light waves.
[0024] In one embodiment, the original scene image (usually in RAW image format) is first subjected to black level correction and linearization to eliminate dark current noise and restore the linear response of light intensity. Then, the channel demultiplexing stage begins: according to the pixel mapping table calibrated by the sensor, the 4×4 superpixels are rearranged into five independent images.
[0025] Specifically, the pixel values corresponding to the R, G, and B filters in each 2×2 unit are selected, and a full-resolution three-channel RGB image is reconstructed using a bilinear or edge-direction-based adaptive interpolation algorithm.
[0026] For each 2×2 Bayer unit, the four sub-pixels are split according to their polarization direction labels. Four low-resolution grayscale images. Since the four polarization images essentially sample different optical information from the same spatial location, their spatial accuracy needs to be improved through super-resolution reconstruction: using the high-frequency texture of the RGB images as a guide, a joint bilateral filtering or deep learning method is used to upsample the four polarization images to the same resolution as the RGB images, while maintaining edge alignment and polarization degree calculation accuracy.
[0027] Finally, the output is a synchronized calibrated RGB image. ) and four-polarization channel image ( All images share a unified timestamp and optical center.
[0028] This embodiment utilizes an RGB sensor with polarization sensing capability to simultaneously acquire RGB images and four polarization channels of a scene, enabling the acquisition of rich color and polarization information in a single shot, laying the foundation for accurate image feature extraction and white balance control.
[0029] A grayscale image is constructed based on the RGB image. The grayscale image is obtained by adding the red, green, and blue channel information of the RGB image according to certain weights, converting it into a single brightness channel. Converting a color image to a grayscale image simplifies the image data, reduces computational complexity, and preserves important brightness information, allowing image processing algorithms to simplify calculations and focus on brightness information.
[0030] Generally, grayscale images can be generated based on the differences in human eye sensitivity to different colors. The calculation formula is as follows:
[0031] Where Y is the grayscale value, and R, G, and B are the values for the red, green, and blue channels, respectively. This formula reflects that the human eye is most sensitive to green, followed by red, and least sensitive to blue.
[0032] For each pixel in the original RGB image, calculate its corresponding grayscale value using the conversion formula described above. Since the pixel value range of the original RGB image is typically 0-255, the converted grayscale value also needs to remain within this range.
[0033] During the calculation process, grayscale values may exceed the range of 0 to 255. If the converted grayscale values exceed this range, the calculation results need to be clipped or normalized to ensure that all grayscale values are within the valid range. Specifically, values exceeding 255 need to be truncated to 255; values less than 0 need to be set to 0.
[0034] This embodiment converts RGB color images into grayscale images and utilizes the differences in human eye sensitivity to different colors to calculate the grayscale value of each pixel. This simplifies the image data while preserving key brightness information, reduces the computational complexity of image processing, and helps improve processing efficiency and accuracy.
[0035] S102. Based on the four polarization channel image, perform image feature extraction on the RGB image to obtain the image feature parameters corresponding to the RGB image; In one embodiment, a four-polarization channel image refers to a light intensity image captured simultaneously by a polarization sensor at four polarization angles of 0°, 45°, 90°, and 135°. It reflects the vibration components of the light wave in different directions and is the raw data for calculating polarization characteristics.
[0036] A grayscale image is a single-channel brightness image converted from an RGB color image by weighting it according to human eye sensitivity. It is used to simplify calculations and focus on illumination information.
[0037] Image feature parameters are a set of quantitative indicators describing image attributes. They are relevant parameters extracted from grayscale images and four-polarization channel images. Therefore, image feature parameters can include grayscale feature parameters and polarization feature parameters. Specifically, grayscale feature parameters can include the global grayscale mean of the grayscale image. Standard deviation Local gray-level variance in different regions of a grayscale image The polarization characteristic parameters may include Stokes parameters, as well as parameters such as polarization angle and degree of polarization calculated from the Stokes parameters.
[0038] In one embodiment, the global grayscale mean and standard deviation of the grayscale image are calculated; the grayscale image is divided into blocks, and the grayscale variance of each block is calculated; based on the four polarization channel image, the degree of polarization of each block is calculated.
[0039] First, perform a comprehensive statistical analysis on the grayscale image to calculate its global grayscale mean. with standard deviation Among them, the global grayscale mean Reflects the overall brightness level of the current scene, standard deviation This is used to characterize the degree of dispersion of the brightness distribution.
[0040] Among them, the global grayscale mean and standard deviation The calculation formula can be expressed as:
[0041]
[0042] in, For image resolution, The first grayscale image Line 1 The pixel grayscale value of the column.
[0043] Subsequently, the grayscale image can be divided into several non-overlapping blocks of regular shape and size (e.g., 32×32 pixels), and the grayscale variance can be calculated independently for each block. The grayscale variance represents the degree to which pixel values within a block deviate from their local mean, quantifying the fluctuation level of pixels within each block. Specifically, the grayscale variance... The smaller the value, the smoother the texture, which is a key indicator for identifying areas with uniform color.
[0044] In one embodiment, the grayscale image can also be divided using an overlapping block method. Specifically, a sliding window with a step size of 16 pixels (50% overlap) can be used, increasing the number of blocks by 4 times, but resulting in better continuity of the captured area, making it suitable for scenarios with high positioning accuracy requirements.
[0045] When dividing a grayscale image into blocks, if the width and height of the grayscale image are not multiples of 32, the remaining pixels on the right / bottom can be discarded for boundary areas that are less than 32×32 to ensure that all blocks are of uniform size; alternatively, zeros can be padded to the right / bottom boundary or mirrored to a multiple of 32 to retain complete information, but the padded areas must be marked as not participating in subsequent statistics.
[0046] After dividing the grayscale image into several 32×32 pixel blocks, the grayscale variance of each block is calculated. :
[0047] in, This represents the local grayscale average of the current block. The first grayscale image Line 1 The pixel grayscale value of the column. This represents the grayscale variance of the current block.
[0048] In one embodiment, based on four polarization channel image data ( For each block, the Stokes parameters used to characterize the polarization state of the light wave are calculated: total light intensity I, linear polarization component Q, and orthogonal component U.
[0049] Specifically, the total light intensity I represents the average intensity in the 0° and 90° polarization directions, which is equivalent to the sum of the unpolarized light intensity and the polarized light intensity, i.e. Linear polarization components This represents the difference between the horizontal and vertical polarization components, i.e. ,in, This indicates that horizontal polarization is dominant. Indicates vertical polarization dominance; orthogonal components This indicates the difference between the 45° and 135° polarization components, i.e. Orthogonal components It is orthogonal to the linearly polarized component Q, and together they describe the complete directional information of linear polarization.
[0050] The polarization angle of each block is calculated based on the Stokes parameters (total light intensity I, linear polarization component Q, and orthogonal component U). and polarization degree Polarization angle It refers to the angle between the polarization direction of the light wave and the reference axis (0°), used to distinguish specular reflection (…). Consistent) and diffuse reflection ( (random); degree of polarization This indicates the proportion of polarized light intensity to the total light intensity. A lower value indicates a higher level of diffuse reflection.
[0051] polarization angle and polarization degree The calculation formula can be expressed as:
[0052] in, For degree of polarization, I is the polarization angle, Q is the total light intensity, and U is the linear polarization component. To prevent The smallest constant for division by zero is usually taken as Or it can be fixed at 1.0 (when I is a normalized value). If Too large an area will underestimate the low-light region. ;like If the value is too small, the numerical stability is poor.
[0053] This embodiment combines four polarization channel images and grayscale images to perform in-depth feature extraction, which can obtain quantitative indicators describing the brightness and polarization characteristics of the image. It can accurately calculate the grayscale feature parameters and polarization feature parameters of the image, thereby revealing the lighting conditions and surface characteristics of different regions in the image, and making more adaptive white balance adjustments.
[0054] S103. Based on preset feature constraints, filter the image feature parameters corresponding to the RGB image to obtain at least one candidate region; In one embodiment, based on preset multi-dimensional feature constraints, the image feature parameters of the grayscale image obtained by the feature extraction node are screened and jointly determined to select candidate regions that meet the white balance control requirements from the full pixel of the grayscale image.
[0055] Feature constraints can include brightness constraints, texture smoothness constraints, polarization constraints, and geometric constraints.
[0056] Furthermore, such as Figure 2 As shown, step S104 specifically includes steps S1041 to S1044.
[0057] S1041. Calculate the grayscale value of each pixel in the grayscale image, filter out the pixel area with grayscale value greater than the brightness threshold, and obtain the bright area, wherein the brightness threshold is equal to the sum of the global grayscale mean and the standard deviation; In one embodiment, the brightness constraint involves pixel-level brightness filtering of the grayscale image to initially identify bright areas. These bright areas typically correspond to light sources or highly reflective surfaces in the image, and their brightness is often higher than the scene's average. The brightness is then determined based on the global grayscale mean. and standard deviation A dynamic threshold can be determined. This dynamic threshold can adapt to different lighting conditions, thereby more accurately identifying bright areas.
[0058] Specifically, the filtering criteria (brightness constraint) for the highlighted area are: The global grayscale average and standard deviation The sum of these values serves as the filtering threshold for brightness constraints, filtering out grayscale values in the grayscale image. Pixels larger than the filtering threshold constitute the highlighted area.
[0059] Generally, the screening threshold for this brightness constraint ( It has scene adaptability, and can operate in dark scenes (i.e., global grayscale average). When the standard deviation is low, the screening threshold is lowered to avoid missing potential reference regions; in bright scenes (i.e., standard deviation)... When the humidity is relatively high, the screening threshold is amplified to prevent over-screening.
[0060] S1042. Select blocks from the grayscale image whose grayscale variance is less than the grayscale variance threshold to obtain low-texture regions; In one embodiment, low-texture regions typically correspond to smooth surfaces in an image, such as white walls or white paper. These regions usually have a relatively uniform color distribution, small grayscale variance, and minimal pixel value variation. By setting a grayscale variance threshold, blocks with grayscale variances less than the threshold can be filtered out, thereby identifying low-texture regions.
[0061] Specifically, texture smoothness constraints can be set to grayscale variance. This means setting the grayscale variance threshold to 0.001. This grayscale variance threshold can be determined experimentally based on image content and application scenarios, and it needs to effectively distinguish between neutral gray surfaces and colored textured surfaces. Generally, neutral gray surfaces, due to their uniform color and lack of patterns, typically have a grayscale variance below 0.001; while colored textured surfaces, due to color variations or pattern interference, generally have a variance above 0.01.
[0062] Iterate through all blocks and compare the grayscale variance of each block. Based on a preset grayscale variance threshold, blocks with grayscale variance less than the preset grayscale variance threshold are selected and marked as low-texture regions.
[0063] In one embodiment, within the blocks that pass the initial variance screening, a secondary statistic of the Sobel gradient magnitude is further calculated. If the gradient direction histogram entropy value is >4.0, it indicates that the gradient direction is chaotic, usually corresponding to real textures such as leaves, grass, and rough walls. The RGB / polarization values are unreliable and should not be used as white balance references. Even if the variance is low, these areas should be removed. Similarly, man-made objects with periodic, unidirectional textures, such as blinds, striped shirts, brushed metal, and printed barcodes, have gradient direction histogram entropy values much less than 4.0, or even less than 0.1, and the variance may be low. However, the color / polarization response of these striped areas is affected by surface pigments or brushed metal and cannot represent the real light source of the scene. Therefore, these areas also need to be removed.
[0064] S1043. Select blocks with polarization degree less than the polarization degree threshold from the grayscale image to obtain the diffuse reflection region; In diffuse reflection regions, light undergoes multiple scatterings on the surface, causing the polarization directions of polarized light to tend towards a random distribution. This can be addressed by calculating the degree of polarization. A polarization degree threshold is set to filter out blocks with polarization degrees less than the threshold, thereby identifying diffuse reflection regions. Diffuse reflection regions typically have low polarization degrees, indicating that the polarization characteristics of light are weakened after multiple scatterings, and the polarization characteristics are relatively stable, making them suitable as white balance reference regions.
[0065] Generally, the degree of polarization ( () is an index that measures the degree of polarization of light waves, with a value range of [0, 1]. Its physical meaning is the proportion of polarized light to the total light intensity. For diffuse reflection regions, Typically, the effect is low. For example, when light shines on a rough surface (such as paper, frosted plastic, or a lime wall), multiple random scatterings occur, and vectors with different polarization directions cancel each other out, resulting in a depolarization effect. Typically below 0.05, ideally close to 0. When light strikes a smooth surface (such as glass, metal, or water), Fresnel reflection occurs, and the reflected light retains strong polarization characteristics. It can reach 0.3-0.8, and the polarization direction is consistent.
[0066] Specifically, a polarization degree threshold can be set. To distinguish diffuse reflection areas from other types of reflection areas (such as specular reflection), the filtering criteria are: The algorithm iterates through all blocks, comparing the polarization degree of each block with a preset polarization degree threshold. If the polarization degree of a block is less than the threshold, the block is marked as a diffuse reflection region. For example, the polarization degree threshold is typically set to 0.1, meaning that regions where the polarized light percentage is less than 10% are considered diffuse reflection regions. The polarization degree threshold is an empirical value and can be dynamically adjusted according to actual application requirements.
[0067] In one embodiment, after initial screening by polarization degree, the polarization angle can be further increased for the candidate blocks. Consistency verification. Generally, the angle of polarization (Angle of Polarization) This describes the vibration direction of polarized light. For the diffuse reflection region, It is usually quite random. For each block's polarization angle... Calculate the values of each sub-pixel (8×8 sub-grid) within the block. Standard deviation If the standard deviation This indicates that although the block If a block has low polarization but chaotic polarization direction, exhibits mixed reflection (specular + diffuse reflection) or is dominated by noise, it is marked as a suspicious block. In connected component analysis, its connection weight is reduced, or the suspicious block is directly removed and not used in connected component analysis.
[0068] This embodiment comprehensively considers the brightness, texture, and polarization characteristics of an image to accurately identify light sources or highly reflective surfaces in the image, as well as areas with uniform color and stable physical properties, and selects the most suitable candidate areas as white balance references.
[0069] S1044. Perform connected component analysis on the highlighted area, the low-texture area and the diffuse area to filter out at least one of the candidate areas.
[0070] In one embodiment, connected component analysis is an image segmentation technique used to identify spatially contiguous regions in an image, which can merge adjacent pixels or blocks into a larger region to form candidate regions.
[0071] Specifically, by using multi-mask fusion, morphological analysis, and geometric constraints, connected component analysis can be performed on the selected highlight areas, low-texture areas, and diffuse areas. The selected pixels can be integrated into connected components, and their geometric characteristics can be analyzed to preserve areas with regular shapes. This integrates the discrete pixel-level screening results into a set of candidate regions with physical meaning and spatial continuity.
[0072] For example, pixels that satisfy the aforementioned three types of feature constraints (i.e., the selected highlight areas, low-texture areas, and diffuse areas) are aggregated into regions through 8-neighborhood connectivity, and then the area of the connected region is calculated. and the width and height of the minimum bounding rectangle of the connected component ( Rectangularity can be defined. Candidate regions are selected based on the rectangularity of each connected component (e.g., constraints). This process retains compact, near-rectangular areas (such as documents and whiteboards) and removes thin, elongated, or fragmented areas, thereby ensuring the regularity of the candidate area's shape and avoiding local polarization calculation errors caused by shape distortion.
[0073] Further, a mask fusion calculation is performed on the bright area, the low-texture area, and the diffuse area to obtain a fused mask; based on the connected component labeling algorithm, the fused mask is pixel-labeled, and spatially adjacent pixels are aggregated to obtain at least one candidate connected component; geometric analysis is performed on each candidate connected component, and candidate connected components whose geometric features satisfy preset geometric feature constraints are selected as the candidate regions.
[0074] In one embodiment, the binary masks of the highlight region, low-texture region, and diffuse region are ANDed together. For each pixel location, its value in the three masks is checked. If the pixel is 1 in all three masks, it is marked as 1 in the fused mask; otherwise, it is marked as 0. This generates a fused mask where each pixel value indicates whether the pixel belongs to all three regions simultaneously.
[0075] Specifically, for the selected highlight areas, low-texture areas, and diffuse areas, three independent binary masks are generated respectively, and the three independent selection results are unified to pixel-level resolution. Specifically, the pixel-level binary mask for the highlight area is denoted as... In the grayscale image, pixels that meet the highlight region selection criteria are marked as 1, and pixels that do not belong to the highlight region are marked as 0; the pixels of the 32×32 block-level low-texture region are mapped to a pixel-level mask. If a certain block is judged as low texture Then all 32×32 pixel positions within this block are marked as 1; similarly, the diffuse reflection area obtained by polarization filtering is... Expanded to pixel-level mask .
[0076] Then, a logical AND operation is performed on the three independent binary masks to obtain the merged mask:
[0077] In this fusion mask In this context, only pixels that simultaneously meet the three conditions of high brightness, low texture, and diffuse reflection will be marked as 1.
[0078] For fusion mask The connected component labeling algorithm is executed, which aggregates spatially adjacent pixels into connected components, representing contiguous regions in the image. For example, an 8-neighbor connectivity approach (considering top, bottom, left, right, and four diagonals) can be used. Pixel-by-pixel traversal occurs, and when an unlabeled pixel with a value of 1 is encountered, a temporary label is assigned. The labeled pixels within its 8-neighborhood are then checked, and equivalent labels are merged using a disjoint-set data structure (Union-Find). Each pixel is then assigned a final region label based on the Union-Find relationship. After labeling all pixels, if two pixels are adjacent horizontally, vertically, or diagonally, they are considered connected, and these connected pixels are aggregated into candidate regions.
[0079] For each labeled connected component (labeled as) Geometric analysis is performed, including area calculation, minimum bounding rectangle analysis, and rectangularity analysis.
[0080] Specifically, for each candidate connected component in the connected component label output... Its area Defined as the total number of pixels within the region:
[0081] in, The connected component label matrix, For indicator functions, Represents candidate connected components The area. To eliminate the scale effect of images with different resolutions, a normalized area is used:
[0082] in, This represents the total number of pixels in the image. Represents candidate connected components The normalized area. Represents candidate connected components The area.
[0083] Set the filter criteria as follows This means that the area of the region must exceed 0.5% of the total image area in order to eliminate excessively small fragmented areas.
[0084] In one embodiment, the minimum axis-aligned rectangle that can completely cover the region is calculated using the rotational caliper method or the minimum bounding box algorithm, and the width is obtained. and height Obtain candidate connected components The minimum area bounding rectangle is determined. Specifically, starting from the top left pixel of the connected component, the boundary is traced along the 8-connectivity direction to generate a Freeman chain code sequence, extracting the boundary pixel set of the connected component. The convex hull of the boundary pixel set is calculated, and the four extreme points (leftmost, rightmost, topmost, and bottommost) of the convex hull are found to construct the initial bounding rectangle, recording its area. The support lines are rotated sequentially according to the convex hull vertex order, ensuring they are always tangent to one edge of the convex hull. Each rotation involves a small angle, updating the positions of the four support lines, and calculating the area of the new rectangle. The rectangle with the minimum area among all rotation angles is recorded; this rectangle is the candidate connected component. The minimum area of the circumscribed rectangle.
[0085] Rectangularity Defined as the ratio of the actual area of the connected region to the area of its circumscribed rectangle:
[0086] in, Represents candidate connected components The area. Represents candidate connected components The area of the minimum area circumscribed rectangle. Represents candidate connected components The rectangularity.
[0087] Rectangularity Rectangularity is used to measure the compactness and regularity of a region's shape. The closer the value is to 1, the more likely it is to be a candidate connected component. The closer it is to a rectangle, the better. You can set the filter criteria as follows: Preserve areas with regular shapes and remove long, thin, and irregular fragments.
[0088] Output a list of candidate regions selected by geometry. For each candidate region Calculate its comprehensive features, including: mask, average gray level. ,area Rectangularity Average polarization degree wait.
[0089] The mask is used to represent the region outline and the position of internal pixels, and the area... Defined as the total number of pixels within the candidate region, and its rectangularity. This is the ratio of the actual area of the candidate region to the area of its circumscribed rectangle. The calculation process for the mask, area, and rectangularity is as described above and will not be repeated here.
[0090] Average gray level Candidate region The average grayscale value of all pixels within a region reflects the overall brightness level of that area, and its calculation formula is expressed as:
[0091] in, Candidate region The total number of pixels (i.e., the area of the region). Candidate region The pixel coordinates of each pixel within the array. Indicates coordinates The pixel grayscale value at that location.
[0092] Candidate region The formula for calculating the average degree of polarization is expressed as:
[0093] in, Indicates candidate region The average polarization degree of all sub-blocks within the region is used to reflect the overall polarization characteristics of that region. Indicates candidate region The number of 32×32 blocks contained within. Indicates candidate region The degree of polarization of the 32×32 blocks contained therein.
[0094] This embodiment utilizes grayscale image and polarization information to perform precise connected component analysis on highlight areas, low-texture areas, and diffuse reflection areas in an image, effectively identifying and filtering candidate regions suitable for automatic white balance (AWB) adjustment. Through multi-mask fusion, morphological analysis, and geometric constraints, adjacent pixels or blocks can be integrated to form a set of candidate regions with physical meaning and spatial continuity. This not only ensures the shape regularity of the candidate regions, avoiding local polarization calculation errors caused by shape distortion, but also adapts to different lighting and material conditions by dynamically adjusting the AWB strategy, thereby outputting the highest quality scene image.
[0095] S104. Determine the region confidence level corresponding to each candidate region, and obtain the comparison result of comparing the region confidence level corresponding to each candidate region with the preset confidence level threshold. For each candidate region selected through geometric constraints, a multidimensional attribute evaluation is performed, and its geometric regularity, texture smoothness, and polarization physical stability are converted into quantifiable confidence scores, thereby systematically determining the reliability of each region as a white balance reference.
[0096] Specifically, for each candidate region, firstly, its geometric feature score is calculated to reflect the regularity of the region's shape; secondly, its texture smoothness score is calculated, which is obtained by analyzing the dispersion of gray values within the region. The smaller the gray value variance, the more uniform the surface, and the higher the score; then, the polarization stability score is evaluated, which is normalized using the average polarization degree within the region. The lower the polarization degree, the purer the diffuse reflection characteristics, the stronger the physical reliability, and the higher the score accordingly. Finally, for each candidate region, the three scores (geometric feature score, texture smoothness score, and polarization stability score) are weighted and fused to obtain the final region confidence score.
[0097] Further, based on the rectangularity of the candidate region, the geometric feature score of the candidate region is calculated; based on the gray-level variance of the candidate region, the texture smoothness score of the candidate region is calculated; based on the average polarization degree of the candidate region, the polarization stability score of the candidate region is calculated; the geometric feature score, the texture smoothness score, and the polarization stability score corresponding to each candidate region are weighted and fused to obtain the region confidence score corresponding to each candidate region.
[0098] In one embodiment, the geometric feature score is used to reflect the regularity of the region's shape. In the geometric feature score evaluation, candidate regions with regular shapes score higher, while candidate regions with irregular shapes score lower. The formula for calculating the geometric feature score can be expressed as:
[0099] in, Indicates the first Geometric feature scores of each candidate region Indicates the first The rectangularity of each candidate region.
[0100] In one embodiment, the texture smoothness score is obtained by analyzing the dispersion of gray values within a region. A smaller gray-level variance indicates a more uniform surface and a higher score; that is, low-texture areas score higher, and complex-texture areas score lower. The formula for calculating the texture smoothness score can be expressed as:
[0101] in, Indicates the first Texture smoothness score of each candidate region This represents the maximum value of the global grayscale variance. Indicates the first The average gray variance of each candidate region.
[0102] In one embodiment, the polarization stability score is obtained by normalizing the average polarization degree within the region. A lower polarization degree indicates purer diffuse reflection characteristics; therefore, diffuse reflection regions score higher, while specular reflection regions score lower. The formula for calculating the polarization stability score can be expressed as:
[0103] in, Indicates the first Polarization stability score of each candidate region Indicates the maximum degree of polarization. Indicates the first The average polarization degree of each candidate region.
[0104] For each candidate region, the geometric feature score, texture smoothness score, and polarization stability score are weighted and fused to obtain the region confidence score.
[0105] in, Indicates the first The regional confidence level corresponding to each candidate region. Indicates the first Geometric feature scores of each candidate region Indicates the first Texture smoothness score of each candidate region Indicates the first The polarization stability score of each candidate region. , , These represent the weights corresponding to the geometric feature score, texture smoothness score, and polarization stability score, respectively. They can be adjusted according to the actual application scenario to achieve the best candidate region selection effect.
[0106] This embodiment comprehensively evaluates the geometric regularity, texture smoothness, and polarization physical stability of candidate regions, transforming these multidimensional attributes into quantifiable confidence scores. This allows for the identification of the reliability of each region as a white balance reference, thereby improving the accuracy and robustness of the automatic white balance (AWB) algorithm.
[0107] In one embodiment, the confidence level of candidate regions is evaluated and judged by multi-level confidence thresholds, and then different white balance control strategies are adopted for candidate regions with different confidence levels. This enables the use of the optimal automatic white balance adjustment method under different lighting and material conditions, and outputs scene images with the best quality.
[0108] In one embodiment, multiple thresholds can be set to divide candidate regions into multiple levels. After calculating the regional confidence level of each candidate region, the regional confidence level of each candidate region is compared with a preset confidence threshold to determine the confidence level of each candidate region, and then an automatic white balance strategy of the corresponding level is adopted.
[0109] S105. Determine the white balance (AWB) strategy corresponding to each candidate region based on the comparison results, and adjust the white balance of each candidate region according to the AWB strategy.
[0110] In one embodiment, a first confidence threshold (i.e., a high confidence threshold), such as 0.7, is set; then a second confidence threshold (i.e., a low confidence threshold), such as 0.4, is set. It is understood that the preset confidence threshold is not a fixed constant, but rather can be dynamically generated adaptively according to the actual application scenario requirements.
[0111] The confidence level of each candidate region is compared with a preset confidence threshold. Based on the comparison results, the candidate regions are divided into different confidence levels, and then different automatic white balance (AWB) strategies are executed for each candidate region.
[0112] Furthermore, when the comparison result shows that the confidence level of the region is greater than the first confidence threshold, the AWB strategy corresponding to the candidate region is determined to be a full polarization AWB strategy; when the comparison result shows that the confidence level of the region is less than or equal to the second confidence threshold, the AWB strategy corresponding to the candidate region is determined to be a traditional RGB AWB strategy; when the comparison result shows that the confidence level of the region is less than or equal to the first confidence threshold and greater than the second confidence threshold, the AWB strategy corresponding to the candidate region is determined to be a hybrid AWB strategy.
[0113] In one embodiment, for candidate regions whose region confidence is greater than a first confidence threshold, i.e. The candidate region is selected, and the full polarization AWB strategy is used to control the white balance of the candidate region. This full polarization AWB strategy can also be called the full polarization AWB strategy, which means that the polarization-assisted gain calculation is used entirely.
[0114] Specifically, the average RGB of the candidate regions is calculated:
[0115] Calculate the gain value of each channel ( ):
[0116] Normalized gain value:
[0117] in, The average RGB value of the candidate region. These are the average values for the red, green, and blue channels, respectively. , , These are the gain values for the red, green, and blue channels, respectively. , , These are the normalized gain values for the red, green, and blue channels, respectively.
[0118] After calculating the gain value, the normalized gain value is applied to the corresponding channel of the original image. For each pixel in the image, its new red, green, and blue values can be calculated as follows:
[0119] in, , , These are the original pixel values. , , These are the adjusted pixel values. The calculated gain value is applied to the response channels of the original image to achieve precise automatic white balance adjustment, thereby improving the visual quality and color accuracy of the image.
[0120] In one embodiment, a conventional RGB AWB strategy is employed when the region confidence level is less than or equal to a second confidence threshold (e.g., 0.4). The conventional RGB AWB strategy can be any strategy that employs conventional RGB AWB principles. Generally, conventional RGB AWB strategies are typically used in scenarios with low confidence levels, such as in low-light, high-reflectivity, or complex texture environments.
[0121] Specifically, traditional RGB AWB strategies are applied, such as reducing the gain value, adding smoothing processing, or using a preset default color temperature value. Specifically, reducing the gain value reduces potential color deviations caused by unreliable regions; adding smoothing steps in image processing, such as Gaussian blur or bilateral filtering filters, reduces the impact of noise and texture, thereby improving the overall visual quality of the image; in some cases, a preset default color temperature value may be applied to ensure color consistency under extreme conditions.
[0122] When applying the traditional RGB AWB strategy, the average RGB value of the candidate region is first calculated. Based on this average RGB value, the gain value for each channel is calculated. The calculated gain values are then normalized to ensure that the sum of the calculated gain values is 1, thus maintaining consistent image brightness. Next, the calculated gain values are applied to the corresponding channels of the original image, adjusting the color value of each pixel. After applying the gain, color correction is performed to ensure the naturalness and consistency of the image colors.
[0123] For example, suppose a scene was captured in a low-light environment, and the confidence score of the candidate region is 0.35, which is lower than the second confidence threshold of 0.4. In this case, a traditional RGB AWB strategy is used to calculate the gain value. After calculating the gain value, it is appropriately reduced, for example, by 10%. Image smoothing is then added, using a bilateral filter to reduce the impact of noise and texture. After applying gain and smoothing, color correction is performed to ensure the naturalness of the image colors.
[0124] By using the traditional RGB AWB strategy, even in areas with low confidence, a relatively reliable white balance adjustment can be obtained, thereby outputting high-quality scene images. Especially when dealing with complex lighting conditions and material surfaces, it can ensure the robustness and adaptability of image processing.
[0125] In one embodiment, a hybrid AWB strategy is employed when the region confidence level is less than a first confidence threshold but greater than a second confidence threshold. The hybrid AWB strategy can be a combination of traditional RGB AWB methods and partial polarization information, using weighted averaging or other fusion techniques to calculate the final gain and perform white balance control on the candidate region.
[0126] When the confidence level of a region falls between the first and second confidence thresholds, it indicates that the region has a certain degree of reliability, but may be affected by environmental factors such as changes in illumination or material properties, making it insufficient to fully rely on polarization information. In this case, a hybrid AWB strategy can be adopted, which effectively combines the traditional RGB AWB method with some polarization information to obtain more stable and accurate white balance results.
[0127] Specifically, the weights of the traditional RGB AWB method and polarization information are dynamically allocated based on the specific value of the region confidence score. For example, if the region confidence score is 0.55 (which is exactly in the middle of the two thresholds), each can be assigned a weight of 50%; if the region confidence score is closer to the second threshold, the weight of the traditional RGB AWB method is increased.
[0128] The traditional RGB AWB gain and polarization-assisted gain are calculated separately, and then weighted and fused according to assigned weights. Specifically, the RGB mean of the candidate region is calculated, and the traditional RGB AWB gain value for each channel is calculated based on the RGB mean. Relevant features, such as polarization degree and polarization angle, are extracted from the polarized image, and the polarization-assisted gain value is calculated using these features. The traditional RGB AWB gain and polarization-assisted gain are then weighted and averaged according to their calculated weights to obtain the final gain value, which is then normalized. The normalized gain value is applied to the corresponding channel of the original image, adjusting the color value of each pixel. After applying the gain, color correction is performed to ensure the naturalness and consistency of the image colors.
[0129] By employing a hybrid AWB strategy, the robustness and adaptability of the algorithm can be improved while maintaining white balance accuracy, especially under complex lighting conditions. This method combines the stability of traditional methods with the physical accuracy of polarization information, providing a white balance control approach that performs well in various scenarios.
[0130] Generally, in certain application scenarios, factors such as ambient illumination and material properties can lead to low brightness or polarization signal-to-noise ratio in the acquired image, affecting the accuracy of white balance. For example, under low-light conditions, the readout noise of the image sensor increases significantly, with noise variance reaching 30%-50% of the signal itself, resulting in lower polarization accuracy. The calculations can fluctuate drastically, affecting the accuracy of the relevant values; for surfaces with complex reflective properties, such as metals or glass, the polarization information can also become unreliable.
[0131] Brightness and polarization signal-to-noise ratio (SNR) can be calculated in real time during image capture and compared with preset thresholds. When the average brightness or polarization SNR of the candidate region is less than the preset threshold, strategy rollback can be triggered, and the AWB strategy can be dynamically adjusted according to the brightness and polarization SNR of the candidate region to ensure the best white balance effect under different lighting conditions.
[0132] In one embodiment, when the AWB strategy of the candidate region is the full polarization AWB strategy or the hybrid AWB strategy, the average brightness and polarization signal-to-noise ratio of the candidate region are calculated; when the average brightness is less than a preset brightness threshold or the polarization signal-to-noise ratio is less than a preset signal-to-noise ratio threshold, the AWB strategy of the candidate region is switched to the traditional RGB AWB strategy.
[0133] For each candidate region employing either a full-polarization AWB strategy or a hybrid AWB strategy, its average brightness is calculated using the gray-scale mean formula. :
[0134] in, This represents the average brightness of the candidate region. , , Is it a candidate region or region of interest? The three-channel pixel values, This represents the total number of pixels in the candidate region. This refers to the pixel coordinates of the candidate region.
[0135] Calculate the polarization signal-to-noise ratio for each candidate region. It is usually defined as:
[0136] in, It is the average polarization degree of the candidate region. It is the standard deviation of the degree of polarization.
[0137] In one embodiment, a brightness threshold can be set according to experimental or practical application requirements. and polarization signal-to-noise ratio threshold If the average brightness of the candidate region is less than the brightness threshold. Or polarization signal-to-noise ratio Less than the polarization signal-to-noise ratio threshold If the white balance information of the candidate region is deemed unreliable, a policy rollback is triggered, switching the current AWB policy to the traditional RGB AWB mode (i.e., the traditional RGB AWB policy) to avoid global white balance errors caused by local polarization failure. The traditional RGB AWB policy is a more conservative approach, relying on traditional RGB information or preset white balance parameters. The gain value is recalculated based on the traditional RGB AWB policy and applied to the image processing workflow for white balance control of the acquired image.
[0138] By dynamically switching the AWB strategy, a more globally reasonable white balance result can be provided when reliable polarization information is lacking, which enhances the robustness of the algorithm in complex environments and avoids the risk of white balance failure caused by the failure of local information.
[0139] This embodiment provides a white balance control method. This method extracts RGB and four-polarization channel images from original scene images captured by a mobile terminal to obtain rich color and polarization information from the captured images. A grayscale image is constructed based on the RGB image, simplifying the data while retaining key brightness information. Feature extraction is performed on the grayscale image using the four-polarization channel image to obtain image feature parameters. This comprehensive multi-dimensional image feature parameter analysis provides an accurate data foundation for evaluating and selecting image regions. The image feature parameters are filtered according to preset feature constraints to identify at least one candidate region. Grayscale confidence features are extracted for each candidate region, and the region confidence is calculated to ensure that the selected region is representative of the current scene, thus providing a reliable white balance reference in complex lighting environments. The region confidence of each candidate region is compared with a preset threshold to determine the most suitable AWB strategy. Automatic white balance adjustment is then performed on the candidate regions to adapt to white balance adjustment needs under different conditions, significantly improving the accuracy and visual consistency of automatic white balance in images.
[0140] Please see Figure 3 , Figure 3 This is a schematic diagram of the structure of a first embodiment of a white balance control device provided in this application. The white balance control device is used to perform the aforementioned white balance control method.
[0141] like Figure 3 As shown, the white balance control device 200 includes: an image information extraction module 201, an image feature extraction module 202, a candidate region screening module 203, a region confidence comparison module 204, and a white balance strategy determination module 205.
[0142] The image information extraction module 201 is used to obtain the RGB image and the four polarization channel image of the original scene image corresponding to the current scene of the mobile terminal; The image feature extraction module 202 is used to extract image features from the RGB image based on the four polarization channel image to obtain the image feature parameters corresponding to the RGB image; The candidate region filtering module 203 is used to filter the image feature parameters corresponding to the RGB image based on preset feature constraints to obtain at least one candidate region. The region confidence comparison module 204 is used to determine the region confidence corresponding to each candidate region and obtain the comparison result of comparing the region confidence corresponding to each candidate region with a preset confidence threshold. The white balance strategy determination module 205 is used to determine the white balance AWB strategy corresponding to each candidate region based on the comparison results, so as to adjust the white balance of each candidate region according to the AWB strategy.
[0143] In one embodiment, the image feature parameters include grayscale feature parameters and polarization feature parameters; The image feature extraction module 202 includes: An image segmentation unit is used to convert the RGB image into a grayscale image and divide the grayscale image into at least one segment; The grayscale feature parameter extraction unit is used to calculate the global grayscale mean, standard deviation, and grayscale variance of each block of the grayscale image based on the grayscale value of each pixel in the grayscale image, and obtain the grayscale feature parameters. The polarization feature parameter extraction unit is used to calculate the degree of polarization and polarization angle of each block based on the four polarization channel image, and obtain the polarization feature parameters.
[0144] In one embodiment, the candidate region filtering module 203 includes: A highlight region filtering unit is used to count the gray values of each pixel in the grayscale image, filter out pixel regions with gray values greater than a brightness threshold, and obtain highlight regions, wherein the brightness threshold is equal to the sum of the global grayscale mean and the standard deviation; The low-texture region filtering unit is used to filter out blocks with grayscale variance less than the grayscale variance threshold from the grayscale image to obtain low-texture regions. A diffuse reflection region filtering unit is used to filter out blocks with a polarization degree less than a polarization degree threshold from the grayscale image to obtain diffuse reflection regions. The candidate region filtering unit is used to perform connected component analysis on the highlighted region, the low-texture region and the diffuse region to filter out at least one of the candidate regions.
[0145] In one embodiment, the candidate region filtering unit includes: A fusion mask calculation subunit is used to perform mask fusion calculation on the bright area, the low texture area and the diffuse area to obtain a fusion mask; The candidate connected component determination subunit is used to mark pixels in the fusion mask based on the connected component marking algorithm, and to aggregate pixels that correspond to the same pixel mark and are spatially adjacent into connected components to obtain at least one candidate connected component. The candidate region filtering subunit is used to perform geometric analysis on each candidate connected region and filter out the candidate connected regions whose geometric features satisfy the preset geometric feature constraints as the candidate regions.
[0146] In one embodiment, the regional confidence comparison module 204 includes: A geometric feature calculation subunit is used to calculate the geometric feature score of the candidate region based on the rectangularity of the candidate region; The texture smoothness score calculation subunit is used to calculate the texture smoothness score of the candidate region based on the gray-level variance of the candidate region. A polarization stability score calculation subunit is used to calculate the polarization stability score of the candidate region based on the average polarization degree of the candidate region. The region confidence calculation subunit is used to perform weighted fusion calculation on the geometric feature score, texture smoothness score and polarization stability score corresponding to each candidate region to obtain the region confidence score corresponding to each candidate region.
[0147] In one embodiment, the white balance strategy determination module 205 includes: The first unit for determining the full polarization AWB strategy is used to determine the AWB strategy corresponding to the candidate region as the full polarization AWB strategy when the comparison result shows that the confidence of the region is greater than the first confidence threshold. The traditional RGB AWB strategy determines the second unit, which is used to determine the AWB strategy corresponding to the candidate region as the traditional RGB AWB strategy when the comparison result is that the confidence of the region is less than or equal to the second confidence threshold. The hybrid AWB strategy determines a third unit, which is used to determine the AWB strategy corresponding to the candidate region as a hybrid AWB strategy when the comparison result is that the confidence level of the region is less than or equal to the first confidence level threshold and greater than the second confidence level threshold.
[0148] In one embodiment, the white balance control device 200 further includes a strategy rollback module, comprising: A polarization signal-to-noise ratio calculation unit is used to calculate the average brightness and polarization signal-to-noise ratio of the candidate region when the AWB strategy of the candidate region is the full polarization AWB strategy or the hybrid AWB strategy. The strategy fallback unit is used to switch the AWB strategy of the candidate region to the traditional RGB AWB strategy when the average brightness is less than a preset brightness threshold or the polarization signal-to-noise ratio is less than a preset signal-to-noise ratio threshold.
[0149] It should be noted that those skilled in the art will understand that, for the sake of convenience and brevity, the specific working processes of the device and each module described above can be referred to the corresponding processes in the aforementioned white balance control method embodiments, and will not be repeated here.
[0150] The apparatus provided in the above embodiments can be implemented as a computer program, which can be used in, for example... Figure 4 It runs on the computer device shown.
[0151] Please see Figure 4 ,Figure 4 This is a schematic block diagram illustrating the structure of a computer device according to an embodiment of this application. The computer device can be a server. It can be integrated into a terminal device or communicate with the terminal device via methods such as WiFi, Bluetooth, or USB connection.
[0152] See Figure 4 The computer device includes a processor, memory, and network interface connected via a system bus, wherein the memory may include non-volatile storage media and internal memory.
[0153] Non-volatile storage media can store operating systems and computer programs. These computer programs include program instructions that, when executed, cause the processor to perform any white balance control method.
[0154] The processor provides computing and control capabilities, supporting the operation of the entire computer device.
[0155] Internal memory provides an environment for the execution of computer programs stored in non-volatile storage media. When these computer programs are executed by the processor, the processor can perform any white balance control method.
[0156] This network interface is used for network communication, such as sending assigned tasks. Those skilled in the art will understand that... Figure 4 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0157] It should be understood that the processor can be a Central Processing Unit (CPU), but it can also be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Among these, a general-purpose processor can be a microprocessor or any conventional processor.
[0158] In one embodiment, the processor is configured to run a computer program stored in memory to perform the following steps: Obtain the RGB image and four polarization channel image of the original scene image corresponding to the current scene of the mobile terminal; Based on the four polarization channel image, image feature extraction is performed on the RGB image to obtain the image feature parameters corresponding to the RGB image; Based on preset feature constraints, the image feature parameters corresponding to the RGB image are filtered to obtain at least one candidate region; Determine the region confidence level corresponding to each candidate region, and obtain the comparison result of comparing the region confidence level corresponding to each candidate region with a preset confidence level threshold; Based on the comparison results, a white balance (AWB) strategy corresponding to each candidate region is determined, and the white balance of each candidate region is adjusted according to the AWB strategy.
[0159] The embodiments of this application also provide a computer-readable storage medium storing a computer program, the computer program including program instructions, and the processor executing the program instructions to implement any of the white balance control methods provided in the embodiments of this application.
[0160] The computer-readable storage medium can be an internal storage unit of the computer device described in the foregoing embodiments, such as the hard disk or memory of the computer device. The computer-readable storage medium can also be an external storage device of the computer device, such as a plug-in hard disk, SmartMediaCard (SMC), SecureDigital (SD) card, or FlashCard equipped on the computer device.
[0161] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in this application, and these modifications or substitutions should all be covered within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A white balance control method characterized by comprising: The method comprises: acquiring an RGB image and four-polarization channel images of an original scene image corresponding to a current scene of a mobile terminal; performing image feature extraction on the RGB image based on the four-polarization channel images to obtain image feature parameters corresponding to the RGB image; performing filtering on the image feature parameters corresponding to the RGB image based on preset feature constraints to obtain at least one candidate region; determining a region confidence corresponding to each candidate region, and acquiring a comparison result of comparing the region confidence corresponding to each candidate region with a preset confidence threshold; determining an auto white balance (AWB) strategy corresponding to each candidate region according to the comparison result, and performing AWB adjustment on each candidate region according to the AWB strategy.
2. The white balance control method according to claim 1, characterized by, The image feature parameters comprise a gray feature parameter and a polarization feature parameter; The image feature extraction on the RGB image based on the four-polarization channel images to obtain image feature parameters corresponding to the RGB image comprises: converting the RGB image into a gray image, and dividing the gray image into at least one sub-block; calculating a global gray mean value, a standard deviation of the gray image, and a gray variance of each sub-block based on a gray value of each pixel in the gray image to obtain the gray feature parameter; calculating a degree of polarization and a polarization angle of each sub-block based on the four-polarization channel images to obtain the polarization feature parameter.
3. The white balance control method according to claim 2, characterized by, The filtering on the image feature parameters corresponding to the RGB image based on preset feature constraints to obtain at least one candidate region comprises: counting the gray values of the pixels in the gray image, and filtering out a pixel region with a gray value greater than a brightness threshold to obtain a highlight region, wherein the brightness threshold is equal to a sum of the global gray mean value and the standard deviation; filtering out a sub-block with a gray variance less than a gray variance threshold from the gray image to obtain a low-texture region; filtering out a sub-block with a degree of polarization less than a degree of polarization threshold from the gray image to obtain a diffuse reflection region; performing connected component analysis on the highlight region, the low-texture region, and the diffuse reflection region to filter out at least one candidate region.
4. The white balance control method according to claim 3, characterized by, The connected component analysis on the highlight region, the low-texture region, and the diffuse reflection region to filter out at least one candidate region comprises: performing mask fusion calculation on the highlight region, the low-texture region, and the diffuse reflection region to obtain a fusion mask; performing pixel labeling on the fusion mask based on a connected component labeling algorithm, and aggregating pixels corresponding to the same pixel label and spatially adjacent into a connected component to obtain at least one candidate connected component; performing geometric analysis on each candidate connected component to filter out a candidate connected component with a geometric feature satisfying a preset geometric feature constraint as the candidate region.
5. The white balance control method according to claim 1, characterized by, The determination of the region confidence corresponding to each candidate region comprises: calculating a geometric feature score of the candidate region based on a rectangularity of the candidate region; calculating a texture smoothness score of the candidate region based on a gray variance of the candidate region; and calculating a region confidence score of the candidate region based on the geometric feature score, the texture smoothness score, and a preset weight. calculate a polarization stability score of the candidate region based on an average degree of polarization of the candidate region; weight and fuse the geometric feature score, the texture smoothness score, and the polarization stability score corresponding to each candidate region to obtain a region confidence corresponding to each candidate region.
6. The white balance control method according to claim 1, characterized by, The white balance AWB strategy corresponding to each candidate region is determined according to a comparison result, and the method comprises the following steps. When the comparison result is that the region confidence is greater than a first confidence threshold, it is determined that the AWB strategy corresponding to the candidate region is a full-polarization AWB strategy. When the comparison result is that the region confidence is less than or equal to a second confidence threshold, it is determined that the AWB strategy corresponding to the candidate region is a traditional RGB AWB strategy. When the comparison result is that the region confidence is less than or equal to the first confidence threshold and greater than the second confidence threshold, it is determined that the AWB strategy corresponding to the candidate region is a hybrid AWB strategy.
7. The white balance control method according to claim 6, characterized by, The method further comprises the following steps. When the AWB strategy of the candidate region is the full-polarization AWB strategy or the hybrid AWB strategy, an average brightness and a polarization signal-to-noise ratio of the candidate region are calculated. When the average brightness is less than a preset brightness threshold or the polarization signal-to-noise ratio is less than a preset signal-to-noise ratio threshold, the AWB strategy of the candidate region is switched to the traditional RGB AWB strategy.
8. A white balance control device characterized by comprising: The white balance control device comprises: an image information extraction module configured to acquire an RGB image and four-polarization channel images of an original scene image corresponding to a current scene of a mobile terminal; an image feature extraction module configured to perform image feature extraction on the RGB image based on the four-polarization channel images to obtain image feature parameters corresponding to the RGB image; a candidate region screening module configured to screen the image feature parameters corresponding to the RGB image based on a preset feature constraint to obtain at least one candidate region; a region confidence comparison module configured to determine a region confidence corresponding to each candidate region and to acquire a comparison result of comparing the region confidence corresponding to each candidate region with a preset confidence threshold; a white balance strategy determination module configured to determine a white balance AWB strategy corresponding to each candidate region according to the comparison result, so as to perform white balance adjustment on each candidate region according to the AWB strategy.
9. A computer device, comprising: The computer device is in communication connection with the mobile terminal, and comprises a processor, a memory, and a computer program stored on the memory and executable by the processor, wherein the computer program is executed by the processor to implement the steps of the white balance control method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, The computer readable storage medium stores a computer program, wherein the computer program is executed by the processor to implement the steps of the white balance control method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Information processing device, information processing method, and program
CN117044220A
Signal processing device and method, and program
US20240205551A1
Image processing device, image processing method, and program
US20250016460A1
Cited By
A pipe defect detection method and system
CN122244001A