Pixel channel adjustment method, device, equipment and storage medium

CN120378588BActive Publication Date: 2026-10-20AXERA SEMICON (SHANGHAI) CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202510578704.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-05-06
Publication Date
2026-10-20
Estimated Expiration
2045-05-06

AI Technical Summary

Technical Problem

[0004]但是,由于上述图像剪辑的方法会将超出标准表示的数值任意一个数值调整为某两个具体数值,从而会导致不同数值带来的差异丢失,进而导致图像的阴影细节和高光细节丢失

Benefits of technology

[0043]在本申请实施例中,提供了一种像素通道调整方法,获取一个像素点的多个通道;每个通道设有初始数值;针对一个初始数值,基于线性矩阵处理初始数值,得到计算数值;基于第一预设调整算法检测计算数值,若计算数值小于第一预设阈值,则基于第一预设曲线调整计算数值,得到第一中间数值;第一中间数值大于或等于第一预设阈值,且小于或等于第二预设阈值;基于第二预设调整算法检测计算数值,若计算数值大于第二预设阈值,则基于第二预设曲线调整计算数值,得到第二中间数值;第二中间数值大于或等于第一预设阈值,且小于或等于第二预设阈值;基于第一中间数值以及第二中间数值,得到目标数值。本申请的技术方案,通过第一预设调整算法或第二预设调整算法将每个需要调整的计算数值,分别调整至仍然体现计算数值之间差异的第一中间数值或第二中间数值,而不是将每个需要调整的计算数值均调整为无法体现计算数值之间差异的某两个固定的数值,从而相比于相关技术,本申请的技术方案通过保留计算数值之间的差异,保留了图像的阴影细节以及高光细节,从而保证了图像精度。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120378588B_ABST
    Figure CN120378588B_ABST
Patent Text Reader

Abstract

The application provides a pixel channel adjustment method, device, equipment and storage medium. The method comprises the following steps: obtaining a plurality of 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 calculation value; detecting the calculation value based on a first preset adjustment algorithm; if the calculation value is less than a first preset threshold, adjusting the calculation 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 calculation value based on a second preset adjustment algorithm; if the calculation value is greater than the second preset threshold, adjusting the calculation 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. The technical scheme of the application can avoid clipping values beyond the standard representation, thereby preserving the shadow details and highlight details of the image.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of image processing technology, and in particular to a pixel channel adjustment method, apparatus, device and storage medium. Background Technology

[0002] Currently, in the field of contemporary digital image processing, color space conversion, contrast optimization, and feature extraction constitute the three core demand systems. Taking intelligent security as an example, color space conversion can achieve efficient segmentation of skin tones on faces; while industrial vision systems rely on enhancing contrast to highlight surface defects on products. Traditional techniques are based on the linear superposition of channels using linear matrices, such as affine transformation matrices, to achieve basic operations like gamma correction and color balance. However, the inherent mathematical properties of linear matrices dictate that when the absolute value of any element in the transformation coefficient matrix is ​​greater than 1, the channel values ​​will exceed the range of standard representation.

[0003] To address the aforementioned overflow issue, related technologies employ image editing techniques to adjust values ​​exceeding the standard representation to two specific values, thereby limiting the values ​​exceeding the standard representation to the range of the standard representation.

[0004] However, because the image editing method described above adjusts any value that exceeds the standard representation to two specific values, the differences between the different values ​​are lost, resulting in the loss of shadow and highlight details in the image. Summary of the Invention

[0005] This application provides a pixel channel adjustment method that avoids cropping values ​​exceeding standard representations, thereby preserving shadow and highlight details of the image. The technical solution is as follows:

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

[0007] Obtain multiple channels for a single pixel; each channel is given an initial value;

[0008] For a given initial value, the initial value is processed based on a linear matrix to obtain a calculated value;

[0009] 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.

[0010] The calculated value is detected 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.

[0011] The target value is obtained based on the first intermediate value and the second intermediate value.

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

[0013] If the calculated value is detected based on the first preset adjustment algorithm, and the calculated value is greater than or equal to the first preset threshold, then the calculated value is not adjusted and is used as the first intermediate value.

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

[0015] 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.

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

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

[0018] Based on the second preset curve and the calculated value of the R channel, a first gain is obtained; based on the second preset curve and the calculated value of the G channel, a second gain is obtained; based on the second preset curve and the calculated value of the B channel, a third gain is obtained.

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

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

[0021] Based on the second preset curve and the calculated value of the R channel, the first function value is obtained;

[0022] The first gain is obtained based on the first function value and the calculated value.

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

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

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

[0026] The initial value and the calculated value are processed based on the first preset mapping relationship to obtain the first intensity coefficient;

[0027] The initial value and the calculated value are processed based on the second preset mapping relationship to obtain the second intensity coefficient;

[0028] A first value is obtained based on the first intermediate value and the first strength coefficient; a second value is obtained based on the third intermediate value and the second strength coefficient.

[0029] The target value is obtained based on the sum of the first value and the second value.

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

[0031] Obtain the difference between the initial value and the calculated value;

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

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

[0034] The target value is obtained by processing the sum of the first value and the second value using a preset processing algorithm.

[0035] According to a second aspect of the embodiments of this application, a pixel channel adjustment device is provided, the device comprising:

[0036] The acquisition module is used to acquire multiple channels of a pixel; each channel is given an initial value;

[0037] The first calculation module is used to process the initial value based on a linear matrix to obtain a calculated value.

[0038] The first adjustment module is used to detect 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.

[0039] The second adjustment module is used 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] The second calculation module is used to obtain the target value based on the first intermediate value and the second intermediate value.

[0041] According to a third aspect of the present application, a computer device is provided, the computer device including a processor and a memory, the memory being used to store at least one program, the at least one program being loaded by the processor and executed as the pixel channel adjustment method.

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

[0043] In this embodiment, a pixel channel adjustment method is provided, which involves obtaining multiple channels of a pixel; each channel has 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, and 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, and 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; and a target value is obtained based on the first intermediate value and the second intermediate value. The technical solution of this application adjusts each calculated value that needs to be adjusted to a first intermediate value or a second intermediate value that still reflects the difference between the calculated values ​​through a first preset adjustment algorithm or a second preset adjustment algorithm, instead of 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 related technologies, the technical solution of this application preserves the shadow details and highlight details of the image by retaining the differences between the calculated values, thereby ensuring image accuracy. Attached Figure Description

[0044] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

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

[0046] Figure 2 This is a flowchart illustrating an image editing process provided by related technologies;

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

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

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

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

[0051] Figure 7 This is a schematic diagram of a pixel channel adjustment device according to an embodiment of this application;

[0052] Figure 8 This is a schematic diagram of the structure of a terminal according to an embodiment of this application;

[0053] Figure 9 This is a schematic diagram of the structure of a server according to an embodiment of this application. Detailed Implementation

[0054] To make the objectives, technical solutions, and advantages of this application clearer, the embodiments of this application will be described in further detail below with reference to the accompanying drawings.

[0055] 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 represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application.

[0056] In this application, the terms "first," "second," etc., are used to distinguish identical or similar items that have essentially the same function. It should be understood that there is no logical or temporal dependency between "first," "second," and "nth," nor does it limit the quantity or execution order. It should also be understood that although the following description uses the terms "first," "second," etc., to describe various elements, these elements should not be limited by the terms.

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

[0058] "At least one" refers to one or more actions. For example, at least one action can be one action, two actions, three actions, or any integer number of actions greater than or equal to one. "Multiple" refers to two or more actions. For example, multiple actions can be two actions, three actions, or any integer number of actions greater than or equal to two.

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

[0060] Each terminal 101 is equipped with a pixel channel adjustment device. The device uses a first preset adjustment algorithm to perform low-light protection on the initial values ​​of the channels; and a second preset adjustment algorithm to perform high-light protection on the initial values ​​of the channels, thereby preserving both shadow and highlight details of the image. For example, the terminal 101 can be a smartphone, wearable device, personal computer, laptop computer, tablet computer, smart TV, or in-vehicle terminal, etc., equipped with a pixel channel adjustment device.

[0061] Server 102 can be a single server, a server cluster consisting of multiple servers, or a cloud processing center.

[0062] Terminal 101 is connected to server 102 via wired or wireless network.

[0063] In some embodiments, the wireless or wired network uses standard communication technologies and / or protocols. The network is typically the Internet, but can be any 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. In some embodiments, technologies and / or formats including Hyper Text Markup Language (HTML), Extensible Markup Language (XML), etc., are used to represent data exchanged over the network. Furthermore, conventional encryption technologies such as Secure Socket Layer (SSL), Transport Layer Security (TLS), Virtual Private Network (VPN), and Internet Protocol Security (IPsec) can be used to encrypt all or some links. In other embodiments, custom and / or dedicated data communication technologies may be used to replace or supplement the aforementioned data communication technologies.

[0064] Figure 2 This is a flowchart illustrating an image editing process provided by related technologies.

[0065] The following is combined Figure 2 An example illustration is provided for image clipping in related technologies.

[0066] In related technologies, after processing the initial values ​​of pixel channels based on linear transformation, the calculated values ​​may exceed the standard representation. To solve this problem, image clipping is used to forcibly truncate or adjust values ​​exceeding the standard representation, thus limiting values ​​outside the standard representation range to within that range. Then, a gamma algorithm is used to obtain the target value, ensuring that the image data meets the requirements of subsequent processing or display devices and preventing distortion or errors caused by numerical overflow or underflow. Optionally, the standard representation range is 0–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] Based on the above analysis, it can be seen that the image editing techniques in these technologies adjust both values ​​300 and 400 to 255, and both values ​​(-8) and (-3) to 0. This results in the loss of the difference between values ​​300 and 400, as well as the difference between values ​​(-8) and (-3), leading to the loss of shadow and highlight details in the image. Consequently, the image's accuracy is reduced, resulting in the loss of some useful information and potentially causing a series of safety issues in related technical fields, such as autonomous driving.

[0068] To address the aforementioned technical problems, embodiments of this application provide a pixel channel adjustment method that adjusts the initial value of each channel of each pixel in an image. Specifically, the initial value of each channel of a pixel is processed using a linear matrix to obtain a calculated value for each channel. Then, the calculated value of each channel of the pixel is adjusted using a first preset adjustment algorithm to obtain a first intermediate value. Finally, the calculated value of each channel of the pixel is adjusted using a second preset adjustment algorithm to obtain a second intermediate value. The first and second intermediate values ​​fall between a first and a second preset threshold. Compared to related technologies that adjust any value not between 0 and 255 to 0 or 255, embodiments of this application can uniquely map different initial values ​​to corresponding first or second intermediate values. Therefore, the first and second intermediate values ​​retain the relative magnitudes between the initial values, thus preserving the shadow and highlight details of the image.

[0069] Figure 3 This is a flowchart illustrating a pixel channel adjustment method according to an embodiment of this application, as shown below. Figure 3 As shown, this embodiment of the application takes a terminal with a pixel adjustment device as an example for illustration. The method includes the following steps:

[0070] In step 301, the terminal acquires multiple channels of a pixel; each channel has an initial value.

[0071] The terminal adjusts pixel channels pixel by pixel. The initial value of each channel represents brightness or intensity. Optionally, a larger initial value indicates greater brightness or intensity, while a smaller initial value indicates less brightness or intensity. Optionally, a pixel includes three channels. For example, the three channels are the R channel, G channel, and B channel. The R channel represents the red channel, and its initial value represents the intensity of red. The G channel represents the green channel, and its initial value represents the intensity of green. The B channel represents the blue channel, and its initial value 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 the calculated value.

[0073] In some embodiments, for a single pixel, the terminal processes the initial values ​​of each channel of that pixel in parallel based on a linear matrix to obtain the calculated values ​​for each channel. Optionally, the linear matrix can be implemented in various forms. For example, a 3×3 matrix can be selected to process the initial values ​​of each channel to obtain the calculated values ​​for each channel, thereby controlling the blending ratio between the channels and thus meeting the needs of complex color adjustments.

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

[0075] 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 a first preset threshold, the calculated value is not adjusted and is used as a 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, and 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 is important to understand that the first preset adjustment algorithm is based on a first preset function. Optionally, the first preset function can be implemented in multiple forms. For example, the first preset function can be a piecewise function. This is because when the calculated value is greater than or equal to 0 and less than or equal to 255, no adjustment is needed, while when the calculated value is not between 0 and 255, adjustment is needed. Therefore, the first preset function needs to be implemented using two different functions.

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

[0080] The following is combined Figure 4 The first preset adjustment algorithm is illustrated by example.

[0081] In some embodiments, the horizontal axis of the first preset curve represents the calculated value, and the vertical axis represents the first intermediate value. When the horizontal axis 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; the calculated value is directly used as the first intermediate value. When the horizontal axis is less than 0, the first preset function is represented by y = kx, where k represents the coefficient of the first preset function, and 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). From the above analysis, it can be seen that low-light protection of the channel is achieved based on the first preset curve, which also protects shadow details.

[0082] It should be noted that when the x-coordinate 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. The non-linear function can be implemented in various forms, and the embodiments of this application do not impose specific limitations on it.

[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 the second intermediate value.

[0084] 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, the calculated value is detected based on a second preset adjustment algorithm. If the calculated value is less than or equal to a second preset threshold, the calculated value is not adjusted and is used as a second intermediate value.

[0086] In one example, the terminal detects the calculated value based on a second preset adjustment algorithm, compares the calculated value with 255, and 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 is important to understand that the second preset adjustment algorithm is based on a second preset function. Optionally, the second preset function can be implemented in various forms. For example, the second preset function can be a piecewise function. This is because when the calculated value is greater than or equal to 0 and less than or equal to 255, no adjustment is needed, while when the calculated value is not between 0 and 255, adjustment is needed. Therefore, the second preset function needs to be implemented using two different functions.

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

[0089] The following is combined Figure 5 The second preset adjustment algorithm is illustrated by example.

[0090] In some embodiments, the horizontal axis of the second preset curve is the calculated value, and the vertical axis is the second intermediate value. When the horizontal axis 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 horizontal axis is greater than 255, the second preset function is represented by y = bx, where k represents the coefficient of the second preset function, and b is greater than 0 and less than 1. That is, when the calculated value is greater than 255, it is necessary to map the calculated value to the second intermediate value through the second preset function. In this case, the second intermediate value is equal to (b × calculated value). Through the above analysis, it can be seen that the second preset curve achieves highlight protection for each channel, that is, it protects highlight details.

[0091] It should be noted that when the x-coordinate 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. The non-linear function can be implemented in various forms, and the embodiments of this application do not impose specific limitations on it.

[0092] It should be noted that there are multiple possible execution orders for steps 303 and 304. For example, step 303 can be executed first, followed by step 304. Alternatively, step 304 can be executed first, followed by step 303. Or, steps 303 and 304 can be 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 This is an exemplary flowchart of a pixel adjustment method provided according to an embodiment of this application.

[0095] The following is combined Figure 6 The pixel adjustment method is illustrated by example.

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

[0097] It's important to understand that after applying highlight protection to the R, G, and B channels of a single pixel, inconsistencies may arise between the resulting second intermediate values. Therefore, channel-based target gain calculations are needed to resolve these inconsistencies. These inconsistencies can be understood as excessively large differences between the various second intermediate values.

[0098] In some embodiments, the terminal obtains the first gain based on the second preset curve and the calculated value of the R channel, which can be achieved in the following way:

[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 one example, the second function value is the calculated value of the R channel mapped onto a second preset curve using 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 the second gain based on the second preset curve and the calculated value of the G channel, which can be implemented in the following way:

[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 one example, the second function value is the calculated value of the G channel mapped onto a second preset curve using 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, second function value = calculated value of the G channel × b. Second gain = second function value / 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 as follows:

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

[0106] In one example, the third function value is the calculated value of the B channel mapped onto the second preset curve using the 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 a 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 × 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 × second intermediate value of the G channel.

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

[0111] In some embodiments, the terminal obtains the target value based on a first intermediate value and a second intermediate value, which can be achieved as follows: the terminal processes the initial value and the calculated value based on a first preset mapping relationship to obtain a first intensity coefficient; the terminal processes the initial value and the calculated value based on a second preset mapping relationship to obtain a second intensity coefficient; the terminal obtains a first value based on the first intermediate value and the first intensity coefficient; the terminal obtains a second value based on a third intermediate value and the second intensity coefficient; and 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; and the target value = the first value + the second value. By using the intensity coefficient, the first intermediate value that passes low-light protection and the third intermediate value that passes high-light protection are weighted and summed to obtain the target value of a channel. The target value obtained in this way achieves both low-light protection and high-light protection, so that the target value falls between 0 and 255. Moreover, the target value also preserves shadow details and highlight details.

[0112] Optionally, the first, second, and third preset mapping relationships are implemented using various methods. For example, all three preset mapping relationships can be linear. Linear mapping relationships are simple, direct, and have a linear response, making them suitable for rapid prototype verification. Alternatively, all three preset mapping relationships can be non-linear. Exponential decay mapping relationships emphasize small differences and ignore large deviations, making them suitable for night scene enhancement. Alternatively, the first and second intensity coefficients can be obtained by looking up a table. It should be noted that the linear and non-linear mapping relationships and tables involved in this application can be directly obtained from related technologies, and will not be elaborated further in the embodiments of this application.

[0113] In one example, the terminal processes the initial value and the calculated value based on a first preset mapping relationship to obtain a first intensity coefficient. This can be achieved by: obtaining the difference result between the initial value and the calculated value; processing the difference result based on the first preset mapping relationship to obtain the first intensity coefficient. Optionally, the difference result can be implemented using multiple methods, such as direct differencing, absolute differencing, or normalized differencing.

[0114] Similarly, the second strength coefficient can be obtained, which 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 in various ways. For example, the terminal processes the sum of the first value and the second value based on a gamma algorithm to obtain the target value, thereby making the image more consistent with the perceptual characteristics of the human eye.

[0116] It should be noted that applying the above method to a terminal is only one embodiment. Furthermore, the method described in this application can also be applied to a server, which will not be elaborated upon further.

[0117] An embodiment of this application provides a pixel channel adjustment method that obtains multiple channels for a pixel; each channel has 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 this application adjusts each calculated value that needs to be adjusted to a first intermediate value or a second intermediate value that still reflects the difference between the calculated values ​​through a first preset adjustment algorithm or a second preset adjustment algorithm, instead of 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 related technologies, the technical solution of this application preserves the shadow details and highlight details of the image by retaining the differences between the calculated values, thereby ensuring image accuracy.

[0118] Figure 7 This is a schematic diagram of a pixel channel adjustment device 700 according to an embodiment of this application. The device includes:

[0119] The acquisition module 701 is used to acquire multiple channels of a pixel; each channel has an initial value.

[0120] The first calculation module 702 is used to process an initial value based on a linear matrix to obtain a calculated value.

[0121] The first adjustment module 703 is used to detect the calculated value based on the first preset adjustment algorithm. If the calculated value is less than the first preset threshold, the calculated value is adjusted based on the first preset curve to obtain the first intermediate value. The first intermediate value is greater than or equal to the first preset threshold and less than or equal to the second preset threshold.

[0122] The second adjustment module 704 is used to detect 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 the 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] The second calculation module 705 is used to obtain the target value based on the first intermediate value and the second intermediate value.

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

[0125] Based on the 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.

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

[0127] The calculated value is detected 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.

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

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

[0130] Based on the second preset curve and the calculated values ​​of the R channel, the first gain is obtained; based on the second preset curve and the calculated values ​​of the G channel, the second gain is obtained; based on the second preset curve and the calculated values ​​of the B channel, the third gain is obtained.

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

[0132] In some embodiments, the first gain is obtained based on the second preset curve and the calculated value of the R channel, including:

[0133] Based on the second preset curve and the calculated values ​​of the R channel, the first function value is obtained;

[0134] The first gain is obtained based on the first function value and the calculated value.

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

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

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

[0138] The first intensity coefficient is obtained by processing the initial and calculated values ​​based on the first preset mapping relationship;

[0139] The second intensity coefficient is obtained by processing the initial and calculated values ​​based on the second preset mapping relationship;

[0140] A first value is obtained based on the first intermediate value and the first strength coefficient; a second value is obtained based on the third intermediate value and the second strength coefficient.

[0141] The target value is obtained by summing the first and second values.

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

[0143] Obtain the difference between the initial value and the calculated value;

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

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

[0146] It should be noted that the pixel channel adjustment device provided in the above embodiments is only illustrated by the division of the above functional modules when performing the corresponding steps. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. In addition, the pixel channel adjustment device and the pixel channel adjustment method embodiments provided in the above embodiments belong to the same concept, and their specific implementation process can be found in the method embodiments, which will not be repeated here.

[0147] An embodiment of this application provides a pixel channel adjustment method that obtains multiple channels for a pixel; each channel has 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 this application adjusts each calculated value that needs to be adjusted to a first intermediate value or a second intermediate value that still reflects the difference between the calculated values ​​through a first preset adjustment algorithm or a second preset adjustment algorithm, instead of 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 related technologies, the technical solution of this application preserves the shadow details and highlight details of the image by retaining the differences between the calculated values, thereby ensuring image accuracy.

[0148] An embodiment of this application also provides a computer device, including a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein the processor executes the computer program to implement the method described above.

[0149] Taking computer devices as terminals as an example, Figure 8 This is a schematic diagram of the structure of a terminal provided in an embodiment of this application. See also... Figure 8 Terminal 800 can be: a smartphone, tablet computer, MP3 player (Moving Picture Experts Group Audio Layer III), MP4 player (Moving Picture Experts Group Audio Layer IV), laptop computer, or desktop computer. Terminal 800 may also be referred to as user equipment, portable terminal, laptop terminal, desktop terminal, or other names.

[0150] Typically, terminal 800 includes a processor 801 and a memory 802.

[0151] Processor 801 may include one or more processing cores, such as a quad-core processor, a penta-core processor, etc. Processor 801 may be implemented using at least one hardware form selected from DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), and PLA (Programmable Logic Array). Processor 801 may also include a main processor and a coprocessor. The main processor, also known as a CPU (Central Processing Unit), is used to process data in the wake-up state; the coprocessor is a low-power processor used to process data in the standby state. In some embodiments, processor 801 may integrate a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content required to be displayed on the screen. In some embodiments, processor 801 may also include an AI (Artificial Intelligence) processor, which is used to handle 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 also include high-speed random access memory and non-volatile memory, such as one or more disk storage devices or flash memory devices. In some embodiments, the non-transitory computer-readable storage media in the memory 802 are used to store at least one program code, which is executed by the processor 801 to implement the process of terminal execution in the method embodiments of this application.

[0153] In some embodiments, the terminal 800 may also optionally include a peripheral device interface 803 and at least one peripheral device. The processor 801, memory 802, and peripheral device interface 803 can be connected via a bus or signal line. Each peripheral device can be connected to the peripheral device interface 803 via a bus, signal line, or 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] Peripheral device interface 803 can be used to connect at least one I / O (Input / Output) related peripheral device to processor 801 and memory 802. In some embodiments, processor 801, memory 802 and peripheral device interface 803 are integrated on the same chip or circuit board; in some other embodiments, any one or two of processor 801, memory 802 and peripheral device interface 803 can be implemented on separate chips or circuit boards, and this application embodiment does not limit this.

[0155] Display screen 804 is used to display a UI (User Interface). This UI may include graphics, text, icons, videos, and any combination thereof. When display screen 804 is a touch display screen, it also has the ability to collect touch signals on or above its surface. These touch signals can be input as control signals to processor 801 for processing. In this case, 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 may be one display screen 804, disposed on the front panel of terminal 800; in other embodiments, there may be at least two display screens, disposed on different surfaces of terminal 800 or in a folded design; in other embodiments, display screen 804 may be a flexible display screen, disposed on a curved or folded surface of terminal 800. Furthermore, display screen 804 may be configured as a non-rectangular irregular shape, i.e., a non-rectangular screen. Display screen 804 may be made of materials such as LCD (Liquid Crystal Display) or OLED (Organic Light-Emitting Diode).

[0156] The camera assembly 805 is used to acquire images or videos. In some embodiments, the camera assembly 805 includes a front-facing camera and a rear-facing camera. Typically, the front-facing camera is located on the front panel of the terminal, and the rear-facing camera is located on the back of the terminal. In some embodiments, there are at least two rear-facing cameras, which are any one of a main camera, a depth-sensing camera, a wide-angle camera, and a telephoto camera, to achieve background blurring by fusion of the main camera and the depth-sensing camera, panoramic shooting by fusion of the main camera and the wide-angle camera, VR (Virtual Reality) shooting, or other fusion shooting functions. In some embodiments, the camera assembly 805 may also include a flash. The flash can be a single-color temperature flash or a dual-color temperature flash. A dual-color temperature flash is a combination of a warm-light flash and a cool-light flash, which can be used for light compensation at different color temperatures.

[0157] The audio circuit 806 may include a microphone and a speaker. The microphone is used to collect sound waves from the user and the environment, and convert the sound waves into electrical signals which are then input to the processor 801 for processing. For stereo sound acquisition or noise reduction purposes, multiple microphones may be used, each positioned at a different location on the terminal 800. The microphone may also be an array microphone or an omnidirectional microphone. The speaker is used to convert the electrical signals from the processor 801 into sound waves. The speaker may be a conventional diaphragm speaker or a piezoelectric ceramic speaker. When the speaker is a piezoelectric ceramic speaker, it can convert electrical signals not only into audible sound waves but also into inaudible sound waves for purposes such as distance measurement. In some embodiments, the audio circuit 806 may also include a headphone jack.

[0158] Power supply 807 is used to power the various components in terminal 800. Power supply 807 can be AC ​​power, DC power, a disposable battery, or a rechargeable battery. When power supply 807 includes a rechargeable battery, the rechargeable battery can support wired or wireless charging. The rechargeable battery can also be used to support fast charging technology.

[0159] Those skilled in the art will understand that Figure 8 The structure shown does not constitute a limitation on terminal 80, and may include more or fewer components than shown, or combine certain components, or use different component arrangements.

[0160] Taking computer equipment as a server as an example, Figure 9 This is a schematic diagram of a server structure provided in an embodiment of this application. The server 900 can vary significantly due to different configurations or performance. It may include one or more Central Processing Units (CPUs) 901 and one or more memories 902. The one or more memories 902 store at least one computer program, which is loaded and executed by the one or more processors 901 to implement the aforementioned pixel channel adjustment method. Of course, the server 900 may also have wired or wireless network interfaces, a keyboard, and input / output interfaces for input and output. The server 900 may also include other components for implementing device functions, which will not be elaborated upon here.

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

[0162] Those skilled in the art will understand that all or part of the steps of the above embodiments can be implemented by hardware, or by a program instructing related hardware. The program can be stored in a computer-readable storage medium, such as a read-only memory, a disk, or an optical disk.

[0163] The above are merely optional embodiments of this application and are not intended to limit this application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application.

Claims

1. A pixel channel adjustment method, characterized in that, include: Get multiple channels of a single pixel; Each of the channels is given an initial value; For a given 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 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. For a given pixel, the pixel 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, a second gain is obtained; based on the second preset curve and the calculated value of the B channel, a third gain is obtained; the maximum value among the first gain, the second gain, and the third gain is taken as the target gain. Based on the target gain and the second intermediate value, a third intermediate value is obtained; Obtaining a 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; obtaining a first value based on the first intermediate value and the first intensity coefficient; obtaining a second value based on the third intermediate value and the second intensity coefficient; and obtaining the target value based on the sum of the first value and the second value.

2. The method according to claim 1, characterized in that, The method further includes: If the calculated value is detected based on the first preset adjustment algorithm, and the calculated value is greater than or equal to the first preset threshold, then the calculated value is not adjusted and is used as the first intermediate value.

3. The method according to claim 1, characterized in that, The method further includes: 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.

4. The method according to claim 1, characterized in that, The first gain is obtained based on the second preset curve and the calculated value of the R channel, including: Based on the second preset curve and the calculated value of the R channel, the first function value is obtained; The first gain is obtained based on the first function value and the calculated value.

5. The method according to claim 1, characterized in that, The process of processing the initial value and the calculated value based on the first preset mapping relationship to obtain the first intensity coefficient includes: Obtain the difference between the initial value and the calculated value; The difference result is processed based on the first preset mapping relationship to obtain the first intensity coefficient.

6. The method according to claim 5, characterized in that, The method further includes: The target value is obtained by processing the sum of the first value and the second value using a preset processing algorithm.

7. A pixel channel adjustment device, characterized in that, include: The acquisition module is used to acquire multiple channels of a single pixel. Each of the channels is given an initial value; The first calculation module is used to process the initial value based on a linear matrix to obtain a calculated value. The first adjustment module is used to detect 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. The second adjustment module is used 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. The second calculation module is used for a pixel point, the pixel point including R channel, G channel and 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, a second gain is obtained; based on the second preset curve and the calculated value of the B channel, a third gain is obtained; the maximum value among the first gain, the second gain, and the third gain is taken as the target gain. Based on the target gain and the second intermediate value, a third intermediate value is obtained; based on the first intermediate value and the second intermediate value, the target value is obtained. The second calculation module is specifically used to process the initial value and the calculated value based on the first preset mapping relationship to obtain the first intensity coefficient; The initial value and the calculated value are processed based on the second preset mapping relationship to obtain the second intensity coefficient; A first value is obtained based on the first intermediate value and the first intensity coefficient; a second value is obtained based on the third intermediate value and the second intensity coefficient; and the target value is obtained based on the sum of the first value and the second value.

8. A computer device, characterized in that, The computer device includes a processor and a memory, the memory being used to store at least one program, the at least one program being loaded by the processor and executed as the pixel channel adjustment method as described in any one of claims 1 to 6.

9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores at least one program, which is loaded and executed by a processor to implement the pixel channel adjustment method as described in any one of claims 1 to 6.

Citation Information

Patent Citations

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

    CN112911166A

  • Image processing method and electronic equipment

    CN117133252A

  • Image processing method and apparatus, computer-readable medium, and electronic device

    WO2022087973A1