Image tone adjustment method, storage medium, electronic device and system

Through GPU parallel computing and vector dot multiplication calculation, combined with the warm and cold tone adjustment algorithm, the problem of traditional image tone adjustment algorithm being complex and high performance consumption is solved, achieving efficient image tone adjustment, avoiding excessive heating of live broadcast equipment, and ensuring In order to ensure the normal progress of the anchor's live broadcast.

CN113747251BActive Publication Date: 2024-10-01WUHAN OUYUE ONLINE TV CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202110961892.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-08-20
Publication Date
2024-10-01
Estimated Expiration
2041-08-20

AI Technical Summary

Technical Problem

The traditional image tone adjustment algorithm is complex and consumes a lot of performance of the live broadcast equipment, causing serious equipment heating and affecting the normal progress of the anchor's live broadcast.

Method used

Using GPU parallel computing, vector dot multiplication calculation is performed on each pixel in the original image and the preset pixel, the mean and maximum values ​​of the three primary color values ​​are calculated, and warm or cold tones are adjusted based on the absolute value results, using the preset The algorithm adjusts image tone, reduces algorithm complexity, and reduces hardware performance consumption.

Benefits of technology

It effectively reduces the complexity of the tone adjustment algorithm, reduces the performance consumption of the live broadcast equipment, avoids overheating of the equipment, and ensures the normal progress of the anchor's live broadcast.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113747251B_ABST
    Figure CN113747251B_ABST
Patent Text Reader

Abstract

The present invention discloses an image tone adjustment method, storage medium, electronic device and system, and relates to the field of image processing. The method comprises: based on a GPU parallel computing method, respectively calculating the vector dot multiplication between each pixel point in the original image and a preset pixel point; calculating the maximum value of the three primary color values ​​of each pixel point in the original image, and calculating the absolute value between the maximum value and the mean value of the three primary color values ​​of each pixel point in the original image; judging the image tone adjustment type: when it is a warm tone adjustment, the three primary color values ​​of the pixel points in the original image are adjusted to warm tones according to the absolute value calculation result and based on a preset warm tone adjustment algorithm; when it is a cold tone adjustment, the three primary color values ​​of the pixel points in the original image are adjusted to cold tones according to the absolute value calculation result and based on a preset cold tone adjustment algorithm. The present invention can ensure the normal live broadcast of the anchor while achieving image tone adjustment.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of image processing, and in particular to an image tone adjustment method, a storage medium, an electronic device and a system. Background Art

[0002] With the rapid development of mobile smart device technology, the functions of smart mobile devices have become more diverse, and watching live broadcasts based on smart mobile devices has become more convenient. As a result, more and more young people like to spend their free time watching live broadcasts and enrich their spare time, which in turn promotes the vigorous development of the live broadcast industry.

[0003] During the live broadcast, the host usually adjusts the color tone of the live broadcast image in order to enhance the texture of the live broadcast image. However, the traditional image color tone adjustment algorithm is relatively complex, and in order to ensure a better color tone adjustment effect, the performance of the live broadcast equipment is greatly consumed, and the live broadcast equipment is prone to severe heating, thereby affecting the host's normal live broadcast. Summary of the invention

[0004] In view of the defects existing in the prior art, the purpose of the present invention is to provide an image tone adjustment method, storage medium, electronic device and system, which can achieve image tone adjustment while ensuring the normal live broadcast of the host.

[0005] To achieve the above purpose, the present invention provides an image tone adjustment method, which specifically includes the following steps:

[0006] Based on the GPU parallel computing method, the vector dot multiplication between each pixel in the original image and the preset pixel is calculated to obtain the mean value of the three primary color values ​​of each pixel in the original image;

[0007] Calculate the maximum value of the three primary color values ​​of each pixel in the original image, and calculate the absolute value between the maximum value and the mean value of the three primary color values ​​of each pixel in the original image;

[0008] Determine the image tone adjustment type:

[0009] When warm tone adjustment is performed, the three primary color values ​​of the pixels in the original image are adjusted to warm tone according to the absolute value calculation result and based on a preset warm tone adjustment algorithm;

[0010] When the adjustment is made to a cold tone, the three primary color values ​​of the pixels in the original image are adjusted to a cold tone according to the absolute value calculation result and based on a preset cold tone adjustment algorithm.

[0011] On the basis of the above technical solution, the vector dot multiplication between each pixel point in the original image and the preset pixel point is calculated respectively to obtain the mean of the three primary color values ​​of each pixel point in the original image, wherein the specific calculation formula for the vector dot multiplication between the pixel point of the original image and the preset pixel point is:

[0012] avg=r*r1+g*g1+b*b1

[0013] Among them, avg represents the average of the three primary colors of the pixel in the original image, r represents the R value of the three primary colors of the pixel in the original image, g represents the G value of the three primary colors of the pixel in the original image, b represents the B value of the three primary colors of the pixel in the original image, r1 represents the R value of the three primary colors of the preset pixel, g1 represents the G value of the three primary colors of the preset pixel, b1 represents the B value of the three primary colors of the preset pixel, and the R value, G value and B value of the three primary colors of the preset pixel are all 128.

[0014] On the basis of the above technical solution, the calculation obtains the maximum value of the three primary color values ​​of each pixel in the original image, and the specific steps include:

[0015] Based on GPU parallel computing, the R value, G value and B value of the three primary colors of a single pixel in the original image are obtained simultaneously;

[0016] The R value, G value, and B value of the three primary colors of the current pixel are compared with each other, and the largest value is taken as the maximum value of the three primary colors of the current pixel.

[0017] On the basis of the above technical solution, the absolute value between the maximum value and the mean value of the three primary color values ​​of each pixel in the original image is calculated, and the specific calculation formula is:

[0018]

[0019]

[0020] Where abs represents the absolute value between the maximum and mean values ​​of the three primary colors of the pixels in the original image, and max represents the maximum value of the three primary colors of the pixels in the original image.

[0021] On the basis of the above technical solution, the three primary color values ​​of the pixels in the original image are adjusted to warm tones based on the absolute value calculation result and the preset warm tone adjustment algorithm, wherein the specific algorithm for adjusting the three primary color values ​​of the pixels in the original image to warm tones is:

[0022] r2=r-(max-r)*abs*ɑ

[0023] g2=g-(max-g)*abs*ɑ

[0024] b2=b-(max-b)*abs*ɑ

[0025] Among them, r2 represents the R value of the three primary colors of the pixel point after the warm tone adjustment, g2 represents the G value of the three primary colors of the pixel point after the warm tone adjustment, b2 represents the B value of the three primary colors of the pixel point after the warm tone adjustment, and ɑ is the warm tone intensity adjustment parameter.

[0026] Based on the above technical solutions,

[0027] After the three primary color values ​​of the pixels in the original image are adjusted to warm tones, the method further includes: determining whether the three primary color values ​​of the pixels after the warm tones adjustment are out of bounds, and processing the out-of-bounds pixels;

[0028] The step of judging whether the three primary color values ​​of the pixel point after the warm tone adjustment are out of bounds and processing the out-of-bounds pixel point specifically includes:

[0029] When r2>255, the value of r2 is replaced by 255; when r2 is less than 0, the value of r2 is replaced by 0; when 0≤r2≤255, the value of r2 is not processed;

[0030] When g2>255, the value of g2 is replaced by 255; when g2 is less than 0, the value of g2 is replaced by 0; when 0≤g2≤255, the value of g2 is not processed;

[0031] When b2>255, the value of b2 is replaced by 255; when b2 is less than 0, the value of b2 is replaced by 0; when 0≤b2≤255, the value of b2 is not processed.

[0032] On the basis of the above technical solution, the three primary color values ​​of the pixels in the original image are adjusted to a cold tone based on the absolute value calculation result and a preset cold tone adjustment algorithm, wherein the specific algorithm for adjusting the three primary color values ​​of the pixels in the original image to a cold tone is:

[0033] r3=r+(max-r)*abs*β

[0034] g3=g+(max-g)*abs*β

[0035] b3=b+(max-b)*abs*β

[0036] Among them, r3 represents the R value of the three primary colors of the pixel after the cold tone adjustment, g3 represents the G value of the three primary colors of the pixel after the cold tone adjustment, b3 represents the B value of the three primary colors of the pixel after the cold tone adjustment, and β is the cold tone intensity adjustment parameter.

[0037] Based on the above technical solutions,

[0038] After the three primary color values ​​of the pixels in the original image are adjusted to cold tones, the method further includes: determining whether the three primary color values ​​of the pixels after the cold tones adjustment are out of bounds, and processing the out-of-bounds pixels;

[0039] The specific steps of judging whether the three primary color values ​​of the pixel point after the cold tone adjustment are out of bounds and processing the out-of-bounds pixel point include:

[0040] When r3>255, the value of r3 is replaced by 255; when r3 is less than 0, the value of r3 is replaced by 0; when 0≤r3≤255, the value of r3 is not processed;

[0041] When g3>255, the value of g3 is replaced by 255; when g3 is less than 0, the value of g3 is replaced by 0; when 0≤g3≤255, the value of g3 is not processed;

[0042] When b3>255, the value of b3 is replaced by 255; when b3 is less than 0, the value of b3 is replaced by 0; when 0≤b3≤255, the value of b3 is not processed.

[0043] The present invention provides a storage medium on which a computer program is stored, and the program implements the steps of the above-mentioned method when executed by a processor.

[0044] An electronic device provided by the present invention comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the steps of the above-mentioned method are implemented when the processor executes the program.

[0045] The present invention provides an image tone adjustment system, comprising:

[0046] The mean value calculation module is used to drive the GPU to calculate the vector dot multiplication between each pixel in the original image and the preset pixel to obtain the mean value of the three primary color values ​​of each pixel in the original image;

[0047] The absolute value calculation module is used to calculate the maximum value of the three primary color values ​​of each pixel in the original image, and calculate the absolute value between the maximum value and the mean value of the three primary color values ​​of each pixel in the original image;

[0048] A judging module, which is used to judge the type of image tone adjustment, and when it is warm tone adjustment, drives the warm tone adjustment module to work, and when it is cold tone adjustment, drives the cold tone adjustment module to work;

[0049] A warm tone adjustment module, which is used to perform warm tone adjustment on the three primary color values ​​of the pixel points in the original image according to the absolute value calculation result and based on a preset warm tone adjustment algorithm;

[0050] The cold tone adjustment module is used to perform cold tone adjustment on the three primary color values ​​of the pixel points in the original image according to the absolute value calculation result and based on a preset cold tone adjustment algorithm.

[0051] Compared with the prior art, the advantages of the present invention are: based on the GPU parallel computing method, vector dot multiplication calculation is performed between the pixel points of the original image and the preset pixel points, and the absolute value between the maximum value and the mean value of the three primary color values ​​of each pixel point in the original image is calculated, so as to adjust the warm tone of the image based on the preset warm tone adjustment algorithm, and adjust the cold tone of the image based on the preset cold tone adjustment algorithm. The GPU parallel processing method is adopted, and the complexity of the tone adjustment algorithm is reduced at the same time, which effectively reduces the performance consumption of the hardware equipment, avoids the problem of excessive heating of the live broadcast equipment, and ensures the normal live broadcast of the anchor. BRIEF DESCRIPTION OF THE DRAWINGS

[0052] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0053] Figure 1 is a flow chart of a method for adjusting image tone according to an embodiment of the present invention;

[0054] Figure 2 The figure is a schematic diagram of the structure of an image tone adjustment system according to an embodiment of the present invention. DETAILED DESCRIPTION

[0055] The embodiment of the present invention provides an image tone adjustment method. This embodiment uses the application of the image tone adjustment method to the implementation scenario of mobile live broadcast as an example for explanation. Of course, the technical solution of the present invention is also applicable to the application scenario of short video shooting. The method is based on GPU parallel computing, and respectively calculates the vector dot multiplication between each pixel in the original image and the preset pixel, and calculates the absolute value between the maximum value and the mean value of the three primary color values ​​of each pixel in the original image, thereby adjusting the warm tone of the image based on the preset warm tone adjustment algorithm, and adjusting the cold tone of the image based on the preset cold tone adjustment algorithm. The GPU parallel processing method is adopted, and the complexity of the tone adjustment algorithm is reduced at the same time, which effectively reduces the performance consumption of the hardware equipment, avoids the problem of excessive heating of the live broadcast equipment, and ensures the normal live broadcast of the anchor. The embodiment of the present invention also provides an electronic device, a storage medium and an image tone adjustment system accordingly.

[0056] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.

[0057] See also Figure 1 As shown, an embodiment of the present invention provides an image tone adjustment method, which specifically includes the following steps:

[0058] S1: Based on the parallel computing method of GPU (Graphics Processing Unit), the vector dot multiplication between each pixel in the original image and the preset pixel is calculated to obtain the mean value of the three primary color values ​​of each pixel in the original image;

[0059] S2: Calculate the maximum value of the three primary color values ​​of each pixel in the original image, and calculate the absolute value between the maximum value and the mean value of the three primary color values ​​of each pixel in the original image;

[0060] S3: Determine the image tone adjustment type. If it is a warm tone adjustment, go to S4; if it is a cold tone adjustment, go to S5;

[0061] S4: performing warm tone adjustment on the three primary color values ​​of the pixel points in the original image according to the absolute value calculation result and based on a preset warm tone adjustment algorithm;

[0062] S5: According to the absolute value calculation result and based on a preset cold tone adjustment algorithm, the three primary color values ​​of the pixel points in the original image are adjusted to a cold tone.

[0063] It should be noted that, for a single original image, which is composed of multiple pixels, when the tone of the original image is adjusted, through the parallel processing method of the GPU, each pixel in the original image simultaneously performs vector dot multiplication calculation, mean calculation, maximum calculation, absolute value calculation and warm / cold tone adjustment calculation, and the tone adjustment of the complete single original image is completed. Since the GPU has the advantage of parallel processing tasks, the present invention will not occupy too much hardware resources of the live broadcast device when simultaneously adjusting the tone of the pixels of the original image. While realizing the tone adjustment of the live broadcast image, it can also ensure the normal live broadcast of the anchor.

[0064] In the embodiment of the present invention, the vector dot product between each pixel in the original image and the preset pixel is calculated respectively to obtain the mean of the three primary color values ​​of each pixel in the original image, wherein the specific calculation formula for the vector dot product between the pixel of the original image and the preset pixel is:

[0065] avg=r*r1+g*g1+b*b1

[0066] Wherein, avg represents the average of the three primary colors of the pixel in the original image, r represents the R value of the three primary colors of the pixel in the original image, g represents the G value of the three primary colors of the pixel in the original image, b represents the B value of the three primary colors of the pixel in the original image, r1 represents the R value of the three primary colors of the preset pixel, g1 represents the G value of the three primary colors of the preset pixel, b1 represents the B value of the three primary colors of the preset pixel, and the R value, G value and B value of the three primary colors of the preset pixel are all 128. The three primary colors of the pixel include R (red), G (green) and B (blue). In the embodiment of the present invention, the value range of the R value of the three primary colors of the pixel in the original image is [0,255], the value range of the G value of the three primary colors of the pixel in the original image is [0,255], and the value range of the B value of the three primary colors of the pixel in the original image is [0,255].

[0067] For the above-mentioned simultaneous vector dot multiplication calculation between the pixels of the original image and the preset pixels, the mean of the three primary color values ​​of each pixel in the original image is obtained, and an example is given as follows: assuming that the original image includes pixel A, pixel B and pixel C, then vector dot multiplication calculation is performed between pixel A and the preset pixel, vector dot multiplication calculation is performed between pixel B and the preset pixel, and vector dot multiplication calculation is performed between pixel C and the preset pixel, and the vector dot multiplication calculation between pixel A and the preset pixel, the vector dot multiplication calculation between pixel B and the preset pixel, and the vector dot multiplication calculation between pixel C and the preset pixel are performed simultaneously.

[0068] The principle of the above formula is explained below.

[0069] Vector dot multiplication calculation, also called vector inner product or scalar product calculation, is to perform dot multiplication operation on two vectors, that is, to multiply the corresponding bits of the two vectors one by one and then sum them, and obtain a scalar through vector dot multiplication calculation. In the present invention, the three primary color values ​​of the original image pixel point include R value, G value and B value, so for the pixel point, its three primary color value is equivalent to a vector, which needs to be converted into a scalar to facilitate subsequent calculations. Therefore, by calculating the vector dot multiplication between the pixel point of the original image and the preset pixel point, the mean of the three primary color values ​​of each pixel point in the original image is obtained, and the obtained mean is the scalar.

[0070] For the specific values ​​of the preset pixel R value, G value and B value in the present invention, the value is 128, because 128 is an intermediate value (the value range of the R value of the three primary colors of the pixel point is [0, 255], the value range of the G value of the three primary colors of the pixel point in the original image is [0, 255], and the value range of the B value of the three primary colors of the pixel point in the original image is [0, 255]). Taking the intermediate value for calculation can maximize the guarantee of the mean value of the result. In the above formula, r*r1 is the product of the R value of the three primary colors of the pixel in the original image and the R value of the corresponding preset three primary colors of the pixel, g*g1 is the product of the G value of the three primary colors of the pixel in the original image and the G value of the corresponding preset three primary colors of the pixel, b*b1 is the product of the B value of the three primary colors of the pixel in the original image and the B value of the corresponding preset three primary colors of the pixel, r*r1+g*g1+b*b1 is the sum of the corresponding bits of the two vectors multiplied one by one, thereby obtaining a scalar, which is the mean of the three primary color values ​​of the pixel in the original image.

[0071] In the embodiment of the present invention, the maximum value of the three primary color values ​​of each pixel in the original image is calculated, and the specific steps include:

[0072] S201: Based on the GPU parallel computing method, the R value, G value and B value of the three primary colors of a single pixel in the original image are simultaneously obtained;

[0073] S202: Compare the R value, G value and B value of the three primary colors of the current pixel point with each other, and take the largest value as the maximum value of the three primary colors of the current pixel point.

[0074] The maximum value of the three primary colors of each pixel in the original image is obtained, that is, the maximum value of the R value, G value and B value of the three primary colors of a single pixel is found.

[0075] In the embodiment of the present invention, the absolute value between the maximum value and the mean value of the three primary color values ​​of each pixel in the original image is calculated. The specific calculation formula is:

[0076]

[0077] Where abs represents the absolute value between the maximum and mean values ​​of the three primary colors of the pixels in the original image, and max represents the maximum value of the three primary colors of the pixels in the original image.

[0078] The principle of the above formula is explained below.

[0079] The absolute value calculation is to calculate the distance between two points, and the absolute value calculation result is greater than or equal to 0. Since the maximum value of the three primary colors of the pixels in the original image and the average value of the three primary colors of the pixels in the original image are both non-negative numbers, when performing absolute calculations, the larger value can be directly subtracted from the smaller value. Therefore, when the average value of the three primary colors of the pixels in the original image is greater than the maximum value of the three primary colors of the pixels in the original image, avg-max, when the average value of the three primary colors of the pixels in the original image is less than or equal to the maximum value of the three primary colors of the pixels in the original image, max-avg, the absolute value between the maximum value and the average value of the three primary colors of the pixels in the original image can be obtained.

[0080] In the embodiment of the present invention, according to the absolute value calculation result and based on the preset warm tone adjustment algorithm, the three primary color values ​​of the pixel points in the original image are adjusted to warm tones, wherein the specific algorithm for adjusting the three primary color values ​​of the pixel points in the original image to warm tones is:

[0081] r2=r-(max-r)*abs*ɑ

[0082] g2=g-(max-g)*abs*ɑ

[0083] b2=b-(max-b)*abs*ɑ

[0084] Among them, r2 represents the R value of the three primary colors of the pixel after the warm tone adjustment, g2 represents the G value of the three primary colors of the pixel after the warm tone adjustment, b2 represents the B value of the three primary colors of the pixel after the warm tone adjustment, and ɑ is the warm tone intensity adjustment parameter. The value range of ɑ is [0,2]. As the value of ɑ increases, the effect of warm tone adjustment becomes more obvious. When the value of ɑ is 0, it means that no warm tone adjustment is performed. When the value of ɑ is greater than 0, it means that warm tone adjustment has begun.

[0085] The principle of the above formula is explained below.

[0086] To adjust the image to a warm tone is to reduce the three primary color values ​​of the pixels in the image. When the three primary color values ​​of the pixels in the image are reduced, the entire image will become darker, forming a warm tone, which gives people a warm feeling, thereby achieving the warm tone adjustment of the image, that is, by reducing the R value, G value and B value of the original image pixel point, the warm tone of the image is adjusted, that is, the values ​​of r, g and b are reduced to achieve the adjustment of the warm tone of the image. In order to ensure the adjustment effect of the warm tone, the present invention introduces an adjustment factor. For R in the three primary colors of the pixel, when adjusting the warm tone, the adjustment factors are (max-r) and abs, and the two are multiplied. Max-r represents the difference between the R value in the three primary colors of the pixel in the original image and the maximum value of the three primary colors of the pixel in the original image, and (max-r) and abs are constants. As ɑ increases, the value of (max-r)*abs*ɑ increases, and the value of r-(max-r)*abs*ɑ decreases, that is, the R value in the three primary colors of the pixel in the original image decreases, and the image becomes darker to form a warm tone.

[0087] For G in the three primary colors of the pixel, when adjusting the warm tone, the adjustment factors are (max-g) and abs, and the two are multiplied. Max-g represents the difference between the G value in the three primary colors of the pixel in the original image and the maximum value of the three primary colors of the pixel in the original image, and (max-g) and abs are constants. As ɑ increases, the value of (max-g)*abs*ɑ increases, and the value of g-(max-g)*abs*ɑ decreases, that is, the G value in the three primary colors of the pixel in the original image decreases, and the image becomes darker to form a warm tone.

[0088] For B in the three primary colors of the pixel, when adjusting the warm tone, the adjustment factors are (max-b) and abs, and the two are multiplied. Max-r represents the difference between the B value in the three primary colors of the pixel in the original image and the maximum value of the three primary colors of the pixel in the original image, and (max-b) and abs are constants. As ɑ increases, the value of (max-b)*abs*ɑ increases, and the value of b-(max-b)*abs*ɑ decreases, that is, the B value in the three primary colors of the pixel in the original image decreases, and the image becomes darker to form a warm tone.

[0089] In the embodiment of the present invention, according to the absolute value calculation result and based on the preset cold tone adjustment algorithm, the three primary color values ​​of the pixels in the original image are adjusted to cold tones, wherein the specific algorithm for adjusting the three primary color values ​​of the pixels in the original image to cold tones is:

[0090] r3=r+(max-r)*abs*β

[0091] g3=g+(max-g)*abs*β

[0092] b3=b+(max-b)*abs*β

[0093] Among them, r3 represents the R value of the three primary colors of the pixel point after the cold tone adjustment, g3 represents the G value of the three primary colors of the pixel point after the cold tone adjustment, b3 represents the B value of the three primary colors of the pixel point after the cold tone adjustment, and β is the cold tone intensity adjustment parameter. The value range of β is [0,2]. As the value of ɑ increases, the effect of the cold tone adjustment becomes more obvious. When β is 0, it means that no cold tone adjustment is performed. When the value of β is greater than 0, it means that the cold tone adjustment begins. In the embodiment of the present invention, the value of β is preferably 0.5.

[0094] The principle of the above formula is explained below.

[0095] The image is adjusted to a cold tone, that is, to increase the three primary colors of the pixels in the image. When the three primary colors of the pixels in the image are increased, the entire image will become brighter, forming a cold tone, which gives people a cold feeling, and then the cold tone adjustment of the image is achieved, that is, by increasing the R value, G value and B value of the original image pixel, the cold tone of the image is adjusted, that is, the value of r, g and b is increased to achieve the adjustment of the cold tone of the image. In order to ensure the adjustment effect of the cold tone, the adjustment factor is introduced in the present invention. For R in the three primary colors of the pixel point, when the cold tone adjustment is performed, the adjustment factor is (max-r) and abs, and the two are multiplied, max-r represents the difference between the R value in the three primary colors of the original image pixel point and the maximum value of the three primary colors of the pixel point in the original image, and (max-r) and abs are fixed values. As β increases, the value of (max-r)*abs*β increases, and the value of r+(max-r)*abs*β increases, that is, the R value in the three primary colors of the original image pixel point increases, and the image becomes brighter to form a cold tone.

[0096] For G in the three primary colors of the pixel, when adjusting the cold tone, the adjustment factors are (max-g) and abs, and the two are multiplied. Max-g represents the difference between the G value in the three primary colors of the pixel in the original image and the maximum value of the three primary colors of the pixel in the original image, and (max-g) and abs are constants. As β increases, the value of (max-g)*abs*β increases, and the value of g+(max-g)*abs*β increases, that is, the G value in the three primary colors of the pixel in the original image increases, and the image becomes brighter to form a cold tone.

[0097] For B in the three primary colors of the pixel, when adjusting the cold tone, the adjustment factors are (max-b) and abs, and the two are multiplied. Max-r represents the difference between the B value in the three primary colors of the pixel in the original image and the maximum value of the three primary colors of the pixel in the original image, and (max-b) and abs are constants. As β increases, the value of (max-b)*abs*β increases, and the value of b+(max-b)*abs*β increases, that is, the B value in the three primary colors of the pixel in the original image increases, and the image becomes brighter to form a cold tone.

[0098] In the embodiment of the present invention, after the three primary color values ​​of the pixels in the original image are adjusted to warm tones, the method further includes: determining whether the three primary color values ​​of the pixels after the warm tones adjustment are out of bounds, and processing the out-of-bounds pixels;

[0099] The step of judging whether the three primary color values ​​of the pixel point after the warm tone adjustment are out of bounds and processing the out-of-bounds pixel point specifically includes:

[0100] When r2>255, the value of r2 is replaced by 255; when r2 is less than 0, the value of r2 is replaced by 0; when 0≤r2≤255, the value of r2 is not processed;

[0101] When g2>255, the value of g2 is replaced by 255; when g2 is less than 0, the value of g2 is replaced by 0; when 0≤g2≤255, the value of g2 is not processed;

[0102] When b2>255, the value of b2 is replaced by 255; when b2 is less than 0, the value of b2 is replaced by 0; when 0≤b2≤255, the value of b2 is not processed.

[0103] In the embodiment of the present invention, after the three primary color values ​​of the pixels in the original image are adjusted to cold tones, the method further includes: determining whether the three primary color values ​​of the pixels after the cold tones adjustment are out of bounds, and processing the out-of-bounds pixels;

[0104] The specific steps of judging whether the three primary color values ​​of the pixel point after the cold tone adjustment are out of bounds and processing the out-of-bounds pixel point include:

[0105] When r3>255, the value of r3 is replaced by 255; when r3 is less than 0, the value of r3 is replaced by 0; when 0≤r3≤255, the value of r3 is not processed;

[0106] When g3>255, the value of g3 is replaced by 255; when g3 is less than 0, the value of g3 is replaced by 0; when 0≤g3≤255, the value of g3 is not processed;

[0107] When b3>255, the value of b3 is replaced by 255; when b3 is less than 0, the value of b3 is replaced by 0; when 0≤b3≤255, the value of b3 is not processed.

[0108] When the pixel points of an image are out of bounds, abnormal image color may occur. Therefore, the present invention determines whether the three primary color values ​​of the pixel points of the image obtained after contrast enhancement processing are out of bounds, and processes the out-of-bounds pixel points, thereby effectively ensuring the normal color of the entire image.

[0109] In a possible implementation, the present invention needs to perform vector dot multiplication, mean, maximum, absolute value and warm / cold tone adjustment calculations on each pixel in the image. To improve processing efficiency and maximize hardware performance, the algorithmic operation of the above processing process can be performed by the CPU (Central Processing Unit) or GPU (Graphics Processing Unit) according to the actual scenario. When the image is processed to improve the clarity, it can be performed by the CPU. When the video is processed to improve the clarity, especially in mobile devices, the GPU has better parallel computing performance, so the algorithmic operation of the above processing process is performed by the GPU.

[0110] The image tone adjustment method of the embodiment of the present invention performs vector dot multiplication calculation between the pixel points of the original image and the preset pixel points based on the GPU parallel computing method, and calculates the absolute value between the maximum value and the mean value of the three primary color values ​​of each pixel point in the original image, thereby adjusting the warm tone of the image based on the preset warm tone adjustment algorithm, and adjusting the cold tone of the image based on the preset cold tone adjustment algorithm. It adopts the GPU parallel processing method and reduces the complexity of the tone adjustment algorithm at the same time, effectively reducing the performance consumption of the hardware equipment, avoiding excessive heating of the live broadcast equipment, and ensuring the normal live broadcast of the anchor.

[0111] An embodiment of the present invention provides a storage medium on which a computer program is stored. When the program is executed by a processor, the steps of the above-mentioned image tone adjustment method are implemented.

[0112] The storage medium may adopt any combination of one or more computer-readable media. The computer-readable medium may be a computer-readable signal medium or a computer-readable storage medium. The computer-readable storage medium may be, for example, but not limited to: an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples (non-exhaustive list) of computer-readable storage media include: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this document, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in conjunction with an instruction execution system, device or device.

[0113] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, which carry computer-readable program code. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than a computer-readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, device, or device. The program code contained on the computer-readable medium may be transmitted using any suitable medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.

[0114] Computer program code for performing the operations of the present invention may be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages ​​such as Java, Smalltalk, C++, and conventional procedural programming languages ​​such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0115] An electronic device provided by an embodiment of the present invention includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, the steps of the image tone adjustment method described in the above embodiment are implemented.

[0116] See also Figure 2 As shown, an image tone adjustment system provided by an embodiment of the present invention includes a mean value calculation module, an absolute value calculation module, a judgment module, a warm tone adjustment module and a cold tone adjustment module.

[0117] The mean calculation module is used to drive the GPU to work, and calculate the vector dot product between each pixel in the original image and the preset pixel, so as to obtain the mean of the three primary color values ​​of each pixel in the original image; the absolute value calculation module is used to calculate the maximum value of the three primary color values ​​of each pixel in the original image, and calculate the absolute value between the maximum value and the mean of the three primary color values ​​of each pixel in the original image; the judgment module is used to judge the image tone adjustment type, and when it is warm tone adjustment, drive the warm tone adjustment module to work, and when it is cold tone adjustment, drive the cold tone adjustment module to work; the warm tone adjustment module is used to perform warm tone adjustment on the three primary color values ​​of the pixel points in the original image according to the absolute value calculation result and based on the preset warm tone adjustment algorithm; the cold tone adjustment module is used to perform cold tone adjustment on the three primary color values ​​of the pixel points in the original image according to the absolute value calculation result and based on the preset cold tone adjustment algorithm.

[0118] In the embodiment of the present invention, the vector dot product between each pixel in the original image and the preset pixel is calculated respectively to obtain the mean of the three primary color values ​​of each pixel in the original image, wherein the specific calculation formula for the vector dot product between the pixel of the original image and the preset pixel is:

[0119] avg=r*r1+g*g1+b*b1

[0120] Among them, avg represents the average of the three primary colors of the pixel in the original image, r represents the R value of the three primary colors of the pixel in the original image, g represents the G value of the three primary colors of the pixel in the original image, b represents the B value of the three primary colors of the pixel in the original image, r1 represents the R value of the three primary colors of the preset pixel, g1 represents the G value of the three primary colors of the preset pixel, b1 represents the B value of the three primary colors of the preset pixel, and the R value, G value and B value of the three primary colors of the preset pixel are all 128.

[0121] In the embodiment of the present invention, the maximum value of the three primary color values ​​of each pixel in the original image is calculated, and the specific steps include:

[0122] Based on GPU parallel computing, the R value, G value and B value of the three primary colors of a single pixel in the original image are obtained simultaneously;

[0123] The R value, G value, and B value of the three primary colors of the current pixel are compared with each other, and the largest value is taken as the maximum value of the three primary colors of the current pixel.

[0124] In the embodiment of the present invention, the absolute value between the maximum value and the mean value of the three primary color values ​​of each pixel in the original image is calculated. The specific calculation formula is:

[0125]

[0126] Where abs represents the absolute value between the maximum and mean values ​​of the three primary colors of the pixels in the original image, and max represents the maximum value of the three primary colors of the pixels in the original image.

[0127] In the embodiment of the present invention, according to the absolute value calculation result and based on the preset warm tone adjustment algorithm, the three primary color values ​​of the pixel points in the original image are adjusted to warm tones, wherein the specific algorithm for adjusting the three primary color values ​​of the pixel points in the original image to warm tones is:

[0128] r2=r-(max-r)*abs*ɑ

[0129] g2=g-(max-g)*abs*ɑ

[0130] b2=b-(max-b)*abs*ɑ

[0131] Among them, r2 represents the R value of the three primary colors of the pixel point after the warm tone adjustment, g2 represents the G value of the three primary colors of the pixel point after the warm tone adjustment, b2 represents the B value of the three primary colors of the pixel point after the warm tone adjustment, and ɑ is the warm tone intensity adjustment parameter.

[0132] In the embodiment of the present invention, according to the absolute value calculation result and based on the preset cold tone adjustment algorithm, the three primary color values ​​of the pixels in the original image are adjusted to cold tones, wherein the specific algorithm for adjusting the three primary color values ​​of the pixels in the original image to cold tones is:

[0133] r3=r+(max-r)*abs*β

[0134] g3=g+(max-g)*abs*β

[0135] b3=b+(max-b)*abs*β

[0136] Among them, r3 represents the R value of the three primary colors of the pixel after the cold tone adjustment, g3 represents the G value of the three primary colors of the pixel after the cold tone adjustment, b3 represents the B value of the three primary colors of the pixel after the cold tone adjustment, and β is the cold tone intensity adjustment parameter.

[0137] The image tone adjustment system of the embodiment of the present invention performs vector dot multiplication calculation between the pixel points of the original image and the preset pixel points based on the GPU parallel computing method, and calculates the absolute value between the maximum value and the mean value of the three primary color values ​​of each pixel point in the original image, thereby adjusting the warm tone of the image based on the preset warm tone adjustment algorithm, and adjusting the cold tone of the image based on the preset cold tone adjustment algorithm. It adopts the GPU parallel processing method and reduces the complexity of the tone adjustment algorithm at the same time, effectively reducing the performance consumption of the hardware equipment, avoiding excessive heating of the live broadcast equipment, and ensuring the normal live broadcast of the anchor.

[0138] The above description is only a specific implementation of the present application, so that those skilled in the art can understand or implement the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein can be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest range consistent with the principles and novel features applied for herein.

[0139] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems) and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the process in the flowchart. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

Claims

1. A method for adjusting image tone, characterized in that: The specific steps include: Based on the GPU parallel computing method, the vector dot multiplication between each pixel in the original image and the preset pixel is calculated to obtain the mean value of the three primary color values ​​of each pixel in the original image; Calculate the maximum value of the three primary colors of each pixel in the original image, and calculate the absolute value of the difference between the maximum value of the three primary colors of each pixel in the original image and the mean value of the three primary colors of each pixel in the original image; Determine the image tone adjustment type: When warm tone adjustment is performed, the three primary color values ​​of the pixels in the original image are adjusted to warm tone according to the absolute value calculation result and based on a preset warm tone adjustment algorithm; When the adjustment is for cold tones, the three primary color values ​​of the pixels in the original image are adjusted for cold tones according to the absolute value calculation result and based on a preset cold tones adjustment algorithm; The vector dot multiplication between each pixel in the original image and the preset pixel is calculated to obtain the mean of the three primary color values ​​of each pixel in the original image. The specific calculation formula for the vector dot multiplication is: avg = r* r1 + g * g1 + b* b1 Wherein, avg represents the average of the three primary colors of the pixel in the original image, r represents the R value of the three primary colors of the pixel in the original image, g represents the G value of the three primary colors of the pixel in the original image, b represents the B value of the three primary colors of the pixel in the original image, r1 represents the R value of the three primary colors of the preset pixel, g1 represents the G value of the three primary colors of the preset pixel, b1 represents the B value of the three primary colors of the preset pixel, and the R value, G value and B value of the three primary colors of the preset pixel are all 128; According to the absolute value calculation result and based on the preset warm tone adjustment algorithm, the three primary color values ​​of the pixels in the original image are adjusted to warm tones. The specific algorithm for adjusting the three primary color values ​​of the pixels in the original image to warm tones is: r2 = r - (max - r )*abs *ɑ g2 = g - (max - g )*abs * ɑ b2 = b - (max - b )*abs * ɑ Wherein, r2 represents the R value of the three primary colors of the pixel after the warm tone adjustment, g2 represents the G value of the three primary colors of the pixel after the warm tone adjustment, b2 represents the B value of the three primary colors of the pixel after the warm tone adjustment, ɑ is the warm tone intensity adjustment parameter, max represents the maximum value of the three primary colors of the pixel in the original image, and abs represents the absolute value of the difference between the maximum value of the three primary colors of each pixel in the original image and the mean value of the three primary colors of each pixel in the original image; According to the absolute value calculation result and based on the preset cold tone adjustment algorithm, the three primary color values ​​of the pixels in the original image are adjusted to cold tones. The specific algorithm for adjusting the three primary color values ​​of the pixels in the original image to cold tones is: r3 = r + (max - r )*abs *β g3 = g + (max - g )*abs * β b3 = b + (max - b )*abs * β Among them, r3 represents the R value of the three primary colors of the pixel after the cold tone adjustment, g3 represents the G value of the three primary colors of the pixel after the cold tone adjustment, b3 represents the B value of the three primary colors of the pixel after the cold tone adjustment, and β is the cold tone intensity adjustment parameter.

2. The image tone adjustment method according to claim 1, characterized in that: The calculation to obtain the maximum value of the three primary color values ​​of each pixel in the original image specifically includes the following steps: Based on GPU parallel computing, the R value, G value and B value of the three primary colors of a single pixel in the original image are obtained simultaneously; The R value, G value, and B value of the three primary colors of the current pixel are compared with each other, and the largest value is taken as the maximum value of the three primary colors of the current pixel.

3. The image tone adjustment method according to claim 2, characterized in that: The absolute value of the difference between the maximum value of the three primary color values ​​of each pixel in the original image and the mean value of the three primary color values ​​of each pixel in the original image is calculated, and the specific calculation formula is: Wherein, abs represents the absolute value of the difference between the maximum value of the three primary color values ​​of each pixel in the original image and the mean value of the three primary color values ​​of each pixel in the original image, and max represents the maximum value of the three primary color values ​​of the pixel in the original image.

4. The method for adjusting image tone according to claim 3, characterized in that: After the three primary color values ​​of the pixels in the original image are adjusted to warm tones, the method further includes: determining whether the three primary color values ​​of the pixels after the warm tones adjustment are out of bounds, and processing the out-of-bounds pixels; The step of judging whether the three primary color values ​​of the pixel point after the warm tone adjustment are out of bounds and processing the out-of-bounds pixel point specifically includes: When r2>255, the value of r2 is replaced by 255; when r2 is less than 0, the value of r2 is replaced by 0; when 0≤r2≤255, the value of r2 is not processed; When g2>255, the value of g2 is replaced by 255; when g2 is less than 0, the value of g2 is replaced by 0; when 0≤g2≤255, the value of g2 is not processed; When b2>255, the value of b2 is replaced by 255. When b2 is less than 0, the value of b2 is replaced by 0. When 0≤b2≤255, the value of b2 is not processed.

5. The image tone adjustment method according to claim 3, characterized in that: After the three primary color values ​​of the pixels in the original image are adjusted to cold tones, the method further includes: determining whether the three primary color values ​​of the pixels after the cold tones adjustment are out of bounds, and processing the out-of-bounds pixels; The specific steps of judging whether the three primary color values ​​of the pixel point after the cold tone adjustment are out of bounds and processing the out-of-bounds pixel point include: When r3>255, the value of r3 is replaced by 255; when r3 is less than 0, the value of r3 is replaced by 0; when 0≤r3≤255, the value of r3 is not processed; When g3>255, the value of g3 is replaced by 255; when g3 is less than 0, the value of g3 is replaced by 0; when 0≤g3≤255, the value of g3 is not processed; When b3>255, the value of b3 is replaced by 255; when b3 is less than 0, the value of b3 is replaced by 0; when 0≤b3≤255, the value of b3 is not processed.

6. A storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the steps of the method according to any one of claims 1 to 5 are implemented.

7. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the steps of the method according to any one of claims 1 to 5 are implemented.

8. An image tone adjustment system, characterized in that: include: The mean value calculation module is used to drive the GPU to work and adopt a parallel computing method to calculate the vector dot multiplication between each pixel point in the original image and the preset pixel point, and obtain the mean value of the three primary color values ​​of each pixel point in the original image; An absolute value calculation module is used to calculate the maximum value of the three primary color values ​​of each pixel in the original image, and calculate the absolute value of the difference between the maximum value of the three primary color values ​​of each pixel in the original image and the mean value of the three primary color values ​​of each pixel in the original image; A judging module, which is used to judge the type of image tone adjustment, and when it is warm tone adjustment, drives the warm tone adjustment module to work, and when it is cold tone adjustment, drives the cold tone adjustment module to work; A warm tone adjustment module, which is used to perform warm tone adjustment on the three primary color values ​​of the pixel points in the original image according to the absolute value calculation result and based on a preset warm tone adjustment algorithm; A cold tone adjustment module, which is used to perform cold tone adjustment on the three primary color values ​​of the pixel points in the original image according to the absolute value calculation result and based on a preset cold tone adjustment algorithm; The vector dot multiplication between each pixel in the original image and the preset pixel is calculated to obtain the mean of the three primary color values ​​of each pixel in the original image. The specific calculation formula for the vector dot multiplication is: avg = r* r1 + g * g1 + b* b1 Wherein, avg represents the average of the three primary colors of the pixel in the original image, r represents the R value of the three primary colors of the pixel in the original image, g represents the G value of the three primary colors of the pixel in the original image, b represents the B value of the three primary colors of the pixel in the original image, r1 represents the R value of the three primary colors of the preset pixel, g1 represents the G value of the three primary colors of the preset pixel, b1 represents the B value of the three primary colors of the preset pixel, and the R value, G value and B value of the three primary colors of the preset pixel are all 128; According to the absolute value calculation result and based on the preset warm tone adjustment algorithm, the three primary color values ​​of the pixels in the original image are adjusted to warm tones. The specific algorithm for adjusting the three primary color values ​​of the pixels in the original image to warm tones is: r2 = r - (max - r )*abs *ɑ g2 = g - (max - g )*abs * ɑ b2 = b - (max - b )*abs * ɑ Wherein, r2 represents the R value of the three primary colors of the pixel after the warm tone adjustment, g2 represents the G value of the three primary colors of the pixel after the warm tone adjustment, b2 represents the B value of the three primary colors of the pixel after the warm tone adjustment, ɑ is the warm tone intensity adjustment parameter, max represents the maximum value of the three primary colors of the pixel in the original image, and abs represents the absolute value of the difference between the maximum value of the three primary colors of each pixel in the original image and the mean value of the three primary colors of each pixel in the original image; According to the absolute value calculation result and based on the preset cold tone adjustment algorithm, the three primary color values ​​of the pixels in the original image are adjusted to cold tones. The specific algorithm for adjusting the three primary color values ​​of the pixels in the original image to cold tones is: r3 = r + (max - r )*abs *β g3 = g + (max - g )*abs * β b3 = b + (max - b )*abs * β Among them, r3 represents the R value of the three primary colors of the pixel after the cold tone adjustment, g3 represents the G value of the three primary colors of the pixel after the cold tone adjustment, b3 represents the B value of the three primary colors of the pixel after the cold tone adjustment, and β is the cold tone intensity adjustment parameter.