Image-based data processing method, apparatus, device, and medium

By extracting the gain of a specified color channel and the calibration gain error of the image, and calculating the adjustment value, the accuracy and efficiency problems of image color deviation processing in the prior art are solved, and more efficient and flexible image color balance adjustment is achieved.

CN122160487APending Publication Date: 2026-06-05TENCENT TECHNOLOGY (SHENZHEN) CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
TENCENT TECHNOLOGY (SHENZHEN) CO LTD
Filing Date
2024-12-03
Publication Date
2026-06-05

AI Technical Summary

Technical Problem

In existing technologies, the grayscale world scheme is only suitable for images with small color deviations and has low accuracy, while the white point statistical scheme is complex and the inconsistent selection of white points leads to a decrease in image processing efficiency and accuracy.

Method used

By extracting the gain of a specified color channel, the gain error of the calibrated gain and white balance gain is obtained. Combined with the historical gain error, the gain adjustment value is calculated to adjust the image color channels.

Benefits of technology

It improves the accuracy, efficiency, and flexibility of image color balance adjustment, is applicable to images acquired in any environment, and enhances the reliability of data processing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122160487A_ABST
    Figure CN122160487A_ABST
Patent Text Reader

Abstract

Embodiments of the present application disclose an image-based data processing method, device, equipment and medium. The method comprises: extracting a gain of a specified color channel from an input image; obtaining a calibration gain matched with the gain, the calibration gain being obtained based on a calibration image collected under a calibration color temperature environment; calculating a gain error based on the calibration gain and a white balance gain with the green channel as a reference, and calculating a gain adjustment value based on the gain error and a historical gain error; and adjusting the specified color channel based on the gain adjustment value to obtain a target image. The technical solution of the present application improves the accuracy, efficiency, flexibility and the like of image color balance adjustment, and has high reliability in image-based data processing.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and more specifically, to an image-based data processing method, an image-based data processing apparatus, an electronic device, and a computer-readable medium. Background Technology

[0002] In related technologies, two main schemes are used for color balance adjustment of images: the grayscale world scheme and the white point statistical scheme. The grayscale world scheme mainly assumes that the average reflectance of light by objects in nature is a constant value, which approximates gray. This assumption is forced onto the image to eliminate the influence of ambient light and obtain the original image. The white point statistical scheme mainly assumes that the brightest part of the image is white. By adjusting the intensity of each color channel, the desired white point is achieved.

[0003] However, the grayscale world scheme is only suitable for images with small color deviations, and its accuracy is low for images with large color deviations. The white point statistics scheme relies on the selection of white points, which is complex and reduces the efficiency of image processing. Furthermore, the inconsistency in the selection of white points reduces the accuracy of image processing.

[0004] Therefore, how to better adjust the color balance of images to ensure the reliability of image-based data processing is an urgent problem to be solved. Summary of the Invention

[0005] The embodiments of this application provide an image-based data processing method, apparatus, device, and medium that improves the accuracy, efficiency, and flexibility of image color balance adjustment, and the image-based data processing has high reliability.

[0006] In a first aspect, embodiments of this application provide an image-based data processing method, the method comprising: extracting the gain of a specified color channel from an input image; obtaining a calibration gain matching the gain, the calibration gain being obtained based on a calibration image acquired under a calibration color temperature environment; calculating a gain error based on the calibration gain and a white balance gain based on the green channel, and calculating a gain adjustment value based on the gain error and historical gain errors; and adjusting the specified color channel based on the gain adjustment value to obtain a target image.

[0007] Secondly, embodiments of this application provide an image-based data processing apparatus, comprising: an extraction module configured to extract the gain of a specified color channel from an input image; an acquisition module configured to acquire a calibration gain matching the gain, wherein the calibration gain is obtained based on a calibration image acquired under a calibration color temperature environment; a calculation module configured to calculate a gain error based on the calibration gain and a white balance gain based on the green channel, and to calculate a gain adjustment value for the specified color channel based on the gain error and historical gain errors; and an adjustment module configured to adjust the specified color channel based on the gain adjustment value to obtain a target image.

[0008] In one embodiment of this application, based on the foregoing scheme, the acquisition module is specifically configured to: acquire a calibration table, the calibration table including multiple calibration color temperatures and multiple calibration gains corresponding to each calibration color temperature, the multiple calibration gains being calibration gains corresponding to different color channels; select candidate calibration gains for the specified color channel corresponding to each calibration color temperature from the calibration table to obtain multiple candidate calibration gains; select the candidate calibration gain with the smallest difference from the gain from the multiple candidate calibration gains, and use the selected candidate calibration gain as the calibration gain that matches the gain.

[0009] In one embodiment of this application, based on the foregoing scheme, the acquisition module is further specifically configured to: acquire the color temperature extracted from the input image; generate a color temperature range based on the color temperature, wherein the color temperature is located within the color temperature range; search for multiple candidate calibration color temperatures located within the color temperature range from the calibration table, and select the candidate calibration gain of the specified color channel corresponding to each candidate calibration color temperature to obtain multiple candidate calibration gains.

[0010] In one embodiment of this application, based on the foregoing scheme, the acquisition module is further configured to: perform subtraction operations between the gain and the plurality of candidate calibration gains to obtain a plurality of gain differences; and select the candidate calibration gain corresponding to the smallest gain difference from the plurality of candidate calibration gains.

[0011] In one embodiment of this application, based on the foregoing scheme, the device further includes a generation module configured to: acquire calibration images under different calibration color temperature environments; extract calibration gains corresponding to different color channels from each calibration image to obtain multiple calibration gains for each calibration image, wherein the different color channels include a red channel and a blue channel; and associate the calibration color temperature corresponding to the same calibration image with the multiple calibration gains to generate a calibration table.

[0012] In one embodiment of this application, based on the aforementioned scheme, the calculation module is specifically configured as follows: obtaining a white balance gain based on the green channel, wherein the white balance gain is 1; performing a difference operation on the white balance gain and the calibration gain to obtain a gain error; calculating a gain adjustment auxiliary parameter based on the historical gain error, the generation time of the historical gain error, the gain error, and the generation time of the gain error; and calculating a gain adjustment value based on the gain error and the gain adjustment auxiliary parameter.

[0013] In one embodiment of this application, based on the foregoing scheme, the historical gain error includes multiple errors; the calculation module is further specifically configured to: perform integration based on the multiple historical gain errors, the generation time corresponding to the multiple historical gain errors, the gain error, and the generation time of the gain error to obtain a gain error integral value characterizing the accumulation of gain error, and use the gain error integral value as a gain adjustment auxiliary parameter; and / or, perform differentiation based on the multiple historical gain errors, the generation time corresponding to the multiple historical gain errors, the gain error, and the generation time of the gain error to obtain a gain error differential value characterizing the change of gain error, and use the gain error differential value as a gain adjustment auxiliary parameter.

[0014] In one embodiment of this application, based on the aforementioned scheme, the gain adjustment auxiliary parameter includes the integral value of the gain error and the differential value of the gain error; the calculation module is further specifically configured to: obtain the gain error, the integral value of the gain error, and the gain coefficients corresponding to the differential value of the gain error respectively; and perform a weighted summation operation based on the gain error, the integral value of the gain error, the differential value of the gain error, and the gain coefficients to obtain the gain adjustment value.

[0015] In one embodiment of this application, based on the foregoing scheme, the adjustment module is specifically configured to: perform a difference operation on the white balance gain and the gain adjustment value to obtain a target gain; and adjust the specified color channel based on the target gain to obtain a target image.

[0016] In one embodiment of this application, based on the foregoing scheme, the specified color channel includes a red channel and a blue channel, and the target gain includes a first target gain for the red channel and a second target gain for the blue channel; the adjustment module is further specifically configured to: adjust the channel value corresponding to the red channel of a pixel in the input image based on the first target gain to obtain an adjusted channel value for the red channel; adjust the channel value corresponding to the blue channel of a pixel in the input image based on the second target gain to obtain an adjusted channel value for the blue channel; and generate a target image based on the channel value corresponding to the green channel of a pixel in the input image, the adjusted channel value for the red channel, and the adjusted channel value for the blue channel.

[0017] In one embodiment of this application, based on the foregoing scheme, the extraction module is specifically configured to: perform image segmentation processing on the input image to obtain multiple image blocks, and extract the gain of the specified color channel from each image block; perform an averaging operation on the gains corresponding to the multiple image blocks respectively to obtain an average gain, and use the average gain as the gain of the specified color channel.

[0018] In one embodiment of this application, based on the foregoing scheme, the device further includes a data acquisition module configured to: acquire biometric images, the biometric images including at least one of palm images and face images, and use the biometric images as input images;

[0019] In one embodiment of this application, based on the foregoing scheme, the device further includes an execution module configured to: verify the object corresponding to the input image based on the target image, and execute the task to be processed after the verification is passed.

[0020] Thirdly, embodiments of this application provide an electronic device, including one or more processors; and a memory for storing one or more computer programs, which, when executed by the one or more processors, cause the electronic device to implement the image-based data processing method described above.

[0021] Fourthly, embodiments of this application provide a computer-readable medium having a computer program stored thereon, which, when executed by a processor, implements the image-based data processing method described above.

[0022] Fifthly, embodiments of this application provide a computer program product, including computer instructions, which, when executed by a processor, implement the image-based data processing method described above.

[0023] In the technical solution provided by the embodiments of this application: a relatively accurate calibration gain of a specified color channel in the input image is obtained by pre-calibration, and the gain error between the white balance gain and the calibration gain is obtained based on the white balance gain. Then, a relatively accurate gain error is obtained by using the gain error and the historical gain error. Thus, the adjustment of the specified color channel in the input image is realized by using the relatively accurate gain error.

[0024] Compared with related technical solutions, the technical solution of this application uses the calibration gain obtained under the calibration color temperature environment, as well as the gain error between it and the white balance gain and the historical gain error, to adjust the specified color channel in the input image. This is not affected by the ambient color temperature and is applicable to images acquired in any environment. Specifically, it is not limited to images with small color deviations, and there is no need to select a white point, thereby improving the accuracy, efficiency, and flexibility of image color balance adjustment, and the reliability of image data processing is high.

[0025] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and do not limit this application. Attached Figure Description

[0026] Figure 1 This is a schematic diagram illustrating an exemplary implementation environment in which the technical solutions of the embodiments of this application can be applied.

[0027] Figure 2 This is a flowchart illustrating an image-based data processing method in an exemplary embodiment of this application.

[0028] Figure 3 This is a schematic diagram of a system illustrated in an exemplary embodiment of this application.

[0029] Figure 4 This is a schematic diagram illustrating the calibration in an exemplary embodiment of this application.

[0030] Figure 5 This is a flowchart illustrating an image-based data processing method, which is another exemplary embodiment of this application.

[0031] Figure 6 This is a schematic diagram illustrating an image-based data processing method, which is another exemplary embodiment of this application.

[0032] Figure 7 This is a block diagram illustrating an image-based data processing apparatus as shown in an exemplary embodiment of this application.

[0033] Figure 8 This is a schematic diagram of the structure of a computer system suitable for implementing the electronic devices of the present application embodiments. Detailed Implementation

[0034] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments identical to those described in this application. Rather, they are merely examples of apparatuses and methods identical to some aspects of this application as detailed in the appended claims.

[0035] In this application embodiment, the terms "module" or "unit" refer to a computer program or part of a computer program that has a predetermined function and works with other related parts to achieve a predetermined goal, and can be implemented wholly or partially using software, hardware (such as processing circuitry or memory), or a combination thereof. Similarly, a processor (or multiple processors or memory) can be used to implement one or more modules or units. Furthermore, each module or unit can be part of an overall module or unit that includes the functionality of that module or unit.

[0036] The block diagrams shown in the accompanying drawings are merely functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities can be implemented in software, in one or more hardware modules or integrated circuits, or in different network and / or processor devices and / or microcontroller devices.

[0037] The flowcharts shown in the accompanying drawings are merely illustrative and do not necessarily include all content and operations / steps, nor do they necessarily have to be performed in the described order. For example, some operations / steps can be broken down, while others can be combined or partially combined; therefore, the actual execution order may change depending on the specific circumstances.

[0038] It should be noted that "multiple" as mentioned in this application refers to two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, or B alone. The character " / " generally indicates that the preceding and following related objects have an "or" relationship.

[0039] In related technologies, two main schemes are used for color balance adjustment of images: the grayscale world scheme and the white point statistical scheme. The grayscale world scheme mainly assumes that the average reflectance of light by objects in nature is a constant value, which approximates gray. This assumption is forced onto the image to eliminate the influence of ambient light and obtain the original image. The white point statistical scheme mainly assumes that the brightest part of the image is white. By adjusting the intensity of each color channel, the desired white point is achieved.

[0040] However, the grayscale world scheme is only suitable for images with small color deviations, and its accuracy is low for images with large color deviations. The white point statistics scheme relies on the selection of white points, which is complex and reduces the efficiency of image processing. Furthermore, the inconsistency in the selection of white points reduces the accuracy of image processing.

[0041] Therefore, in order to better adjust the color balance of images and ensure the reliability of image-based data processing, this application provides an image-based data processing scheme. Please refer to... Figure 1 , Figure 1 This is a schematic diagram of an implementation environment related to this application. The implementation environment mainly includes a terminal device 101 and a server 102; wherein:

[0042] Terminal devices 101 include, but are not limited to, extended reality devices (virtual reality devices, augmented reality devices, mixed reality devices, etc.), mobile phones, computers (tablets, laptops, desktop computers, etc.), smart home devices (televisions, refrigerators, air conditioners, washing machines, robot vacuums, etc.), smart wearable devices (bracelets, watches, etc.).

[0043] Server 102 can be a standalone physical server, or a server cluster or distributed system consisting of multiple physical servers. The server cluster or distributed system includes cloud servers used to provide basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDN), and big data and artificial intelligence platforms.

[0044] It is understood that terminal device 101 and server 102 establish a communication connection via a wired or wireless network. Exemplarily, the wireless or wired network uses standard communication technologies and / or protocols. The network is typically the Internet, but can also be any other network, including but not limited to a Local Area Network (LAN), Metropolitan Area Network (MAN), Wide Area Network (WAN), mobile, wired or wireless networks, private networks, or any combination of virtual private networks.

[0045] In one embodiment of this application, the image-based data processing method can be executed by server 102. Specifically, server 102 extracts the gain of a specified color channel from the input image; then obtains a calibration gain that matches the gain, the calibration gain being obtained based on a calibration image acquired under a calibration color temperature environment; then calculates the gain error based on the calibration gain and the white balance gain based on the green channel, and calculates the gain adjustment value based on the gain error and the historical gain error; then adjusts the specified color channel based on the gain adjustment value to obtain the target image.

[0046] In other embodiments of this application, the image-based data processing method can be executed by the terminal device 101 alone, or by the terminal device 101 and the server 102 together. In practical applications, the executing entity of the image-based data processing method can be flexibly adjusted according to the specific application scenario.

[0047] It should be made clear that, Figure 1 The number of terminal devices 101 and servers 102 shown is merely illustrative; any number of terminal devices 101 and servers 102 can be used as needed.

[0048] It should be noted that in the specific implementation of this application, user-related data is involved. When the embodiments of this application are applied to specific products or technologies, user permission or consent is required, and the collection, use and processing of related data must comply with the relevant laws, regulations and standards of the relevant countries and regions.

[0049] The following details the various implementation details of the technical solutions in the embodiments of this application:

[0050] Please see Figure 2 , Figure 2 This is a flowchart illustrating an image-based data processing method according to an embodiment of this application. Figure 2 As shown, this image-based data processing method includes at least S201 to S204, which are described in detail below:

[0051] S201, Extract the gain of the specified color channel from the input image.

[0052] In this embodiment of the application, the input image refers to the image to be adjusted for color balance, which includes, but is not limited to, biometric images, landscape images, object images, etc., wherein biometric images include, but are not limited to, palm images, face images, etc.

[0053] In this embodiment, the specified color channel is at least one of the red channel and the blue channel. Optionally, the specified color channel is the red channel; alternatively, the specified color channel is the blue channel; alternatively, the specified color channel is both the red channel and the blue channel.

[0054] In this embodiment, the gain of a specified color channel refers to a parameter used to amplify or reduce the channel value of a specified color channel to ensure color balance in the image. A gain greater than 1 indicates amplification of the channel value, while a gain less than 1 indicates reduction. It is understood that in white balance, the green channel is typically used as a reference, set to 1. Accordingly, the gain of a specified color channel refers to the ratio of the gain between the specified color channel and the green channel.

[0055] In one embodiment of this application, prior to the process of extracting the gain of a specified color channel from the input image in S201, the following may also be included:

[0056] Acquire biometric images, including at least one of palm images and face images, and use the biometric images as input images.

[0057] That is, in the optional embodiment, considering that biometric images have more details and have higher requirements for image color balance, the optional embodiment acquires biometric images, wherein the biometric images include at least one of palm images and face images, and the acquired palm images and / or face images are used as input images.

[0058] By implementing this optional embodiment, color balance adjustments are made to biometric images, resulting in better image color balance and adaptability to various scenarios.

[0059] In one embodiment of this application, the process of extracting the gain of a specified color channel from the input image in S201 may include:

[0060] The input image is segmented to obtain multiple image blocks, and the gain of a specified color channel is extracted from each image block.

[0061] The average gain of each of the multiple image blocks is calculated to obtain the average gain, which is then used as the gain of the specified color channel.

[0062] That is, in the optional embodiment, an input image is acquired, and then the input image is first processed by image segmentation to obtain multiple image blocks. Then, the gain of a specified color channel is extracted from each image block, and then the average gain of the gains corresponding to the multiple image blocks is calculated to obtain the average gain. At this time, the average gain is the gain of the specified color channel.

[0063] For example, the input image Image is divided into four image blocks: image block I_b1, image block I_b2, image block I_b3, and image block I_b4. The gain G_e1 of a specified color channel is extracted from image block I_b1, the gain G_e2 from image block I_b2, the gain G_e3 from image block I_b3, and the gain G_e4 from image block I_b4. Then, the average gain G_e1, G_e2, G_e3, and G_e4 are averaged to obtain the average gain G_e_a, i.e., G_e_a = (G_e1 + G_e2 + G_e3 + G_e4) / 4. This average gain G_e_a is the gain G_e of the specified color channel.

[0064] By implementing this optional embodiment, after performing image segmentation on the input image, the gain of the specified color channel of each image block is extracted and averaged. This allows for a simple and accurate way to obtain the gain of the specified color channel of the input image, providing strong support for image color balance adjustment.

[0065] In one of the optional embodiments, the process of extracting the gain of a specified color channel from each image block may include: generating an extraction task for each image block to obtain multiple extraction tasks; and executing multiple extraction tasks in parallel to extract the gain of a specified color channel from each image block.

[0066] That is, in an optional embodiment, multiple extraction tasks are executed in parallel to achieve the extraction of the gain of a specified color channel from multiple image blocks in parallel.

[0067] By implementing this optional embodiment, the gains of specified color channels of multiple image patches are extracted in parallel, thereby improving the efficiency of extracting the gains of specified color channels in the input image and thus improving the efficiency of image color balance adjustment.

[0068] S202, Obtain the calibration gain that matches the gain, which is obtained based on the calibration image acquired under the calibration color temperature environment.

[0069] In this embodiment, the gain of a specified color channel is extracted from the input image, and then a calibration gain matching the extracted gain can be obtained, wherein the calibration gain is obtained based on the calibration image acquired under the calibration color temperature environment.

[0070] In one embodiment of this application, the process of obtaining a calibration gain that matches the gain in S202 may include:

[0071] Obtain the calibration table, which includes multiple calibration color temperatures and multiple calibration gains corresponding to each calibration color temperature. The multiple calibration gains are the calibration gains corresponding to different color channels.

[0072] Select candidate calibration gains for the specified color channel corresponding to each calibration color temperature from the calibration table to obtain multiple candidate calibration gains;

[0073] Select the candidate calibration gain that has the smallest difference from the current gain from multiple candidate calibration gains, and use the selected candidate calibration gain as the calibration gain that matches the current gain.

[0074] That is, in an optional embodiment, a calibration table is first obtained, which includes multiple calibration color temperatures and calibration gains for different color channels corresponding to each calibration color temperature. Optionally, each calibration color temperature corresponds to a calibration gain for the red channel and a calibration gain for the blue channel. Then, candidate calibration gains for the specified color channel corresponding to each calibration color temperature are selected from the calibration table to obtain multiple candidate calibration gains. Then, the candidate calibration gain with the smallest difference from the extracted gain is selected from the multiple candidate calibration gains. At this time, the selected candidate calibration gain is the calibration gain that matches the extracted gain.

[0075] For example, please refer to Table 1, which is an example calibration table.

[0076] Calibrating color temperature Calibrated gain of the red channel The calibration gain of the blue channel Ct1 RG_s1 BG_s1 Ct2 RG_s2 BG_s2 Ct3 RG_s3 BG_s3 …… …… ……

[0077] Table 1

[0078] Let the specified color channel be the red channel, and let the gain of the extracted red channel be RG_e. Then, select RG_s1, RG_s2, and RG_s3 from the calibration table shown in Table 1 as candidate calibration gains. Then, select the candidate calibration gain that is the smallest difference from the gain RG_e from the candidate calibration gains RG_s1, RG_s2, and RG_s3.

[0079] Alternatively, if the specified color channel is the blue channel and the gain of the extracted red channel is BG_e, then BG_s1, BG_s2, and BG_s3 are selected from the calibration table shown in Table 1 as candidate calibration gains. Then, the candidate calibration gain with the smallest difference from the gain BG_e is selected from the candidate calibration gains BG_s1, BG_s2, and BG_s3.

[0080] By implementing this optional embodiment, the calibration gain that differs the least from the extracted gain in the calibration table is taken as the calibration gain that matches the extracted gain and participates in the image color balance adjustment, making the image color balance adjustment more accurate and improving the accuracy of image color balance adjustment.

[0081] In one optional embodiment, the process of selecting candidate calibration gains for a specified color channel corresponding to each calibration color temperature from the calibration table to obtain multiple candidate calibration gains may include: obtaining the color temperature extracted from the input image; generating a color temperature range based on the color temperature, wherein the color temperature is located within the color temperature range; searching for multiple candidate calibration color temperatures located within the color temperature range from the calibration table, and selecting candidate calibration gains for a specified color channel corresponding to each candidate calibration color temperature to obtain multiple candidate calibration gains.

[0082] That is, in the optional embodiment, in addition to extracting the gain of a specified color channel from the input image, the color temperature can also be extracted from the input image. Then, the extracted color temperature is used to generate a color temperature range, where the extracted color temperature is located in the color temperature range. Then, multiple candidate calibration color temperatures located in the color temperature range are searched from the calibration table, and the candidate calibration gain of the specified color channel corresponding to each candidate calibration color temperature is selected, thereby obtaining multiple candidate calibration gains.

[0083] For example, the color temperature CT_e is extracted from the input image, where a starting color temperature CT_e1 less than CT_e and a ending color temperature CT_e2 greater than CT_e are determined, and the color temperature range [CT_e1, CT_e2] is generated using the starting color temperature CT_e1 and the ending color temperature CT_e2.

[0084] Let the specified color channel be the red channel, and let the calibration color temperature Ct1 and calibration color temperature Ct2 located in the color temperature range [CT_e1, CT_e2] be found from the calibration table shown in Table 1. In this case, the calibration color temperature Ct1 and calibration color temperature Ct2 are candidate calibration color temperatures. Then, RG_s1 corresponding to candidate calibration color temperature Ct1 and RG_s2 corresponding to candidate calibration color temperature Ct2 are selected from the calibration table shown in Table 1 as candidate calibration gains. Then, the candidate calibration gain with the smallest difference from the gain RG_e is selected from the candidate calibration gains RG_s1 and RG_s2.

[0085] Alternatively, let the specified color channel be the blue channel, and let the calibration color temperature Ct1 and calibration color temperature Ct2 located in the color temperature range [CT_e1, CT_e2] be found from the calibration table shown in Table 1. In this case, the calibration color temperature Ct1 and calibration color temperature Ct2 are candidate calibration color temperatures. Then, select BG_s1 corresponding to candidate calibration color temperature Ct1 and BG_s2 corresponding to candidate calibration color temperature Ct2 from the calibration table shown in Table 1 as candidate calibration gains. Then, select the candidate calibration gain with the smallest difference from the gain BG_e from the candidate calibration gains BG_s1 and BG_s2.

[0086] By implementing this optional embodiment, a color temperature range is generated using the extracted color temperature, and candidate calibration gains for the specified color channels corresponding to the calibration color temperatures within the color temperature range are selected from the calibration table. This avoids the tedious operation of comparing the extracted gains with the calibration gains of the specified color channels corresponding to each calibration color temperature, thus improving the efficiency of obtaining calibration gains that match the extracted gains and consequently improving the efficiency of image color balance adjustment.

[0087] In one of the optional embodiments, the process of selecting the candidate calibration gain with the smallest difference from the gain from multiple candidate calibration gains may include: performing a subtraction operation between the gain and multiple candidate calibration gains to obtain multiple gain difference values; and selecting the candidate calibration gain corresponding to the smallest gain difference value from multiple candidate calibration gains.

[0088] That is, in the optional embodiment, the extracted gain is first subtracted from multiple candidate calibration gains to obtain multiple gain difference values, and then the candidate calibration gain corresponding to the smallest gain difference value is selected from the multiple candidate calibration gains.

[0089] For example, continuing from the previous example of selecting the candidate calibration gain RG_e with the smallest difference from the candidate calibration gains RG_s1, RG_s2, and RG_s3, the difference between the gain RG_e and the candidate calibration gain RG_s1 is calculated to obtain the gain difference RG_es1, i.e., RG_es1 = RG_e - RG_s1. The difference between the gain RG_e and the candidate calibration gain RG_s2 is calculated to obtain the gain difference RG_es2, i.e., RG_es2 = RG_e - RG_s2. The difference between the gain RG_e and the candidate calibration gain RG_s3 is calculated to obtain the gain difference RG_es3, i.e., RG_es3 = RG_e - RG_s3. At the same time, assuming that RG_es2 is the smallest among the gain differences RG_es1, RG_es2, and RG_es3, then RG_s2 is selected as the candidate calibration gain with the smallest difference from the gain RG_e.

[0090] Alternatively, continuing with the example of selecting the candidate calibration gain with the smallest difference from the candidate calibration gains BG_s1, BG_s2, and BG_s3, the difference between the gain BG_e and the candidate calibration gain BG_s1 is calculated to obtain the gain difference BG_es1, i.e., BG_es1 = BG_e - BG_s1. The difference between the gain BG_e and the candidate calibration gain BG_s2 is calculated to obtain the gain difference BG_es2, i.e., BG_es1 - BG_s1. _es2 = BG_e - BG_s2. The gain difference BG_e is obtained by subtracting the candidate calibration gain BG_s3, i.e., BG_es3 = BG_e - BG_s3. At the same time, let BG_es2 be the smallest among the gain differences BG_es1, BG_es2 and BG_es3. Then, BG_s2 is the candidate calibration gain that has the smallest difference from the gain BG_e.

[0091] By implementing this optional embodiment, a calibration gain that matches the extracted gain can be obtained easily and accurately.

[0092] In an optional embodiment, before obtaining the calibration table, the process may further include: acquiring calibration images under different calibration color temperature environments; extracting calibration gains corresponding to different color channels from each calibration image to obtain multiple calibration gains for each calibration image, wherein the different color channels include red channels and blue channels; associating the calibration color temperature and multiple calibration gains corresponding to the same calibration image to generate a calibration table.

[0093] That is, in an optional embodiment, calibration images under different calibration color temperature environments are pre-acquired, and calibration gains corresponding to different color channels are extracted from each calibration image to obtain multiple calibration gains for each calibration image. Optionally, different color channels include red channels and blue channels. Then, the calibration color temperature and multiple calibration gains corresponding to the same calibration image are associated to generate a calibration table.

[0094] By implementing this optional embodiment, a calibration table can be obtained simply and accurately, providing strong support for obtaining a calibration gain that matches the extracted gain.

[0095] S203 calculates the gain error based on the calibrated gain and the white balance gain with the green channel as the reference, and calculates the gain adjustment value based on the gain error and the historical gain error.

[0096] In this embodiment, a calibration gain matching the extracted gain is obtained. Then, the gain error (referred to as the current gain error for easy distinction from historical gain error) can be calculated using the calibration gain and the white balance gain based on the green channel. The gain adjustment value of the specified color channel can then be calculated using the current gain error and the historical gain error.

[0097] In the embodiments of this application, the white balance gain refers to the ideal gain for a balanced white, which is typically close to 1.

[0098] In this embodiment, historical gain error refers to the gain error calculated earlier than the current time, and it can be one or more. Optionally, historical gain error can be all gain errors regardless of color channel; for example, suppose there are 10 gain errors for the red channel and 10 gain errors for the blue channel calculated earlier than the current time, then all 20 gain errors can be regarded as historical gain errors. Optionally, historical gain error can be a portion of the gain errors that need to distinguish color channels; for example, continuing the previous example, if the specified color channel is the red channel, then the 10 gain errors calculated earlier than the current time for the red channel are historical gain errors, or if the specified color channel is the blue channel, then the 10 gain errors calculated earlier than the current time for the blue channel are historical gain errors.

[0099] In the embodiments of this application, the gain adjustment value refers to a gain error that is more accurate than the current gain error. It can be used to obtain the target gain of a specified color channel, thereby adjusting the specified color channel.

[0100] In one embodiment of this application, the process of calculating the gain error in S203 based on the calibration gain and the white balance gain relative to the green channel may include:

[0101] Obtain the white balance gain based on the green channel, with a white balance gain of 1;

[0102] The gain error is obtained by subtracting the white balance gain from the calibration gain.

[0103] That is, in the optional embodiment, when the white balance gain is set to 1, the difference between the white balance gain and the calibration gain is calculated to obtain the current gain error.

[0104] For example, continuing from the previous example of obtaining a calibration gain RG_s2 that matches the gain RG_e, the difference between 1 and the calibration gain RG_s2 is used to obtain the current gain error E_RG_p, that is, E_RG_p=1-RG_s2.

[0105] Alternatively, following the example above where a calibration gain BG_s2 matching the gain BG_e was obtained, the difference between 1 and the calibration gain BG_s2 is used to obtain the current gain error E_BG_p, i.e., E_BG_p = 1 - BG_s2.

[0106] By implementing this optional embodiment, the current gain error can be obtained easily and accurately, providing strong support for image color balance adjustment.

[0107] In one embodiment of this application, the process of calculating the gain adjustment value based on the gain error and the historical gain error in S203 may include:

[0108] Based on the historical gain error, the generation time of the historical gain error, the gain error, and the generation time of the gain error, the auxiliary parameters for gain adjustment are calculated.

[0109] The gain adjustment value is calculated based on the gain error and the gain adjustment auxiliary parameters.

[0110] That is, in the optional embodiment, before / after / simultaneously obtaining the current gain error, the historical gain error and the generation time of the historical gain error can be obtained. Then, the gain adjustment auxiliary parameter is calculated using the historical gain error, the generation time of the historical gain error, the current gain error, and the generation time of the current gain error. Finally, the gain adjustment value is calculated using the gain error and the gain adjustment auxiliary parameter.

[0111] For example, continuing from the previous example of obtaining the current gain error E_RG_p, suppose we obtain the historical gain error E_RG_h, the generation time T_h of the historical gain error E_RG_h, and the generation time T_p of the current gain error E_RG_p. In this case, we first use the historical gain error E_RG_h, the generation time T_h, the current gain error E_RG_p, and the generation time T_p to calculate the gain adjustment auxiliary parameter E_RG_s. Then, we use the current gain error E_RG_p and the gain adjustment auxiliary parameter E_RG_s to calculate the gain adjustment value E_RG_a.

[0112] By implementing this optional embodiment, combining historical gain error and current gain error, and taking into account the historical changes in gain error, a more accurate gain adjustment value can be obtained, providing strong support for image color balance adjustment.

[0113] In the optional embodiment, the historical gain error includes multiple factors; correspondingly, the process of calculating the gain adjustment auxiliary parameter based on the historical gain error, the generation time of the historical gain error, the gain error, and the generation time of the gain error can include at least the following three cases:

[0114] Case 1: Based on multiple historical gain errors, the generation time of each historical gain error, the gain error itself, and the generation time of the gain error, perform an integral operation to obtain the integral value of the gain error, which is used to characterize the accumulation of the gain error. The integral value of the gain error is then used as an auxiliary parameter for gain adjustment.

[0115] In Case 1, when there are multiple historical gain errors, the integral value of the gain error is obtained by performing an integral operation on the multiple historical gain errors, the generation time corresponding to the multiple historical gain errors, the current gain error, and the generation time of the current gain error. The integral value of the gain error is used to characterize the accumulation of gain error, and the integral value of the gain error is the auxiliary parameter for gain adjustment.

[0116] For example, if we use an integral formula to perform the integral operation, let the integral value of the gain error be E_RG_si, where the integral formula is: E_RG_si=∫error(t)dt, where error(t) refers to the gain error (which can be the historical gain error, or the historical gain error and the current gain error, and dt refers to the time interval between the generation times of two adjacent gain errors).

[0117] Optionally, in Case 1, the process of calculating the gain adjustment value based on the gain error and the gain adjustment auxiliary parameter may include: obtaining the gain coefficients corresponding to the gain error and the integral value of the gain error, respectively; and performing a weighted summation operation based on the gain error, the integral value of the gain error, and the gain coefficients to obtain the gain adjustment value.

[0118] For example, the gain adjustment formula can be used for calculation, where the gain adjustment formula is: E_RG_a=K p ×error+K i ×∫error(t)dt, where error refers to the current gain error, error(t) refers to the gain error over a period of time (which can be the historical gain error, or a combination of the historical and current gain errors, and dt refers to the time interval between the generation times of two adjacent gain errors), K p K refers to the gain coefficient corresponding to the current gain error. i This refers to the gain coefficient corresponding to the integral value of the gain error.

[0119] Case 2: Based on multiple historical gain errors, the generation time of each historical gain error, the gain error itself, and the generation time of the gain error, perform differential operations to obtain the differential value of the gain error used to characterize the change of the gain error, and use the differential value of the gain error as an auxiliary parameter for gain adjustment.

[0120] In Case 2, when there are multiple historical gain errors, the differential value of the gain error is obtained by performing differential operations on the multiple historical gain errors, the generation time corresponding to the multiple historical gain errors, the current gain error, and the generation time of the current gain error. The differential value of the gain error is used to characterize the change of the gain error. At this time, the differential value of the gain error is the auxiliary parameter for gain adjustment.

[0121] For example, if we use a differential formula to perform differential operations, let the differential value of the gain error be E_RG_sd, where the differential formula is: E_RG_sd=d(error-error(t)) / dt, where error refers to the current gain error, error(t) refers to the gain error (which can be the historical gain error, or the combination of the historical gain error and the current gain error, and dt refers to the time interval between the generation times of two adjacent gain errors).

[0122] Optionally, in Case 2, the process of calculating the gain adjustment value based on the gain error and the gain adjustment auxiliary parameter may include: obtaining the gain coefficients corresponding to the gain error and the differential value of the gain error, respectively; and performing a weighted summation operation based on the gain error, the differential value of the gain error, and the gain coefficients to obtain the gain adjustment value.

[0123] For example, the gain adjustment formula can be used for calculation, where the gain adjustment formula is: E_RG_a=K p ×error+K d ×(d(error-error(t)) / dt), where error refers to the current gain error, error(t) refers to the gain error over a period of time (which can be the historical gain error, or the historical and current gain errors, and dt refers to the time interval between the generation times of two adjacent gain errors), K p K refers to the gain coefficient corresponding to the current gain error. d It refers to the gain coefficient corresponding to the differential value of the gain error.

[0124] Case 3: Based on multiple historical gain errors, the generation time of each historical gain error, the gain error itself, and the generation time of the gain error, perform integration to obtain the integral value of the gain error, which characterizes the accumulation of the gain error; and based on multiple historical gain errors, the generation time of each historical gain error, the gain error itself, and the generation time of the gain error, perform differentiation to obtain the differential value of the gain error, which characterizes the change of the gain error; use the integral value of the gain error and the differential value of the gain error as auxiliary parameters for gain adjustment.

[0125] Case 3 is a combination of Case 1 and Case 2, where both the integral value of the gain error and the derivative value of the gain error are auxiliary parameters for gain adjustment.

[0126] Optionally, in case 3, the process of calculating the gain adjustment value based on the gain error and the gain adjustment auxiliary parameter may include: obtaining the gain error, the integral value of the gain error, and the gain coefficients corresponding to the differential value of the gain error; and performing a weighted summation operation based on the gain error, the integral value of the gain error, the differential value of the gain error, and the gain coefficients to obtain the gain adjustment value.

[0127] For example, the gain adjustment formula can be used for calculation, where the gain adjustment formula is: E_RG_a=K p ×error+K i ×∫error(t)dt+K d ×(d(error-error(t)) / dt), where error refers to the current gain error, error(t) refers to the gain error over a period of time (which can be the historical gain error, or the historical and current gain errors, and dt refers to the time interval between the generation times of two adjacent gain errors), K p K refers to the gain coefficient corresponding to the current gain error. i K refers to the gain coefficient corresponding to the integral value of the gain error. d It refers to the gain coefficient corresponding to the differential value of the gain error.

[0128] By implementing this optional embodiment, the integral value of the gain error is used as an auxiliary parameter for gain adjustment, taking into account the accumulation of the gain error, and / or the derivative value of the gain error is used as an auxiliary parameter for gain adjustment, taking into account the changes in the gain error, thereby improving the accuracy of the gain adjustment value calculation and thus improving the accuracy of image color balance adjustment.

[0129] S204, adjust the specified color channel based on the gain adjustment value to obtain the target image.

[0130] In this embodiment, a gain adjustment value is obtained, which can then be used to adjust a specified color channel to obtain the target image.

[0131] In this embodiment of the application, the target image refers to the image obtained after color balance adjustment of the input image. Compared with the input image, it has a better image color balance effect and is more convenient for corresponding operations (such as verification).

[0132] In one embodiment of this application, the process of adjusting a specified color channel based on a gain adjustment value to obtain a target image in step S204 may include:

[0133] The target gain is calculated based on the gain adjustment value and the white balance gain.

[0134] The target image is obtained by adjusting the specified color channel based on the target gain.

[0135] That is, in the optional embodiment, the target gain is first calculated using the gain adjustment value and the white balance gain, and then the target gain is used to adjust the specified color channel to obtain the target image.

[0136] For example, continuing from the previous example, the target gain BG_t is calculated using the gain adjustment value E_RG_a and the white balance gain, and then the target gain BG_t is used to adjust the specified color channel to obtain the target image.

[0137] By implementing this optional embodiment, the final target gain is obtained by using the gain adjustment value and the white balance gain, thereby enabling image color balance adjustment and improving the accuracy of image color balance adjustment.

[0138] In one of the optional embodiments, the process of calculating the target gain based on the gain adjustment value and the white balance gain may include: performing a difference operation on the white balance gain and the gain adjustment value to obtain the target gain.

[0139] That is, in the optional embodiment, when the white balance gain is set to 1, the target gain is obtained by performing a difference operation on the white balance gain and the gain adjustment value.

[0140] For example, the target gain BG_t can be obtained by subtracting 1 from the gain adjustment value E_RG_a, i.e., BG_t = 1 - E_RG_a.

[0141] By implementing this optional embodiment, the target gain can be obtained easily and accurately, providing strong support for image color balance adjustment.

[0142] In one optional embodiment, the specified color channels include a red channel and a blue channel, and the target gain includes a first target gain for the red channel and a second target gain for the blue channel. Accordingly, the process of adjusting the specified color channels based on the target gain to obtain the target image may include: adjusting the channel value corresponding to the red channel of a pixel in the input image based on the first target gain to obtain the adjusted channel value for the red channel; adjusting the channel value corresponding to the blue channel of a pixel in the input image based on the second target gain to obtain the adjusted channel value for the blue channel; and generating the target image based on the channel value corresponding to the green channel of a pixel in the input image, the adjusted channel value for the red channel, and the adjusted channel value for the blue channel.

[0143] That is, in the optional embodiment, when the specified color channel includes a red channel and a blue channel, the target gain includes a first target gain for the red channel and a second target gain for the blue channel. In this case, the channel value corresponding to the red channel of the pixel in the input image is first adjusted using the first target gain to obtain the adjusted channel value for the red channel, and the channel value corresponding to the blue channel of the pixel in the input image is adjusted using the second target gain to obtain the adjusted channel value for the blue channel. Then, the target image is generated using the channel value corresponding to the green channel of the pixel in the input image, the adjusted channel value for the red channel, and the adjusted channel value for the blue channel.

[0144] For example, continuing from the previous example, let the target gain BG_t include a first target gain BG_tr and a second target gain BG_tb. Then, the first target gain BG_tr is used to adjust the channel value r corresponding to the red channel of a pixel in the input image, resulting in the adjusted channel value r' for the red channel. Similarly, the second target gain BG_tb is used to adjust the channel value b corresponding to the blue channel of a pixel in the input image, resulting in the adjusted channel value b' for the blue channel. Simultaneously, let g be the channel value g corresponding to the green channel of a pixel in the input image. Then, using the channel value g corresponding to the green channel of a pixel in the input image, the adjusted channel value r' for the red channel, and the adjusted channel value b' for the blue channel, the target image is generated. It can be understood that the pixel value of the same pixel in the input image can be represented as (r, g, b) before adjustment, and as (r', g, b') after adjustment.

[0145] By implementing this optional embodiment, the efficiency of image color balance adjustment is improved by simultaneously adjusting both the red and blue channels.

[0146] In one optional embodiment, the process of adjusting the channel value corresponding to the red channel of a pixel in the input image based on the first target gain to obtain the adjusted channel value for the red channel, and adjusting the channel value corresponding to the blue channel of a pixel in the input image based on the second target gain to obtain the adjusted channel value for the blue channel, may include: generating adjustment tasks for the red channel and the blue channel respectively to obtain multiple adjustment tasks; executing multiple adjustment tasks in parallel to obtain the adjusted channel value for the red channel and the adjusted channel value for the blue channel.

[0147] That is, in an optional embodiment, multiple adjustment tasks are executed in parallel to achieve parallel adjustment of the channel values ​​of the corresponding color channels.

[0148] By implementing this optional embodiment, the channel values ​​corresponding to the red and blue channels are adjusted in parallel, further improving the efficiency of image color balance adjustment.

[0149] In one embodiment of this application, after adjusting the specified color channel based on the gain adjustment value in S204 to obtain the target image, the process may further include:

[0150] The object corresponding to the input image is verified based on the target image, and the pending task is executed after the verification is successful.

[0151] That is, in an optional embodiment, the target image is used to verify the object corresponding to the input image, and the task to be processed is executed after the verification is passed.

[0152] For example, in a payment application scenario, an image of the hand input by the object is collected. Then, the hand image can be adjusted using the technical solution provided in the embodiments of this application to obtain a hand image with better color balance. The object is then verified using the hand image with better color balance, and the payment task is executed after the verification is successful, thereby completing the payment.

[0153] Alternatively, in the unlocking application scenario, an image of the hand input by the object is collected. Then, the hand image can be adjusted using the technical solution provided in the embodiments of this application to obtain a hand image with better color balance. The object is then verified using the hand image with better color balance, and the unlocking task is executed after the verification is passed, thereby completing the unlocking.

[0154] By implementing this optional embodiment, the target image is applied to the scenario where verification is required to perform the task to be processed. This avoids the phenomenon that the verification accuracy is low due to the poor color balance of the input image, thereby improving the accuracy of verification and thus improving the accuracy of task execution.

[0155] In this embodiment, a relatively accurate calibration gain for a specified color channel in the input image is obtained through pre-calibration. The gain error between the white balance gain and the calibration gain is then calculated based on the white balance gain. This gain error, along with historical gain errors, yields a more accurate gain error, thereby enabling adjustment of the specified color channel in the input image. Compared to related technical solutions, this embodiment is unaffected by ambient color temperature and is applicable to images acquired in any environment. Specifically, it is not limited to images with small color deviations and eliminates the need to select a white point, thus improving the accuracy, efficiency, and flexibility of image color balance adjustment. Furthermore, the reliability of image-based data processing is high.

[0156] The following provides a detailed description of specific scenarios in the embodiments of this application:

[0157] Please see Figure 3 , Figure 3 This is a schematic diagram illustrating a system according to an embodiment of this application. Figure 3 As shown, the system mainly includes calibration services and adjustment services, among which:

[0158] The calibration service is mainly used to acquire calibration images at a calibration color temperature and extract the calibration gains corresponding to different color channels from each calibration image to obtain multiple calibration gains for each calibration image. The different color channels include the red channel and the blue channel. Then, the calibration color temperature and multiple calibration gains corresponding to the same calibration image are associated to generate a calibration table.

[0159] Specifically, first prepare a standard light source, which includes, but is not limited to, fluorescent lamps, incandescent lamps, and fluorescent lamps, and determine the different color temperatures corresponding to the standard light source. These different color temperatures are then designated as different calibration color temperatures. Next, take images at different calibration color temperatures and designate the captured images as calibration images. Then, extract RGB values ​​from the calibration images corresponding to different calibration color temperatures (e.g., using color analysis tools), and associate the RGB values ​​corresponding to the same calibration image with the calibration color temperature to generate a calibration table.

[0160] For easier understanding, please refer to Figure 4 , which represents the acquired calibration image, and the corresponding calibration color temperature and RGB values. Figure 4 Because the calibration images in the image have undergone grayscale processing, the color differences are not obvious. Figure 4 The color temperature of the standard involves two fields. Field 1 includes uppercase letters, or uppercase letters and numbers, which is used to characterize the standard light source.

[0161] For easier understanding, please refer to Table 2, which is a calibration table for another example.

[0162]

[0163]

[0164] Table 2

[0165] The adjustment service primarily extracts the gain for the red channel from the received input image, retrieves the calibration gain matching the red channel gain from the calibration table, calculates the gain error based on the calibration gain and the white balance gain based on the green channel, and calculates the gain adjustment value for the red channel based on the gain error and historical gain errors. Similarly, it extracts the gain for the blue channel from the received input image, retrieves the calibration gain matching the blue channel gain from the calibration table, calculates the gain error based on the calibration gain and the white balance gain based on the green channel, and calculates the gain adjustment value for the blue channel based on the gain error and historical gain errors. Finally, it adjusts the red channel in the input image based on the gain adjustment value for the red channel, and adjusts the blue channel in the input image based on the gain adjustment value for the blue channel, thereby generating the target image.

[0166] Optionally, the adjustment service includes proportional control service, integral control service, derivative control service, and execution control service. Specifically, the proportional control service calculates the gain error of the red channel and the gain error of the blue channel; the integral control service calculates the integral value of the gain error of the red channel and the integral value of the gain error of the blue channel; the derivative control service calculates the derivative value of the gain error of the red channel and the derivative value of the gain error of the blue channel; the execution control service calculates the gain adjustment value of the red channel based on the gain error, the integral value of the gain error, and the derivative value of the gain error, and then adjusts the red channel based on the gain adjustment value of the red channel; and the execution control service calculates the gain adjustment value of the blue channel based on the gain error, the integral value of the gain error, and the derivative value of the gain error, and then adjusts the red channel based on the gain adjustment value of the blue channel.

[0167] based on Figure 3 Please refer to the system shown. Figure 5 , Figure 5 This is a flowchart illustrating an image-based data processing method according to an embodiment of this application. Figure 5 As shown, this image-based data processing method includes at least S501 to S506, which are described in detail below:

[0168] S501 extracts the gain of the red channel and the gain of the blue channel from the palm image.

[0169] S502, obtain the calibration gain that matches the red channel gain and the calibration gain that matches the blue channel gain.

[0170] S503 calculates the gain error of the red channel by subtracting the white balance gain and the calibration gain of the red channel, and calculates the gain error of the blue channel by subtracting the white balance gain and the calibration gain of the blue channel.

[0171] S504, based on the historical gain error of the red channel and the generation time of the historical gain error, calculates the integral value and differential value of the gain error of the red channel; and based on the historical gain error of the blue channel and the generation time of the historical gain error, calculates the integral value and differential value of the gain error of the blue channel.

[0172] S505 calculates the gain adjustment value of the red channel based on the gain error, the integral value of the gain error, and the derivative value of the gain error of the red channel, and calculates the gain adjustment value of the blue channel based on the gain error, the integral value of the gain error, and the derivative value of the gain error of the blue channel.

[0173] Optionally, the gain adjustment value for a specified color channel can be expressed as:

[0174] output = K p ×error+K i ×integral+K d ×derivative

[0175] Where, error refers to the difference between the white balance gain and the calibration gain (i.e., gain error), and the white balance gain is usually set to 1; integral refers to the accumulation of error over time (i.e., the integral value of gain error); derivative refers to the rate of change of error (i.e., the derivative value of gain error), K p K i K d These are the gain coefficients for the gain error, the integral value of the gain error, and the derivative value of the gain error, respectively.

[0176] Specifically, regarding the red channel:

[0177] error r =1-current_r_gatio

[0178] output r =K p ×error r +K i ×integral r +K d ×derivative r

[0179] Specifically, regarding the blue channel:

[0180] error b =1-current_b_gatio

[0181] output b =K p ×error b +K i ×integral b +K d ×derivative b

[0182] S506, adjusts the red channel based on the gain adjustment value of the red channel, and adjusts the red channel based on the gain adjustment value of the blue channel.

[0183] For easier understanding, please refer to Figure 6 To acquire the input image, the gain adjustment values ​​for the red channel and the blue channel are calculated based on the input image. Then, the gain of the red channel is updated according to the gain adjustment value of the red channel, and the gain of the blue channel is updated according to the gain adjustment value of the blue channel, thereby realizing the color balance adjustment of the input image, obtaining the target image, and outputting the target image.

[0184] For ease of understanding, the main implementation code is as follows:

[0185] Use design examples:

[0186] import numpy as np

[0187] # Create a sample image (random noise image)

[0188] image=np.random.rand(100,100,3)

[0189] #Initialize the PID controller

[0190] pid_r=PIDController(kp=0.1, ki=0.01, kd=0.05)

[0191] pid_b=PIDController(kp=0.1, ki=0.01, kd=0.05)

[0192] #Adjust the white balance of the image

[0193] dt = 1.0 # Assuming the interval between each call is 1 second

[0194] adjusted_image=adjust_white_balance(image, pid_r, pid b, dt)

[0195] # View the adjusted image (in practical applications, image display functions should be used, such as matplotlib's imshow) print(adjusted image)

[0196] White balance adjustment design example:

[0197] def adjust_white_balance(image, pid_r, pid b, dt):

[0198] #Assume image is a three-dimensional array containing RGB values

[0199] #Calculate the current ratio of red and blue channels to green channel.

[0200] r_g_ratio=np.mean(image[:,:,0]) / np.mean(image[:,:,1])

[0201] b_g_ratio=np.mean(image[:,:,2]) / np.mean(image[:,:,1])

[0202] #Calculation error

[0203] error_r = 1 - r_g_ratio

[0204] error_b = 1 - b_g_ratio

[0205] #Update PID controller

[0206] r_gain=pid_r.update(error_r,dt)

[0207] b_gain=pidb.update(error b, dt)

[0208] g_gain = 1 # Normally, the green channel gain is kept at 1.

[0209] #Adjust image channels

[0210] image[:,:,0]*=r_gain

[0211] imagel:,:,1]*=g_gain

[0212] image[:,:,2]*=b_gain

[0213] return image

[0214] Example of PID controller design:

[0215] class PIDController:

[0216] def_init(self, kp, ki, kd):

[0217] self.kp = kp

[0218] self.ki = ki

[0219] self.kd = kd

[0220] self.integral = 0

[0221] self.previous_error = 0

[0222] def update(self, error, dt):

[0223] "Update the output of the PID controller based on the given error and time interval"

[0224] self.integral += error × dt

[0225] derivative=(error-self.previous_error) / dt

[0226] output=self.kp×error+self.ki×self.integral+self.kd×derivative

[0227] self.previous_error = error

[0228] return output

[0229] It should be noted that in the aforementioned PID controller, P represents proportional, which corresponds to the aforementioned gain error; I represents integral, which corresponds to the aforementioned integral of the gain error; and D represents derivative, which corresponds to the aforementioned derivative of the gain error.

[0230] The embodiment of this application uses the calibration gain obtained under the calibration color temperature environment, as well as the gain error between it and the white balance gain and the historical gain error, to adjust the specified color channel in the input image. This is not affected by the ambient color temperature and is applicable to images acquired in any environment. Specifically, it is not limited to images with small color deviations, and there is no need to select a white point, thereby improving the accuracy, efficiency, and flexibility of image color balance adjustment, and the reliability of image data processing is high.

[0231] Figure 7 This is a block diagram illustrating an image-based data processing apparatus according to one embodiment of this application. Figure 7 As shown, the device includes:

[0232] Extraction module 701 is configured to extract the gain of a specified color channel from the input image;

[0233] The acquisition module 702 is configured to acquire a calibration gain that matches the gain, wherein the calibration gain is obtained based on a calibration image acquired under a calibration color temperature environment;

[0234] The calculation module 703 is configured to calculate the gain error based on the calibration gain and the white balance gain based on the green channel, and to calculate the gain adjustment value of the specified color channel based on the gain error and the historical gain error.

[0235] The adjustment module 704 is configured to adjust the specified color channel based on the gain adjustment value to obtain the target image.

[0236] In one embodiment of this application, based on the aforementioned scheme, the acquisition module 702 is specifically configured to: acquire a calibration table, the calibration table including multiple calibration color temperatures and multiple calibration gains corresponding to each calibration color temperature, the multiple calibration gains being calibration gains corresponding to different color channels; select candidate calibration gains for the specified color channel corresponding to each calibration color temperature from the calibration table to obtain multiple candidate calibration gains; select the candidate calibration gain with the smallest difference from the gain from the multiple candidate calibration gains, and use the selected candidate calibration gain as the calibration gain that matches the gain.

[0237] In one embodiment of this application, based on the aforementioned scheme, the acquisition module 702 is further specifically configured to: acquire the color temperature extracted from the input image; generate a color temperature range based on the color temperature, wherein the color temperature is located within the color temperature range; search for multiple candidate calibration color temperatures located within the color temperature range from the calibration table, and select the candidate calibration gain of the specified color channel corresponding to each candidate calibration color temperature to obtain multiple candidate calibration gains.

[0238] In one embodiment of this application, based on the aforementioned scheme, the acquisition module 702 is further configured to: perform subtraction operations between the gain and the plurality of candidate calibration gains respectively to obtain a plurality of gain difference values; and select the candidate calibration gain corresponding to the smallest gain difference value from the plurality of candidate calibration gains.

[0239] In one embodiment of this application, based on the foregoing scheme, the device further includes a generation module configured to: acquire calibration images under different calibration color temperature environments; extract calibration gains corresponding to different color channels from each calibration image to obtain multiple calibration gains for each calibration image, wherein the different color channels include a red channel and a blue channel; and associate the calibration color temperature corresponding to the same calibration image with the multiple calibration gains to generate a calibration table.

[0240] In one embodiment of this application, based on the aforementioned scheme, the calculation module 703 is specifically configured as follows: obtaining the white balance gain based on the green channel, wherein the white balance gain is 1; performing a difference operation on the white balance gain and the calibration gain to obtain the gain error; calculating the gain adjustment auxiliary parameter based on the historical gain error, the generation time of the historical gain error, the gain error, and the generation time of the gain error; and calculating the gain adjustment value based on the gain error and the gain adjustment auxiliary parameter.

[0241] In one embodiment of this application, based on the foregoing scheme, the historical gain error includes multiple errors; the calculation module 703 is further specifically configured to: perform integration operations based on the multiple historical gain errors, the generation times corresponding to the multiple historical gain errors, the gain error, and the generation time of the gain error to obtain a gain error integral value used to characterize the accumulation of gain error, and use the gain error integral value as a gain adjustment auxiliary parameter; and / or, perform differentiation operations based on the multiple historical gain errors, the generation times corresponding to the multiple historical gain errors, the gain error, and the generation time of the gain error to obtain a gain error differential value used to characterize the change of gain error, and use the gain error differential value as a gain adjustment auxiliary parameter.

[0242] In one embodiment of this application, based on the aforementioned scheme, the gain adjustment auxiliary parameter includes the integral value of the gain error and the differential value of the gain error; the calculation module 703 is further specifically configured to: obtain the gain error, the integral value of the gain error, and the gain coefficients corresponding to the differential value of the gain error respectively; and perform a weighted summation operation based on the gain error, the integral value of the gain error, the differential value of the gain error, and the gain coefficients to obtain the gain adjustment value.

[0243] In one embodiment of this application, based on the aforementioned scheme, the adjustment module 704 is specifically configured to: perform a difference operation on the white balance gain and the gain adjustment value to obtain a target gain; and adjust the specified color channel based on the target gain to obtain a target image.

[0244] In one embodiment of this application, based on the foregoing scheme, the specified color channel includes a red channel and a blue channel, and the target gain includes a first target gain for the red channel and a second target gain for the blue channel; the adjustment module 704 is further specifically configured to: adjust the channel value corresponding to the red channel of the pixel in the input image based on the first target gain to obtain the adjusted channel value for the red channel; adjust the channel value corresponding to the blue channel of the pixel in the input image based on the second target gain to obtain the adjusted channel value for the blue channel; and generate a target image based on the channel value corresponding to the green channel of the pixel in the input image, the adjusted channel value for the red channel, and the adjusted channel value for the blue channel.

[0245] In one embodiment of this application, based on the aforementioned scheme, the extraction module 701 is specifically configured to: perform image segmentation processing on the input image to obtain multiple image blocks, and extract the gain of the specified color channel from each image block; perform an averaging operation on the gains corresponding to the multiple image blocks respectively to obtain an average gain, and use the average gain as the gain of the specified color channel.

[0246] In one embodiment of this application, based on the foregoing scheme, the device further includes a data acquisition module configured to: acquire biometric images, the biometric images including at least one of palm images and face images, and use the biometric images as input images;

[0247] In one embodiment of this application, based on the foregoing scheme, the device further includes an execution module configured to: verify the object corresponding to the input image based on the target image, and execute the task to be processed after the verification is passed.

[0248] It should be noted that the apparatus provided in the foregoing embodiments and the method provided in the foregoing embodiments belong to the same concept, and the specific way in which each module and unit performs operations has been described in detail in the method embodiments.

[0249] Embodiments of this application also provide an electronic device, including: one or more processors; and a memory for storing one or more computer programs, which, when executed by one or more processors, cause the electronic device to implement the aforementioned image-based data processing method.

[0250] Figure 8 It is an electronic device suitable for implementing the embodiments of this application (e.g. Figure 1 The diagram shows the structure of a computer system (terminal device or server).

[0251] It should be noted that, Figure 8 The computer system 800 of the electronic device shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of this application.

[0252] like Figure 8 As shown, the computer system 800 includes a Central Processing Unit (CPU) 801, which can perform various appropriate actions and processes, such as executing the methods described in the above embodiments, based on a computer program stored in a Read-Only Memory (ROM) 802 or a computer program loaded from a storage portion 808 into a Random Access Memory (RAM) 803. The RAM 803 also stores various computer programs and data required for system operation. The CPU 801, ROM 802, and RAM 803 are interconnected via a bus 804. An Input / Output (I / O) interface 805 is also connected to the bus 804.

[0253] The following components are connected to I / O interface 805: an input section 806 including a keyboard, mouse, etc.; an output section 807 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and speakers, etc.; a storage section 808 including a hard disk, etc.; and a communication section 809 including a network interface card such as a LAN (Local Area Network) card, modem, etc. The communication section 809 performs communication processing via a network such as the Internet. A drive 810 is also connected to I / O interface 805 as needed. A removable medium 811, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., is installed on drive 810 as needed so that computer programs read from it can be installed into storage section 808 as needed.

[0254] Specifically, according to embodiments of this application, the processes described above with reference to the flowcharts can be implemented as computer programs. For example, embodiments of this application include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing computer instructions for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication section 809, and / or installed from removable medium 811. When the computer program is executed by central processing unit (CPU) 801, it performs various functions defined in the system of this application.

[0255] It should be noted that the computer-readable medium shown in the embodiments of this application can be a computer-readable signal medium, a computer-readable storage medium, or any combination thereof. For example, a computer-readable medium can be an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM), flash memory, optical fiber, portable compact disc read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this application, a computer-readable medium can be any tangible medium containing or storing a computer program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In this application, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying a computer-readable computer program. Such transmitted data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. The computer-readable signal medium can also be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a computer program for use by or in connection with an instruction execution system, apparatus, or device. The computer program contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to wireless, wired, etc., or any suitable combination thereof.

[0256] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this application. Each block in a flowchart or block diagram may represent a module, segment, or portion of code, which contains one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram or flowchart, and combinations of blocks in a block diagram or flowchart, may be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.

[0257] The units described in the embodiments of this application can be implemented in software or hardware, and the described units can also be located in a processor. The names of these units do not necessarily limit the specific unit itself.

[0258] Another aspect of this application provides a computer-readable medium having a computer program stored thereon, which, when executed by a processor, implements the aforementioned image-based data processing method. This computer-readable medium may be included in the electronic device described in the above embodiments, or it may exist independently and not incorporated into the electronic device.

[0259] Another aspect of this application provides a computer program product or computer program including computer instructions stored in a computer-readable medium. A processor of an electronic device reads the computer instructions from the computer-readable medium and executes the computer instructions, causing the electronic device to perform the image-based data processing methods provided in the various embodiments described above.

[0260] The above description is merely a preferred exemplary embodiment of this application and is not intended to limit the implementation of this application. Those skilled in the art can easily make corresponding modifications or alterations based on the main concept and spirit of this application. Therefore, the scope of protection of this application should be determined by the scope of protection claimed in the claims.

Claims

1. An image-based data processing method, characterized in that, include: Extract the gain of a specified color channel from the input image; Obtain a calibration gain that matches the stated gain, the calibration gain being based on a calibration image acquired under a calibration color temperature environment; Based on the calibrated gain and the white balance gain with the green channel as a reference, the gain error is calculated, and based on the gain error and the historical gain error, the gain adjustment value is calculated. The specified color channel is adjusted based on the gain adjustment value to obtain the target image.

2. The method according to claim 1, characterized in that, The process of obtaining a calibration gain that matches the gain includes: Obtain a calibration table, which includes multiple calibration color temperatures and multiple calibration gains corresponding to each calibration color temperature. The multiple calibration gains are calibration gains corresponding to different color channels. From the calibration table, select the candidate calibration gain for the specified color channel corresponding to each calibration color temperature to obtain multiple candidate calibration gains; Select the candidate calibration gain that differs the least from the given gain from the plurality of candidate calibration gains, and use the selected candidate calibration gain as the calibration gain that matches the given gain.

3. The method according to claim 2, characterized in that, The step of selecting candidate calibration gains for the specified color channel corresponding to each calibration color temperature from the calibration table yields multiple candidate calibration gains, including: Obtain the color temperature extracted from the input image; A color temperature range is generated based on the color temperature, and the color temperature is located within the color temperature range; Find multiple candidate calibration color temperatures located in the color temperature range from the calibration table, and select the candidate calibration gain of the specified color channel corresponding to each candidate calibration color temperature to obtain multiple candidate calibration gains.

4. The method according to claim 2, characterized in that, The step of selecting the candidate calibration gain that differs smallest from the given gain from the plurality of candidate calibration gains includes: The difference between the gain and the plurality of candidate calibration gains is calculated to obtain a plurality of gain difference values; Select the candidate calibration gain corresponding to the smallest gain difference from the plurality of candidate calibration gains.

5. The method according to claim 2, characterized in that, Prior to obtaining the calibration table, the method further includes: Acquire calibration images under different calibration color temperature environments; The calibration gain corresponding to different color channels is extracted from each calibration image to obtain multiple calibration gains for each calibration image, wherein the different color channels include the red channel and the blue channel; The calibration color temperature and multiple calibration gains corresponding to the same calibration image are correlated to generate a calibration table.

6. The method according to any one of claims 1 to 5, characterized in that, The gain error, calculated based on the calibrated gain and the white balance gain relative to the green channel, includes: Obtain the white balance gain based on the green channel, where the white balance gain is 1; The gain error is obtained by subtracting the white balance gain from the calibration gain. The calculation of the gain adjustment value based on the gain error and the historical gain error includes: Based on the historical gain error, the generation time of the historical gain error, the gain error, and the generation time of the gain error, the gain adjustment auxiliary parameters are calculated. The gain adjustment value is calculated based on the gain error and the gain adjustment auxiliary parameter.

7. The method according to claim 6, characterized in that, The historical gain error includes multiple parameters; the gain adjustment auxiliary parameters are calculated based on the historical gain error, the generation time of the historical gain error, the gain error itself, and the generation time of the gain error, including: Based on multiple historical gain errors, the generation time corresponding to the multiple historical gain errors, the gain error, and the generation time of the gain error, an integral operation is performed to obtain a gain error integral value that characterizes the accumulation of gain error, and the gain error integral value is used as an auxiliary parameter for gain adjustment. And / or, Differential operations are performed based on the multiple historical gain errors, the generation times corresponding to the multiple historical gain errors, the gain error itself, and the generation time of the gain error to obtain a differential value of the gain error that characterizes the change of the gain error. This differential value of the gain error is then used as an auxiliary parameter for gain adjustment.

8. The method according to claim 7, characterized in that, The gain adjustment auxiliary parameters include the integral value of the gain error and the differential value of the gain error; The calculation of the gain adjustment value based on the gain error and the gain adjustment auxiliary parameter includes: Obtain the gain error, the integral value of the gain error, and the gain coefficients corresponding to the differential value of the gain error, respectively; The gain adjustment value is obtained by performing a weighted summation operation based on the gain error, the integral value of the gain error, the derivative value of the gain error, and the gain coefficient.

9. The method according to any one of claims 1 to 5, characterized in that, The step of adjusting the specified color channel based on the gain adjustment value to obtain the target image includes: The target gain is obtained by subtracting the white balance gain and the gain adjustment value. The target image is obtained by adjusting the specified color channel based on the target gain.

10. The method according to claim 9, characterized in that, The specified color channel includes a red channel and a blue channel, and the target gain includes a first target gain for the red channel and a second target gain for the blue channel; adjusting the specified color channel based on the target gain to obtain the target image includes: Based on the first target gain, the channel value corresponding to the red channel of the pixel in the input image is adjusted to obtain the adjusted channel value for the red channel; Based on the second target gain, the channel value corresponding to the blue channel of the pixel in the input image is adjusted to obtain the adjusted channel value for the blue channel; The target image is generated based on the channel values ​​corresponding to the green channel of the pixels in the input image, the channel values ​​adjusted for the red channel, and the channel values ​​adjusted for the blue channel.

11. The method according to any one of claims 1 to 5, characterized in that, The step of extracting the gain of a specified color channel from the input image includes: The input image is segmented to obtain multiple image blocks, and the gain of the specified color channel is extracted from each image block; The average gain of each of the multiple image blocks is calculated to obtain the average gain, and the average gain is used as the gain of the specified color channel.

12. The method according to any one of claims 1 to 5, characterized in that, Before extracting the gain of a specified color channel from the input image, the method further includes: Acquire biometric images, which include at least one of palm images and face images, and use the biometric images as input images; And / or, After adjusting the specified color channel based on the gain adjustment value to obtain the target image, the method further includes: The object corresponding to the input image is verified based on the target image, and the task to be processed is executed after the verification is successful.

13. An image-based data processing apparatus, characterized in that, include: The extraction module is configured to extract the gain of a specified color channel from the input image; The acquisition module is configured to acquire a calibration gain that matches the gain, wherein the calibration gain is obtained based on a calibration image acquired under a calibration color temperature environment; The calculation module is configured to calculate the gain error based on the calibrated gain and the white balance gain based on the green channel, and to calculate the gain adjustment value of the specified color channel based on the gain error and the historical gain error. The adjustment module is configured to adjust the specified color channel based on the gain adjustment value to obtain the target image.

14. An electronic device, characterized in that, include: One or more processors; A memory for storing one or more computer programs that, when executed by the electronic device, cause the electronic device to implement the image-based data processing method according to any one of claims 1 to 12.

15. A computer-readable medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the image-based data processing method according to any one of claims 1 to 12.

16. A computer program product comprising computer instructions, characterized in that, When the computer instructions are executed by the processor, they implement the image-based data processing method according to any one of claims 1 to 12.