Pixel channel adjustment method and device, equipment and storage medium

By using the first preset and the second preset adjustment algorithm to process the calculation of numerical values in image processing, the problem of shadow details and highlight details loss caused by image editing is solved, and the image accuracy is improved.

CN120378588APending Publication Date: 2025-07-25AXERA SEMICON (SHANGHAI) CO LTD
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202510578704.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-05-06
Publication Date
2025-07-25

AI Technical Summary

Technical Problem

The prior art adjusts the values beyond the standard representation to fixed values through image clipping, resulting in the loss of shadow details and highlight details of the image.

Method used

The first preset adjustment algorithm and the second preset adjustment algorithm respectively process the calculated values to ensure that the values are within the preset threshold range, and the shadow details and highlight details of the image are retained.

Benefits of technology

Effectively retains the shadow details and highlight details of the image, improving the accuracy of the image.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120378588A_ABST
    Figure CN120378588A_ABST
Patent Text Reader

Abstract

The invention provides a pixel channel adjustment method and device, equipment and a storage medium. The method comprises the following steps: acquiring a plurality of channels of a pixel point; each channel is provided with an initial value; for an initial numerical value, processing the initial numerical value based on a linear matrix to obtain a calculation numerical value; detecting the calculation value based on a first preset adjustment algorithm, and if the calculation value is smaller than a first preset threshold value, adjusting the calculation value based on a first preset curve to obtain a first intermediate value; the first intermediate value is larger than or equal to a first preset threshold value and smaller than or equal to a second preset threshold value; detecting the calculated value based on a second preset adjustment algorithm, and if the calculated value is greater than a second preset threshold, adjusting the calculated value based on a second preset curve to obtain a second intermediate value; and obtaining a target value based on the first intermediate value and the second intermediate value. According to the technical scheme of the invention, the editing can be prevented from exceeding the numerical value represented by the standard, so that the shadow details and highlight details of the image are reserved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of image processing technologies, and particularly relates to a pixel channel adjustment method, apparatus, device, and storage medium. Background Art

[0002] Currently, in the field of contemporary digital image processing, color space conversion, contrast optimization, and feature extraction constitute three core demand systems. Taking intelligent security as an example, color space conversion can achieve efficient segmentation of human skin tones; while industrial vision systems rely on enhanced contrast to highlight product surface defects. Among them, traditional technologies are based on linear superposition between channels of a linear matrix. For example, an affine transformation matrix is used to perform basic operations such as gamma correction and color balance. The inherent mathematical properties of the linear matrix determine that when the absolute value of an element of the transformation coefficient matrix is greater than 1, it will cause the value of the channel to exceed the range of the standard representation.

[0003] To solve the above overflow phenomenon, related technologies use image clipping technology to adjust the value exceeding the standard representation to two specific values, thereby limiting the value exceeding the standard representation within the range of the standard representation.

[0004] However, since the above image clipping method will adjust any value exceeding the standard representation to two specific values, it will cause the loss of differences brought by different values, and further cause the loss of shadow details and highlight details of the image. Summary of the Invention

[0005] An embodiment of this application provides a pixel channel adjustment method, which can avoid clipping values exceeding the standard representation, thereby retaining the shadow details and highlight details of the image. The technical solution is as follows:

[0006] According to the first aspect of the embodiments of this application, a pixel channel adjustment method is provided. The method includes:

[0007] Obtain multiple channels of a pixel point; each of the channels is provided with an initial value;

[0008] For an initial value, process the initial value based on a linear matrix to obtain a calculated value;

[0009] Detect the calculated value based on a first preset adjustment algorithm. If the calculated value is less than a first preset threshold, adjust the calculated value based on a first preset curve to obtain a first intermediate value; the first intermediate value is greater than or equal to the first preset threshold and less than or equal to a second preset threshold;

[0010] Detect the calculated value based on a second preset adjustment algorithm. If the calculated value is greater than a second preset threshold, adjust the calculated value based on a second preset curve to obtain a second intermediate value; the second intermediate value is greater than or equal to the first preset threshold and less than or equal to the second preset threshold.

[0011] Obtain a target value based on the first intermediate value and the second intermediate value.

[0012] In a possible implementation manner, the method further includes:

[0013] Detect the calculated value based on the first preset adjustment algorithm. If the calculated value is greater than or equal to the first preset threshold, do not adjust the calculated value and use the calculated value as the first intermediate value.

[0014] In a possible implementation manner, the method further includes:

[0015] Detect the calculated value based on the second preset adjustment algorithm. If the calculated value is less than or equal to the second preset threshold, do not adjust the calculated value and use the calculated value as the second intermediate value.

[0016] In a possible implementation manner, the method further includes:

[0017] For one pixel point, the pixel point includes an R channel, a G channel, and a B channel;

[0018] Obtain a first gain based on the second preset curve and the calculated value of the R channel; obtain a second gain based on the second preset curve and the calculated value of the G channel; obtain a third gain based on the second preset curve and the calculated value of the B channel;

[0019] Use the maximum value among the first gain, the second gain, and the third gain as the target gain.

[0020] In a possible implementation manner, the obtaining a first gain based on the second preset curve and the calculated value of the R channel includes:

[0021] Obtain a first function value based on the second preset curve and the calculated value of the R channel;

[0022] Obtain the first gain based on the first function value and the calculated value.

[0023] In a possible implementation manner, the method further includes:

[0024] Based on the target gain and the second intermediate value, a third intermediate value is obtained.

[0025] In a possible implementation, the obtaining the target value based on the first intermediate value and the second intermediate value includes:

[0026] Processing the initial value and the calculated value based on a first preset mapping relationship to obtain a first intensity coefficient;

[0027] Processing the initial value and the calculated value based on a second preset mapping relationship to obtain a second intensity coefficient;

[0028] Based on the first intermediate value and the first intensity coefficient, a first value is obtained; based on the third intermediate value and the second intensity coefficient, a second value is obtained;

[0029] Based on the sum of the first value and the second value, the target value is obtained.

[0030] In a possible implementation, the processing the initial value and the calculated value based on a first preset mapping relationship to obtain a first intensity coefficient includes:

[0031] Obtaining a difference result between the initial value and the calculated value;

[0032] Processing the difference result based on the first preset mapping relationship to obtain the first intensity coefficient.

[0033] In a possible implementation, the method further includes:

[0034] Processing the sum of the first value and the second value based on a preset processing algorithm to obtain the target value.

[0035] According to a second aspect of the embodiments of the present application, a pixel channel adjustment device is provided. The device includes:

[0036] An acquisition module, configured to acquire multiple channels of a pixel point; an initial value is set for each of the channels;

[0037] A first calculation module, configured to, for one of the initial values, process the initial value based on a linear matrix to obtain a calculated value;

[0038] A first adjustment module, configured to detect the calculated value based on a first preset adjustment algorithm. If the calculated value is less than a first preset threshold, adjust the calculated value based on a first preset curve to obtain a first intermediate value; the first intermediate value is greater than or equal to the first preset threshold and less than or equal to a second preset threshold;

[0039] A second adjustment module, configured to detect the calculated value based on a second preset adjustment algorithm. If the calculated value is greater than a second preset threshold, the calculated value is adjusted based on a second preset curve to obtain a second intermediate value; the second intermediate value is greater than or equal to the first preset threshold and less than or equal to the second preset threshold.

[0040] A second calculation module, configured to obtain a target value based on the first intermediate value and the second intermediate value.

[0041] According to a third aspect of the embodiments of the present application, there is provided a computer device, including a processor and a memory. The memory is used to store at least one segment of program, and the at least one segment of program is loaded and executed by the processor to perform the pixel channel adjustment method described above.

[0042] According to a fourth aspect of the embodiments of the present application, there is provided a computer-readable storage medium, in which at least one segment of program is stored, and the at least one segment of program is loaded and executed by a processor to implement the pixel channel adjustment method described above.

[0043] In the embodiments of the present application, there is provided a pixel channel adjustment method, including: obtaining multiple channels of a pixel point; each channel is provided with an initial value; for an initial value, processing the initial value based on a linear matrix to obtain a calculated value; detecting the calculated value based on a first preset adjustment algorithm. If the calculated value is less than a first preset threshold, the calculated value is adjusted based on a first preset curve to obtain a first intermediate value; the first intermediate value is greater than or equal to the first preset threshold and less than or equal to a second preset threshold; detecting the calculated value based on a second preset adjustment algorithm. If the calculated value is greater than the second preset threshold, the calculated value is adjusted based on a second preset curve to obtain a second intermediate value; the second intermediate value is greater than or equal to the first preset threshold and less than or equal to the second preset threshold; obtaining a target value based on the first intermediate value and the second intermediate value. The technical solution of the present application adjusts each calculated value that needs to be adjusted to the first intermediate value or the second intermediate value that still reflects the difference between the calculated values through the first preset adjustment algorithm or the second preset adjustment algorithm, rather than adjusting each calculated value that needs to be adjusted to two fixed values that cannot reflect the difference between the calculated values. Therefore, compared with the related art, the technical solution of the present application retains the difference between the calculated values, retains the shadow details and highlight details of the image, and thus ensures the image accuracy. Description of the Drawings

[0044] To more clearly illustrate the technical solutions in the embodiments of the present application, the following will briefly introduce the accompanying drawings required for the description of the embodiments. Obviously, the accompanying drawings in the following description are only some embodiments of the present application. For those of ordinary skill in the art, without creative efforts, other accompanying drawings can be obtained based on these drawings.

[0045] Figure 1 is a schematic diagram of an implementation environment provided according to an embodiment of the present application;

[0046] Figure 2 is a schematic flowchart of an image editing process provided by the related art;

[0047] Figure 3 is a schematic flowchart of a pixel channel adjustment method provided according to an embodiment of the present application;

[0048] Figure 4 is a schematic diagram of a first preset curve provided according to an embodiment of the present application;

[0049] Figure 5 is a schematic diagram of a second preset curve provided according to an embodiment of the present application;

[0050] Figure 6 is an exemplary flowchart of a pixel adjustment method provided according to an embodiment of the present application;

[0051] Figure 7 is a schematic structural diagram of a pixel channel adjustment device provided according to an embodiment of the present application;

[0052] Figure 8 is a schematic structural diagram of a terminal provided according to an embodiment of the present application;

[0053] Figure 9 is a schematic structural diagram of a server provided according to an embodiment of the present application. Specific Embodiments

[0054] To make the objectives, technical solutions, and advantages of the present application clearer, the following will further describe the embodiments of the present application in detail with reference to the accompanying drawings.

[0055] Here, the exemplary embodiments will be described in detail, and the examples are shown in the accompanying drawings. When the following description refers to the accompanying drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The implementation manners described in the following exemplary embodiments do not represent all implementation manners consistent with the present application.

[0056] In this application, terms such as "first" and "second" are used to distinguish identical or similar items with basically the same functions and effects. It should be understood that there is no logical or chronological dependency among "first", "second", and "nth", nor are the quantity and execution order limited. It should also be understood that although the following description uses terms like first and second to describe various elements, these elements should not be restricted by the terms.

[0057] These terms are only used to distinguish one element from another. For example, without departing from the scope of various examples, a first action can be referred to as a second action, and similarly, a second action can also be referred to as a first action. Both the first action and the second action can be actions, and in some cases, they can be separate and different actions.

[0058] Herein, "at least one" means one or more than one. For example, at least one action can be one action, two actions, three actions, etc., any integer greater than or equal to one. And "a plurality of" means two or more than two. For example, a plurality of actions can be two actions, three actions, etc., any integer greater than or equal to two.

[0059] Figure 1 It is a schematic diagram of an implementation environment provided according to an embodiment of this application. This implementation environment may include a terminal 101 and a server 102.

[0060] In the terminal 101, a pixel channel adjustment device is provided. The device performs low-light protection on the initial value of the channel through a first preset adjustment algorithm; and performs high-light protection on the initial value of the channel through a second preset adjustment algorithm, so as to retain the shadow details and high-light details of the image. For example, the terminal 101 can be a smart phone with a pixel channel adjustment device, a wearable device, a personal computer, a laptop computer, a tablet computer, a smart TV, a vehicle-mounted terminal, etc.

[0061] The server 102 can be a single server, a server cluster composed of multiple servers, or, alternatively, a cloud processing center.

[0062] The terminal 101 is connected to the server 102 through a wired or wireless network.

[0063] In some embodiments, a wireless network or a wired network uses standard communication technologies and / or protocols. The network is typically the Internet, but can also be any network, including but not limited to any combination of a local area network (LAN), a metropolitan area network (MAN), a wide area network (WAN), a mobile, wired or wireless network, a private network or a virtual private network. In some embodiments, technologies and / or formats including Hyper Text Mark-up Language (HTML), Extensible Markup Language (XML), etc. are used to represent data exchanged through the network. Additionally, conventional encryption technologies such as Secure Socket Layer (SSL), Transport Layer Security (TLS), Virtual Private Network (VPN), Internet Protocol Security (IPsec), etc. can be used to encrypt all or some of the links. In other embodiments, customized and / or proprietary data communication technologies can be used to replace or supplement the above data communication technologies.

[0064] Figure 2 FIG. is a schematic flowchart of an image clipping process provided by the related art.

[0065] The following Figure 2 exemplarily illustrates the image clipping in the related art.

[0066] In the related art, after processing the initial values of the channels of pixels based on a linear transformation, the problem of the obtained calculated values exceeding the standard representation may occur. To solve this problem, through image clipping, the values exceeding the standard representation are forcibly truncated or adjusted, that is, the values within the range exceeding the standard representation are limited within the range of the standard representation, and then processed with the gamma algorithm to obtain the target values, so as to ensure that the image data meets the requirements of subsequent processing or display devices and prevent distortion or errors caused by numerical overflow or underflow. Optionally, the range of the standard representation is 0 to 255. For example, when the value is 300, after image clipping, the value becomes 255; when the value is -3, after image clipping, the value becomes 0; when the value is 400, after image clipping, the value becomes 255; when the value is -8, after image clipping, the value becomes 0.

[0067] As can be seen from the above analysis, in the related art, the image clipping adjusts both the values 300 and 400 to 255, and adjusts both the values (-8) and (-3) to 0. This will result in the loss of the difference between the values 300 and 400, and also the loss of the difference between the values (-8) and (-3), thereby leading to the loss of the shadow details and highlight details of the image, resulting in a reduction in the accuracy of the image, and further leading to the loss of some effective information, and even causing a series of security problems in the related technical fields. For example, in the field of autonomous driving.

[0068] To solve the above technical problems, an embodiment of the present application provides a pixel channel adjustment method for adjusting the initial value of each channel of each pixel point of an image. Specifically, the initial value of each channel of a pixel point is processed by a linear matrix to obtain a calculated value for each channel, and then the calculated value of each channel of the pixel point is adjusted by a first preset adjustment algorithm to obtain a first intermediate value, and the calculated value of each channel of the pixel point is adjusted by a second preset adjustment algorithm to obtain a second intermediate value. Wherein, the first intermediate value and the second intermediate value fall between a first preset threshold and a second preset threshold. Compared with the related art that adjusts any value not between 0 and 255 to 0 or 255, the embodiment of the present application can uniquely map different initial values to corresponding first intermediate values or second intermediate values, so that the first intermediate value and the second intermediate value retain the relative magnitude between the initial values, and retain the shadow details and highlight details of the image.

[0069] Figure 3 It is a schematic flowchart of a pixel channel adjustment method provided by an embodiment of the present application. As Figure 3 shown, in the embodiment of the present application, taking an application to a terminal with a pixel adjustment device as an example for illustration. The method includes the following steps:

[0070] In step 301, the terminal obtains multiple channels of a pixel point; each channel is provided with an initial value.

[0071] Among them, the terminal performs pixel channel adjustment pixel by pixel. The initial value of each channel represents brightness or intensity. Optionally, the larger the initial value, the greater the brightness or intensity. The smaller the initial value, the smaller the brightness or intensity. Optionally, a pixel point includes 3 channels. For example, the 3 channels are the R channel, the G channel, and the B channel respectively. Among them, the R channel represents the red channel, and the initial value of the R channel represents the intensity of red. The G channel represents the green channel, and the initial value of the G channel represents the intensity of green. The B channel represents the blue channel, and the initial value of the B channel represents the intensity of blue.

[0072] In step 302, for an initial value, the terminal processes the initial value based on a linear matrix to obtain a calculated value.

[0073] In some embodiments, for a pixel, the terminal processes the initial values of each channel of the pixel in parallel based on a linear matrix to obtain the calculated values of each channel. Optionally, the linear matrix is implemented in various forms. For example, a 3×3 matrix is selected to process the initial values of each channel to obtain the calculated values of each channel, thereby controlling the mixing ratio between each channel, and further meeting the requirements of complex color adjustment.

[0074] In step 303, the terminal detects the calculated value based on a first preset adjustment algorithm. If the calculated value is less than the first preset threshold, the calculated value is adjusted based on a first preset curve to obtain a first intermediate value.

[0075] Wherein, the first intermediate value is greater than or equal to the first preset threshold and less than or equal to the second preset threshold. For example, the first preset threshold is 0 and the second preset threshold is 255.

[0076] In some embodiments, the terminal detects the calculated value based on a first preset adjustment algorithm. If the calculated value is greater than or equal to the first preset threshold, the calculated value is not adjusted and is used as the first intermediate value.

[0077] In one example, the terminal detects the calculated value based on a first preset adjustment algorithm, compares the calculated value with 0. If the calculated value is greater than or equal to 0, the calculated value is not adjusted; if the calculated value is less than 0, the calculated value is adjusted.

[0078] It should be understood that the first preset adjustment algorithm is implemented based on a first preset function. Optionally, the first preset function is implemented in various forms. For example, the first preset function is a piecewise function. Such a setting is because when the calculated value is greater than or equal to 0 and less than or equal to 255, there is no need for adjustment, while when the calculated value is not between 0 and 255, adjustment is required. Therefore, the first preset function requires two different function implementations.

[0079] Figure 4 It is a schematic diagram of a first preset curve provided according to an embodiment of the present application.

[0080] The following combines Figure 4 to give an exemplary illustration of the first preset adjustment algorithm.

[0081] In some embodiments, the abscissa of the first preset curve is a calculated value, and the ordinate is a first intermediate value. When the abscissa is greater than or equal to 0, the first preset function is represented by y = x; where y represents the first intermediate value and x represents the calculated value. That is, when the calculated value is greater than or equal to 0, there is no need to adjust the calculated value, and the calculated value is directly used as the first intermediate value. When the abscissa is less than 0, the first preset function is represented by y = kx, where k represents the coefficient of the first preset function, k is greater than 0 and less than 1. That is, when the calculated value is less than 0, the calculated value needs to be mapped to the first intermediate value through the first preset function. In this case, the first intermediate value is equal to (k × calculated value). Through the above analysis, it can be seen that the low-light protection of the channel is achieved based on the first preset curve, that is, the shadow details are protected.

[0082] It should be noted that when the abscissa is less than 0, the first preset function is not only represented as a linear function, but can also be set as a non-linear function according to actual needs. Among them, the non-linear function can be implemented in various forms, and the embodiments of the present application do not make specific limitations on this.

[0083] In step 304, the terminal detects the calculated value based on the second preset adjustment algorithm. If the calculated value is greater than the second preset threshold, the calculated value is adjusted based on the second preset curve to obtain a second intermediate value.

[0084] Among them, the second intermediate value is greater than or equal to the first preset threshold and less than or equal to the second preset threshold.

[0085] In some embodiments, when detecting the calculated value based on the second preset adjustment algorithm, if the calculated value is less than or equal to the second preset threshold, the calculated value is not adjusted and is used as the second intermediate value.

[0086] In an example, the terminal detects the calculated value based on the second preset adjustment algorithm, compares the calculated value with 255. If the calculated value is less than or equal to 255, the calculated value is not adjusted; if the calculated value is greater than 255, the calculated value is adjusted.

[0087] It should be understood that the second preset adjustment algorithm is implemented based on the second preset function. Optionally, the second preset function is implemented in various forms. For example, the second preset function is a piecewise function. Such a setting is because when the calculated value is greater than or equal to 0 and less than or equal to 255, there is no need to adjust, and when the calculated value is not between 0 and 255, adjustment is required. Therefore, the second preset function requires two different function implementations.

[0088] Figure 5 It is a schematic diagram of a second preset curve provided according to an embodiment of the present application.

[0089] The following combines Figure 5 to give an exemplary description of the second preset adjustment algorithm.

[0090] In some embodiments, the abscissa of the second preset curve is the calculated value, and the ordinate is the second intermediate value. When the abscissa is greater than or equal to 0, the second preset function is represented by y = x; where y represents the second intermediate value and x represents the calculated value, that is, when the calculated value is less than or equal to 0, there is no need to adjust the calculated value, and the calculated value is directly used as the first intermediate value. When the abscissa is greater than 255, the second preset function is represented by y = bx, where k represents the coefficient of the second preset function, b is greater than 0 and less than 1. That is, when the calculated value is greater than 255, the calculated value needs to be mapped to the second intermediate value through the second preset function. In this case, the second intermediate value is equal to (b × calculated value). From the above analysis, it can be seen that the second preset curve realizes the highlight protection of each channel, that is, it protects the highlight details.

[0091] It should be noted that when the abscissa is greater than 255, the second preset function is not only represented as a linear function, but can also be set as a non-linear function according to actual needs. Among them, the non-linear function can be implemented in various forms, and the embodiments of the present application do not make specific limitations on this.

[0092] It should be noted that there are various execution orders for steps 303 and 304. For example, step 303 is executed first, and then step 304. Or step 304 is executed first, and then step 303. Or steps 303 and 304 are executed in parallel.

[0093] In step 305, the terminal obtains the target value based on the first intermediate value and the second intermediate value.

[0094] Figure 6 is an exemplary flowchart of the pixel adjustment method provided by the embodiments of the present application.

[0095] The following combines Figure 6 to give an exemplary description of the pixel adjustment method.

[0096] In some embodiments, for a pixel point, the pixel point includes an R channel, a G channel, and a B channel; based on the second preset curve and the calculated value of the R channel, the first gain is obtained; based on the second preset curve and the calculated value of the G channel, the second gain is obtained; based on the second preset curve and the calculated value of the B channel, the third gain is obtained; and the maximum value among the first gain, the second gain, and the third gain is used as the target gain.

[0097] It should be understood that for a pixel point, after performing highlight protection on the R channel, G channel, and B channel of the pixel point, an incoordination problem may occur among the obtained respective second intermediate values. Therefore, it is necessary to calculate the target gain for the channels to solve the incoordination problem. Among them, the incoordination problem can be understood as the problem that the difference between the respective second intermediate values is too large.

[0098] In some embodiments, the terminal obtains a first gain based on a second preset curve and the calculated value of the R channel, which can be implemented through the following implementation manner:

[0099] The terminal obtains a first function value based on the second preset curve and the calculated value of the R channel; and obtains a first gain based on the first function value and the calculated value.

[0100] In an example, the second function value is the value obtained by mapping the calculated value of the R channel to the second preset curve through a second preset function. The first gain is the quotient of the first function value and the calculated value of the R channel. For example, the first function value = the calculated value of the R channel × b. The first gain = the first function value / the calculated value of the R channel.

[0101] In some embodiments, the terminal obtains a second gain based on a second preset curve and the calculated value of the G channel, which can be implemented through the following implementation manner:

[0102] The terminal obtains a second function value based on the second preset curve and the calculated value of the G channel; and obtains a second gain based on the second function value and the calculated value.

[0103] In an example, the second function value is the value obtained by mapping the calculated value of the G channel to the second preset curve through a second preset function. The second gain is the quotient of the second function value and the calculated value of the G channel. For example, the second function value = the calculated value of the G channel × b. The second gain = the second function value / the calculated value of the G channel.

[0104] In some embodiments, the terminal obtains a third gain based on a second preset curve and the calculated value of the B channel, which can be implemented through the following implementation manner:

[0105] The terminal obtains a third function value based on the second preset curve and the calculated value of the B channel; and obtains a third gain based on the second function value and the calculated value.

[0106] In an example, the third function value is the value obtained by mapping the calculated value of the B channel to the second preset curve through a second preset function. The third gain is the quotient of the third function value and the calculated value of the B channel. For example, the third function value = the calculated value of the B channel × b. The third gain = the third function value / the calculated value of the B channel.

[0107] In some embodiments, the terminal obtains a third intermediate value based on the target gain and the second intermediate value.

[0108] In one example, for the R channel, the terminal obtains the third intermediate value of the R channel based on the target gain and the second intermediate value of the R channel. For example, the third intermediate value of the R channel = target gain × the second intermediate value of the R channel.

[0109] In one example, for the G channel, the terminal obtains the third intermediate value of the G channel based on the target gain and the second intermediate value of the G channel. For example, the third intermediate value of the G channel = target gain × the second intermediate value of the G channel.

[0110] In one example, for the B channel, the terminal obtains the third intermediate value of the B channel based on the target gain and the second intermediate value of the B channel. For example, the third intermediate value of the B channel = target gain × the second intermediate value of the B channel.

[0111] In some embodiments, the terminal obtains the target value based on the first intermediate value and the second intermediate value, which can be implemented as follows: The terminal processes the initial value and the calculated value based on the first preset mapping relationship to obtain the first intensity coefficient; the terminal processes the initial value and the calculated value based on the second preset mapping relationship to obtain the second intensity coefficient; the terminal obtains the first value based on the first intermediate value and the first intensity coefficient; obtains the second value based on the third intermediate value and the second intensity coefficient; the terminal obtains the target value based on the sum of the first value and the second value. For example, the first value = the first intermediate value × the first intensity coefficient; the second value = the third intermediate value × the second intensity coefficient; the target value = the first value + the second value. By using the intensity coefficient, the first intermediate value protected by low light and the third intermediate value protected by high light are weighted and summed, so as to obtain the target value of one channel. The target value obtained in this way not only realizes low light protection but also high light protection, so that the target value falls between 0 and 255. Moreover, the target value also retains the shadow details and the highlight details.

[0112] Optionally, the first preset mapping relationship, the second preset mapping relationship, and the third preset mapping relationship are implemented based on multiple implementation manners. For example: The first preset mapping relationship, the second preset relationship, and the third preset mapping relationship are all linear mapping relationships. The linear mapping relationship is simple and direct, and has a linear response, which is suitable for rapid prototype verification. Or the first preset mapping relationship, the second preset mapping relationship, and the third preset mapping relationship are all non-linear mapping relationships. The exponential decay mapping relationship emphasizes small differences and ignores large deviations, and is suitable for night scene enhancement. Or the first intensity coefficient and the second intensity coefficient are obtained by looking up a table. It should be noted that the linear mapping relationship, the non-linear mapping relationship, and the table involved in this application can all be directly obtained from related technologies, and the embodiments of this application will not be elaborated further.

[0113] In one example, the terminal processes the initial value and the calculated value based on the first preset mapping relationship to obtain the first intensity coefficient, which can be implemented by the following implementation manner: Obtain the difference result of the initial value and the calculated value; Process the difference result based on the first preset mapping relationship to obtain the first intensity coefficient. Optionally, the difference result is implemented based on multiple implementation manners. For example, any one of direct difference, absolute difference, or normalized difference.

[0114] Similarly, the second intensity coefficient can be obtained, and details will not be elaborated further.

[0115] In some embodiments, the terminal processes the sum of the first value and the second value based on a preset processing algorithm to obtain a target value. Optionally, the preset processing algorithm is implemented based on multiple implementation manners. For example, the terminal processes the sum of the first value and the second value based on the gamma algorithm to obtain the target value, so that the image better conforms to the perceptual characteristics of the human eye.

[0116] It should be noted that applying the above method to the terminal is only one of the embodiments. In addition, the method involved in this application can also be applied to a server, and details will not be specifically elaborated herein.

[0117] Embodiments of the present application provide a pixel channel adjustment method, which includes: obtaining multiple channels of a pixel point; each channel has an initial value; for an initial value, processing the initial value based on a linear matrix to obtain a calculated value; detecting the calculated value based on a first preset adjustment algorithm, if the calculated value is less than a first preset threshold, then adjusting the calculated value based on a first preset curve to obtain a first intermediate value; the first intermediate value is greater than or equal to the first preset threshold and less than or equal to a second preset threshold; detecting the calculated value based on a second preset adjustment algorithm, if the calculated value is greater than the second preset threshold, then adjusting the calculated value based on a second preset curve to obtain a second intermediate value; the second intermediate value is greater than or equal to the first preset threshold and less than or equal to the second preset threshold; obtaining a target value based on the first intermediate value and the second intermediate value. The technical solution of the present application adjusts each calculated value to be adjusted to the first intermediate value or the second intermediate value that still reflects the difference between the calculated values through the first preset adjustment algorithm or the second preset adjustment algorithm, rather than adjusting each calculated value to be adjusted to two fixed values that cannot reflect the difference between the calculated values. Therefore, compared with the related art, the technical solution of the present application retains the difference between the calculated values, retains the shadow details and highlight details of the image, and thus ensures the image accuracy.

[0118] Figure 7 FIG. 4 is a schematic structural diagram of a pixel channel adjustment device 700 according to an embodiment of the present application. The device includes:

[0119] An acquisition module 701, configured to obtain multiple channels of a pixel point; each channel has an initial value;

[0120] A first calculation module 702, configured to process an initial value based on a linear matrix for an initial value to obtain a calculated value;

[0121] A first adjustment module 703, configured to detect the calculated value based on a first preset adjustment algorithm, if the calculated value is less than a first preset threshold, then adjust the calculated value based on a first preset curve to obtain a first intermediate value; the first intermediate value is greater than or equal to the first preset threshold and less than or equal to a second preset threshold;

[0122] A second adjustment module 704, configured to detect the calculated value based on a second preset adjustment algorithm, if the calculated value is greater than the second preset threshold, then adjust the calculated value based on a second preset curve to obtain a second intermediate value; the second intermediate value is greater than or equal to the first preset threshold and less than or equal to the second preset threshold;

[0123] A second calculation module 705, configured to obtain a target value based on the first intermediate value and the second intermediate value.

[0124] In some embodiments, the device is further configured to:

[0125] Detect the calculated value based on the first preset adjustment algorithm. If the calculated value is greater than or equal to the first preset threshold, do not adjust the calculated value and use the calculated value as the first intermediate value.

[0126] In some embodiments, the device is further configured to:

[0127] Detect the calculated value based on the second preset adjustment algorithm. If the calculated value is less than or equal to the second preset threshold, do not adjust the calculated value and use the calculated value as the second intermediate value.

[0128] In some embodiments, the device is further configured to:

[0129] For a pixel point, the pixel point includes an R channel, a G channel, and a B channel;

[0130] Based on the second preset curve and the calculated value of the R channel, obtain a first gain; based on the second preset curve and the calculated value of the G channel, obtain a second gain; based on the second preset curve and the calculated value of the B channel, obtain a third gain;

[0131] Use the maximum value among the first gain, the second gain, and the third gain as the target gain.

[0132] In some embodiments, obtaining a first gain based on the second preset curve and the calculated value of the R channel includes:

[0133] Based on the second preset curve and the calculated value of the R channel, obtain a first function value;

[0134] Based on the first function value and the calculated value, obtain the first gain.

[0135] In some embodiments, the device is further configured to:

[0136] Based on the target gain and the second intermediate value, obtain a third intermediate value.

[0137] In some embodiments, obtaining a target value based on the first intermediate value and the second intermediate value includes:

[0138] Process the initial value and the calculated value based on the first preset mapping relationship to obtain a first intensity coefficient;

[0139] Process the initial value and the calculated value based on the second preset mapping relationship to obtain a second intensity coefficient;

[0140] Based on the first intermediate value and the first intensity coefficient, obtain a first value; based on the third intermediate value and the second intensity coefficient, obtain a second value;

[0141] Based on the sum of the first value and the second value, obtain the target value.

[0142] In some embodiments, processing the initial value and the calculated value based on the first preset mapping relationship to obtain a first intensity coefficient includes:

[0143] Obtaining a difference result between the initial value and the calculated value;

[0144] Processing the difference result based on the first preset mapping relationship to obtain the first intensity coefficient.

[0145] In some embodiments, processing the sum of a first value and a second value based on a preset processing algorithm to obtain a target value.

[0146] It should be noted that when the pixel channel adjustment device provided in the above embodiments executes the corresponding steps, only the division of the above function modules is used as an example. In actual applications, the above functions can be allocated to different function modules according to needs, that is, the internal structure of the device is divided into different function modules to complete all or part of the functions described above. In addition, the pixel channel adjustment device provided in the above embodiments and the embodiments of the pixel channel adjustment method belong to the same concept. For the specific implementation process, please refer to the method embodiments and will not be elaborated here.

[0147] In an embodiment of the present application, for a pixel channel adjustment method, multiple channels of a pixel point are obtained; each channel is provided with an initial value; for an initial value, the initial value is processed based on a linear matrix to obtain a calculated value; the calculated value is detected based on a first preset adjustment algorithm. If the calculated value is less than a first preset threshold, the calculated value is adjusted based on a first preset curve to obtain a first intermediate value; the first intermediate value is greater than or equal to the first preset threshold and less than or equal to a second preset threshold; the calculated value is detected based on a second preset adjustment algorithm. If the calculated value is greater than the second preset threshold, the calculated value is adjusted based on a second preset curve to obtain a second intermediate value; the second intermediate value is greater than or equal to the first preset threshold and less than or equal to the second preset threshold; a target value is obtained based on the first intermediate value and the second intermediate value. The technical solution of the present application adjusts each calculated value to be adjusted to the first intermediate value or the second intermediate value that still reflects the difference between the calculated values through the first preset adjustment algorithm or the second preset adjustment algorithm, rather than adjusting each calculated value to be adjusted to two fixed values that cannot reflect the difference between the calculated values. Therefore, compared with the related art, the technical solution of the present application retains the difference between the calculated values, retains the shadow details and highlight details of the image, and thus ensures the image accuracy.

[0148] Embodiments of the present application also provide a computer device, including a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor. When the processor executes the computer program, the above method is implemented.

[0149] Taking the computer device as an example of a terminal, Figure 8 is a schematic structural diagram of a terminal provided by an embodiment of the present application. Refer to Figure 8 , the terminal 800 may be: a smart phone, a tablet computer, an MP3 player (Moving Picture Experts Group Audio Layer III), an MP4 (Moving Picture Experts Group Audio Layer IV) player, a notebook computer or a desktop computer. The terminal 800 may also be referred to by other names such as a user equipment, a portable terminal, a laptop terminal, a desktop terminal, etc.

[0150] Generally, the terminal 800 includes: a processor 801 and a memory 802.

[0151] The processor 801 may include one or more processing cores, such as a 4-core processor, a 5-core processor, etc. The processor 801 may be implemented in at least one hardware form of DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), and PLA (Programmable Logic Array). The processor 801 may also include a main processor and a coprocessor. The main processor is a processor for processing data in the wake state, also known as the CPU (Central Processing Unit); the coprocessor is a low-power processor for processing data in the standby state. In some embodiments, the processor 801 may be integrated with a GPU (Graphics Processing Unit), and the GPU is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 801 may also include an AI (Artificial Intelligence) processor, and the AI processor is used to process computational operations related to machine learning.

[0152] The memory 802 may include one or more computer-readable storage media, which may be non-transitory. The memory 802 may further include high-speed random access memory, as well as non-volatile memory, such as one or more magnetic disk storage devices, flash storage devices. In some embodiments, the non-transitory computer-readable storage media in the memory 802 is used to store at least one program code, and the at least one program code is used to be executed by the processor 801 to implement the process executed by the terminal in the method provided in the method embodiments of the present application for the above-mentioned method.

[0153] In some embodiments, the terminal 800 may further optionally include: a peripheral device interface 803 and at least one peripheral device. The processor 801, the memory 802, and the peripheral device interface 803 may be connected through a bus or signal lines. Each peripheral device may be connected to the peripheral device interface 803 through a bus, signal lines, or a circuit board. Specifically, the peripheral device includes at least one of a display screen 804, a camera assembly 805, an audio circuit 806, and a power supply 807.

[0154] The peripheral device interface 803 may be used to connect at least one peripheral device related to I / O (Input / Output) to the processor 801 and the memory 802. In some embodiments, the processor 801, the memory 802, and the peripheral device interface 803 are integrated on the same chip or circuit board; in some other embodiments, any one or two of the processor 801, the memory 802, and the peripheral device interface 803 may be implemented on a separate chip or circuit board, and the embodiments of the present application do not limit this.

[0155] The display screen 804 is used to display the UI (User Interface). The UI may include graphics, text, icons, videos, and any combination thereof. When the display screen 804 is a touch display screen, the display screen 804 also has the ability to collect touch signals on or above the surface of the display screen 804. The touch signals can be input as control signals to the processor 801 for processing. At this time, the display screen 804 can also be used to provide virtual buttons and / or a virtual keyboard, also known as soft buttons and / or a soft keyboard. In some embodiments, there can be one display screen 804, which is provided on the front panel of the terminal 800; in other embodiments, there can be at least two display screens 804, which are respectively provided on different surfaces of the terminal 800 or are in a foldable design; in other embodiments, the display screen 804 can be a flexible display screen, which is provided on the curved surface or the folding surface of the terminal 800. Even further, the display screen 804 can be set to an irregular non-rectangular shape, that is, a special-shaped screen. The display screen 804 can be prepared using materials such as LCD (Liquid Crystal Display) and OLED (Organic Light-Emitting Diode).

[0156] The camera module 805 is used to capture images or videos. In some embodiments, the camera module 805 includes a front camera and a rear camera. Generally, the front camera is provided on the front panel of the terminal, and the rear camera is provided on the back of the terminal. In some embodiments, there are at least two rear cameras, which can be any one of a main camera, a depth-of-field camera, a wide-angle camera, and a telephoto camera, so as to implement functions such as the combination of the main camera and the depth-of-field camera to achieve the background blurring function, the combination of the main camera and the wide-angle camera to achieve panoramic shooting and VR (Virtual Reality) shooting functions, or other combined shooting functions. In some embodiments, the camera module 805 can also include a flash. The flash can be a single-color-temperature flash or a two-color-temperature flash. A two-color-temperature flash refers to the combination of a warm-light flash and a cold-light flash, which can be used for light compensation under different color temperatures.

[0157] The audio circuit 806 may include a microphone and a speaker. The microphone is used to collect sound waves of the user and the environment, and convert the sound waves into electrical signals for input to the processor 801 for processing. For the purpose of stereo collection or noise reduction, there may be multiple microphones, which are respectively arranged at different parts of the terminal 800. The microphone may also be an array microphone or an omnidirectional collection microphone. The speaker is used to convert the electrical signals from the processor 801 into sound waves. The speaker may be a traditional thin-film speaker or a piezoelectric ceramic speaker. When the speaker is a piezoelectric ceramic speaker, it can not only convert electrical signals into audible sound waves for humans, but also convert electrical signals into inaudible sound waves for uses such as ranging. In some embodiments, the audio circuit 806 may further include a headphone jack.

[0158] The power supply 807 is used to supply power to each component in the terminal 800. The power supply 807 may be alternating current, direct current, a disposable battery or a rechargeable battery. When the power supply 807 includes a rechargeable battery, the rechargeable battery may support wired charging or wireless charging. The rechargeable battery may also be used to support fast charging technology.

[0159] Those skilled in the art can understand that Figure 8 the structure shown in

[0160] does not limit the terminal 80. It may include more or fewer components than shown in the figure, or combine certain components, or adopt different component arrangements. Figure 9 Taking the computer device as a server as an example,

[0161] Embodiments of the present application also provide a computer-readable storage medium. The computer-readable storage medium includes a stored computer program, wherein when the computer program runs, it controls the device where the computer-readable storage medium is located to execute the method described above. Optionally, the computer-readable storage medium may be a read-only memory (ROM), a random access memory (RAM), a compact disc read-only memory (CD-ROM), a magnetic tape, a floppy disk, an optical data storage device, etc.

[0162] Those of ordinary skill in the art can understand that all or part of the steps for implementing the above embodiments can be completed by hardware, or can be completed by a program instructing relevant hardware. The program can be stored in a computer-readable storage medium. The storage medium mentioned above can be a read-only memory, a magnetic disk, an optical disc, etc.

[0163] The above are only optional embodiments of the present application and are not intended to limit the present application. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present application shall be included within the protection scope of the present application.

Claims

1. A pixel channel adjustment method, characterized in that, Including: Obtaining multiple channels of a pixel point; Each of the said channels is provided with an initial value; For one of the said initial values, processing the initial value based on a linear matrix to obtain a calculated value; Detecting the calculated value based on a first preset adjustment algorithm. If the calculated value is less than a first preset threshold, then adjusting the calculated value based on a first preset curve to obtain a first intermediate value; the first intermediate value is greater than or equal to the first preset threshold and less than or equal to a second preset threshold; Detecting the calculated value based on a second preset adjustment algorithm. If the calculated value is greater than the second preset threshold, then adjusting the calculated value based on a second preset curve to obtain a second intermediate value; the second intermediate value is greater than or equal to the first preset threshold and less than or equal to the second preset threshold; Obtaining a target value based on the first intermediate value and the second intermediate value.

2. The method according to claim 1, wherein The method further includes: Detecting the calculated value based on the first preset adjustment algorithm. If the calculated value is greater than or equal to the first preset threshold, then not adjusting the calculated value and taking the calculated value as the first intermediate value.

3. The method according to claim 1, wherein The method further includes: Detecting the calculated value based on the second preset adjustment algorithm. If the calculated value is less than or equal to the second preset threshold, then not adjusting the calculated value and taking the calculated value as the second intermediate value.

4. The method according to claim 1, characterized in that, The method further includes: For one of the said pixel points, the pixel point includes an R channel, a G channel, and a B channel; Based on the second preset curve and the calculated value of the R channel, obtaining a first gain; based on the second preset curve and the calculated value of the G channel, obtaining a second gain; based on the second preset curve and the calculated value of the B channel, obtaining a third gain; Taking the maximum value among the first gain, the second gain, and the third gain as the target gain.

5. The method according to claim 4, wherein The obtaining the first gain based on the second preset curve and the calculated value of the R channel includes: Based on the second preset curve and the calculated value of the R channel, obtaining a first function value; Based on the first function value and the calculated value, obtaining the first gain.

6. The method according to claim 4, characterized in that, The method further includes: Based on the target gain and the second intermediate value, obtaining a third intermediate value.

7. The method according to claim 6, characterized in that, The obtaining the target value based on the first intermediate value and the second intermediate value includes: Processing the initial value and the calculated value based on a first preset mapping relationship to obtain a first intensity coefficient; Processing the initial value and the calculated value based on a second preset mapping relationship to obtain a second intensity coefficient; Based on the first intermediate value and the first intensity coefficient, obtaining a first value; based on the third intermediate value and the second intensity coefficient, obtaining a second value; Based on the sum of the first value and the second value, obtaining the target value.

8. The method according to claim 7, wherein The processing the initial value and the calculated value based on a first preset mapping relationship to obtain a first intensity coefficient includes: Obtaining a difference result between the initial value and the calculated value; Process the difference result based on the first preset mapping relationship to obtain the first intensity coefficient.

9. The method according to claim 8, wherein The method further includes: Process the sum of the first value and the second value based on a preset processing algorithm to obtain the target value.

10. A pixel channel adjustment device, characterized in that, It includes: An acquisition module, configured to acquire multiple channels of a pixel point; Each of the channels is provided with an initial value; A first calculation module, configured to process the initial value based on a linear matrix for one of the initial values to obtain a calculated value; A first adjustment module, configured to detect the calculated value based on a first preset adjustment algorithm. If the calculated value is less than a first preset threshold, adjust the calculated value based on a first preset curve to obtain a first intermediate value; the first intermediate value is greater than or equal to the first preset threshold and less than or equal to a second preset threshold; A second adjustment module, configured to detect the calculated value based on a second preset adjustment algorithm. If the calculated value is greater than the second preset threshold, adjust the calculated value based on a second preset curve to obtain a second intermediate value; the second intermediate value is greater than or equal to the first preset threshold and less than or equal to the second preset threshold; A second calculation module, configured to obtain a target value based on the first intermediate value and the second intermediate value.

11. A computer device, characterized in that, The computer device includes a processor and a memory. The memory is used to store at least one segment of program, and the at least one segment of program is loaded and executed by the processor to perform the pixel channel adjustment method according to any one of claims 1 to 9.

12. A computer-readable storage medium, characterized in that, At least one segment of program is stored in the computer-readable storage medium, and the at least one segment of program is loaded and executed by a processor to implement the pixel channel adjustment method according to any one of claims 1 to 9.

Citation Information

Patent Citations

  • Image brightness adjustment method and device, storage medium and electronic device

    CN110120021A

  • Method and device for adjusting image brightness, chip, medium and camera equipment

    CN112911166A

  • Image processing method and device, electronic equipment and storage medium

    CN115330610A

  • Image processing method and electronic equipment

    CN117133252A

  • Color shading correction method, terminal device, and computer-readable storage medium

    WO2021143281A1