Color adjusting method, color adjusting device and electronic equipment

By selecting multiple primary colors in the hue loop and setting corresponding parameters, the problem of color overflow and large amount of calculations in image color adjustment is solved, and the natural transition and fine adjustment of color adjustment is achieved, which improves the image visual effect.

CN119094716APending Publication Date: 2024-12-06QINGDAO NOVELBEAM TECH
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411245070.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-06
Publication Date
2024-12-06

AI Technical Summary

Technical Problem

The prior art has color overflow problems in image color adjustment, which is large in calculation volume and difficult to achieve refined adjustments, and it is not possible to effectively distinguish between color and adjust saturation and brightness.

Method used

By selecting at least three primary colors in the hue loop, setting the hue offset parameters, saturation offset parameters and brightness offset parameters, calculating the fusion weight value and adjustment value, achieving fine adjustment of the image color, avoiding color overflow, and improving Image visual effects.

Benefits of technology

It realizes a natural transition of color adjustment, reduces the amount of computing, facilitates processor portability, can finely adjust the saturation and brightness of specific colors, and improves the visual effect of the image.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119094716A_ABST
    Figure CN119094716A_ABST
Patent Text Reader

Abstract

The invention provides a color adjusting method, a color adjusting device and electronic equipment. The color adjustment method comprises the steps of obtaining an image of which the color is to be adjusted, and obtaining an R pixel value, a G pixel value and a B pixel value of a target pixel of the image of which the color is to be adjusted according to the image of which the color is to be adjusted; obtaining fusion weight values of the N primary colors according to the normalized HSV values and the initialized hue coordinates; obtaining a hue adjustment value, a saturation adjustment value and a brightness adjustment value according to the normalized HSV value, the hue shift parameter, the saturation shift parameter and the brightness shift parameter; converting the hue adjustment value, the saturation adjustment value and the brightness adjustment value into an R pixel value adjustment value, a G pixel value adjustment value and a B pixel value adjustment value; and obtaining a final pixel value of the target pixel according to the R pixel value adjustment value, the G pixel value adjustment value, the B pixel value adjustment value and the fusion weight value after adjustment.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to a color adjustment method, a color adjustment device and an electronic device. Background Art

[0002] This section merely provides background information related to the present disclosure and is not necessarily prior art.

[0003] Image color adjustment plays an important role in image processing. By adjusting the color of an image, you can improve the visual effect of the image and make it more consistent with the expected performance. Local image color adjustment that distinguishes colors is a more sophisticated image processing technique that can adjust specific color areas in the image.

[0004] In a feasible color adjustment method, when adjusting a specific color, it will affect the adjacent color area and cause color overflow, making the image look unnatural. Moreover, these color adjustment methods have a large amount of calculation and a long calculation processing time.

[0005] Chinese invention patent application 201910185165.3 discloses a solution to the hue ring jump problem in the HSV color space, which includes the following steps: 1. Calculation of the hue average value of the image area in the HSV color space; 2. Calculation of the distance between two hue values; 3. Calculation of the hue standard deviation for all pixels in the image area; The present invention analyzes the hue histogram and finds the position of the largest gap, transforms the hue ring coordinate system, and thus solves the interference of the hue ring jump problem on the hue average value, hue distance, hue standard deviation and other problems, thereby improving the practicality of HSV.

[0006] However, the Chinese invention patent application 201910185165.3 has the following shortcomings: 1. It fails to distinguish colors and fine-tune colors; 2. It requires statistical information such as hue histogram and hue standard deviation, which greatly affects the efficiency of the image algorithm.

[0007] Chinese invention patent application 202311171334.0 discloses a hue adjustment method, device and readable storage medium. The hue adjustment method includes: obtaining the original RGB data of the image, hue adjustment parameters and multiple color correction matrices; determining the target correction matrix according to the hue adjustment parameters and the multiple color correction matrices; and obtaining the corrected RGB data of the image according to the original RGB data of the image and the target correction matrix. By using the target correction matrix to process the original RGB data of the image, the processing logic of the hue adjustment operation is simplified, and the computational complexity and the cost of the hue adjustment device are reduced.

[0008] However, the Chinese invention patent application 202311171334.0 has the following shortcomings: 1. Color adjustment is performed in a matrix manner, which requires too many matrix parameters and is complicated; 2. Color adjustment is not performed.

[0009] Chinese invention patent application 201310544255.X discloses a saturation adjustment method, which includes the following steps: cutting a hue ring into multiple hue zones, and cutting each hue zone into multiple saturation zones with at least one threshold saturation. Weighting multiple first input saturations of a first saturation zone of a first hue zone of these hue zones with a first weighting formula to obtain multiple first output saturations. Weighting multiple second input saturations of a second saturation zone of a first hue zone of these hue zones with a second weighting formula to obtain multiple second output saturations, wherein the first weighting formula is different from the second weighting formula.

[0010] However, the Chinese invention patent application 201310544255.X has the following shortcomings: 1. It fails to adjust the brightness of a specified color; 2. It focuses on saturation adjustment and fails to reflect information such as hue. Summary of the invention

[0011] In order to solve one of the above technical problems, the present disclosure provides a color adjustment method, a color adjustment device and an electronic device.

[0012] According to one aspect of the present disclosure, there is provided a color adjustment method, comprising: According to the normalized hue values ​​of N primary colors, the initial hue coordinates are obtained; wherein N is greater than or equal to 3; According to the color adjustment requirements, set the hue offset parameters, saturation offset parameters and brightness offset parameters of N primary colors; Obtaining an image to be adjusted in color, and obtaining an R pixel value, a G pixel value, and a B pixel value of a target pixel of the image to be adjusted in color according to the image to be adjusted in color; Convert the R pixel value, G pixel value and B pixel value of the target pixel into normalized HSV values; Obtain the fusion weight values ​​of N primary colors according to the normalized HSV value and the initialized hue coordinates; Obtaining a hue adjustment value, a saturation adjustment value, and a brightness adjustment value according to the normalized HSV value, the hue shift parameter, the saturation shift parameter, and the brightness shift parameter; Converting the hue adjustment value, the saturation adjustment value, and the brightness adjustment value into an R pixel value adjustment value, a G pixel value adjustment value, and a B pixel value adjustment value; The final pixel value of the target pixel is obtained according to the adjusted R pixel value adjustment value, G pixel value adjustment value, B pixel value adjustment value and the fusion weight value.

[0013] According to the color adjustment method of at least one embodiment of the present disclosure, the fusion weight value W of N primary colors is obtained according to the normalized HSV value and the initialized hue coordinates. c include: ; Among them, MAX is the maximum value function; ; h is the h value in the normalized HSV value; is the initial hue coordinate; .

[0014] According to the color adjustment method of at least one embodiment of the present disclosure, obtaining an adjusted HSV value according to the normalized HSV value, the hue shift parameter, the saturation shift parameter, and the brightness shift parameter includes: Get the hue adjustment value based on the h value in the normalized HSV value and the hue shift parameter ; ; in, is the hue shift parameter.

[0015] According to the color adjustment method of at least one embodiment of the present disclosure, obtaining an adjusted HSV value according to the normalized HSV value, the hue shift parameter, the saturation shift parameter, and the brightness shift parameter includes: Get the saturation adjustment value according to the s value in the normalized HSV value and the saturation offset parameter ; ; ; in, is the global saturation parameter; is the saturation offset parameter.

[0016] According to the color adjustment method of at least one embodiment of the present disclosure, obtaining an adjusted HSV value according to the normalized HSV value, the hue shift parameter, the saturation shift parameter, and the brightness shift parameter includes: Get the brightness adjustment value according to the v value in the normalized HSV value and the brightness offset parameter ; ; ; in, is the brightness offset parameter.

[0017] According to the color adjustment method of at least one embodiment of the present disclosure, obtaining the final pixel value of the target pixel according to the adjusted R pixel value adjustment value, G pixel value adjustment value, B pixel value adjustment value and fusion weight value includes: ; ; ; in, Adjust the value for the R pixel value; Adjust the value for the G pixel value; Adjust the value for the b pixel value.

[0018] According to the color adjustment method of at least one embodiment of the present disclosure, the value range of the hue shift parameter, the saturation shift parameter, the brightness shift parameter and the global saturation parameter is [-1, 1].

[0019] According to the color adjustment method of at least one embodiment of the present disclosure, the N primary colors include a red primary color, a green primary color, and a blue primary color.

[0020] According to another aspect of the present disclosure, there is provided a color adjustment device, comprising: An initial hue value acquisition module, the initial hue value acquisition module is used to obtain initial hue coordinates according to the normalized hue values ​​of N primary colors, wherein N is greater than or equal to 3; A parameter setting module, wherein the parameter setting module sets hue shift parameters, saturation shift parameters, and brightness shift parameters of N primary colors according to color adjustment requirements; A pixel value acquisition module, the pixel value acquisition module is used to obtain the image to be adjusted in color, and obtain the R pixel value, G pixel value and B pixel value of the target pixel of the image to be adjusted in color according to the image to be adjusted in color; An HSV value acquisition module, wherein the HSV value acquisition module is used to convert the R pixel value, the G pixel value and the B pixel value of the target pixel into a normalized HSV value; A fusion weight value acquisition module, which is used to obtain fusion weight values ​​of N primary colors according to normalized HSV values ​​and initialized hue coordinates; A first adjustment value acquisition module, the first adjustment value acquisition module is used to obtain a hue adjustment value, a saturation adjustment value and a brightness adjustment value according to the normalized HSV value, the hue shift parameter, the saturation shift parameter and the brightness shift parameter; a second adjustment value acquisition module, the second adjustment value acquisition module being used to convert the hue adjustment value, the saturation adjustment value and the brightness adjustment value into an R pixel value adjustment value, a G pixel value adjustment value and a B pixel value adjustment value; and The final pixel value calculation module is used to obtain the final pixel value of the target pixel according to the adjusted R pixel value adjustment value, G pixel value adjustment value, B pixel value adjustment value and fusion weight value.

[0021] According to another aspect of the present disclosure, there is provided an electronic device, comprising: a memory storing execution instructions; and A processor executes the execution instruction stored in the memory, so that the processor executes the color adjustment method. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] The accompanying drawings illustrate exemplary embodiments of the present disclosure and together with the description serve to explain the principles of the present disclosure. These drawings are included to provide a further understanding of the present disclosure and are incorporated in and constitute a part of this specification.

[0023] Figure 1 is a flow chart of a color adjustment method according to one embodiment of the present disclosure.

[0024] Figure 2 is a structural block diagram of a color adjustment device according to an embodiment of the present disclosure. DETAILED DESCRIPTION

[0025] The present disclosure is further described in detail below in conjunction with the accompanying drawings and implementations. It is understood that the specific implementations described herein are only used to explain the relevant content, rather than to limit the present disclosure. It should also be noted that, for ease of description, only the parts related to the present disclosure are shown in the accompanying drawings.

[0026] It should be noted that, in the absence of conflict, the embodiments and features of the embodiments in the present disclosure can be combined with each other. The technical solution of the present disclosure will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.

[0027] Unless otherwise specified, the exemplary embodiments / embodiments shown will be understood as providing exemplary features of various details of some ways in which the technical concept of the present disclosure can be implemented in practice. Therefore, unless otherwise specified, the features of the various embodiments / embodiments can be combined, separated, interchanged and / or rearranged without departing from the technical concept of the present disclosure.

[0028] The use of cross-hatching and / or shading in the accompanying drawings is generally used to make the boundaries between adjacent components clear. As such, unless otherwise specified, the presence or absence of cross-hatching or shading does not convey or indicate any preference or requirement for the specific materials, material properties, dimensions, proportions, commonalities between the components shown, and / or any other characteristics, attributes, properties, etc. of the components. In addition, in the accompanying drawings, the sizes and relative sizes of the components may be exaggerated for clarity and / or descriptive purposes. When the exemplary embodiments can be implemented differently, the specific process sequence can be performed in a different order than described. For example, two successively described processes can be performed substantially simultaneously or in an order opposite to the described order. In addition, the same figure numbers represent the same components.

[0029] The terms used here are for the purpose of describing specific embodiments, and are not intended to be restrictive. As used here, unless the context clearly indicates otherwise, the singular forms "one (kind, person)" and "said (the)" are also intended to include plural forms. In addition, when the terms "comprise" and / or "include" and their variations are used in this specification, it is explained that there are stated features, integral bodies, steps, operations, parts, assemblies and / or their groups, but it is not excluded that there are or add one or more other features, integral bodies, steps, operations, parts, assemblies and / or their groups. It should also be noted that, as used here, the terms "substantially", "approximately" and other similar terms are used as approximate terms and not as degree terms, so that they are used to explain the inherent deviations of the measured values, calculated values ​​and / or the values ​​provided that will be recognized by those of ordinary skill in the art.

[0030] Figure 1 is a flow chart of a color adjustment method according to one embodiment of the present disclosure.

[0031] like Figure 1 As shown, the color adjustment method of the present disclosure may include: S102, obtaining initial hue coordinates according to the normalized hue values ​​of N primary colors, wherein N is greater than or equal to 3; S104, setting hue shift parameters, saturation shift parameters, and brightness shift parameters of N primary colors according to color adjustment requirements; S106, obtaining an image to be adjusted in color, and obtaining an R pixel value, a G pixel value, and a B pixel value of a target pixel of the image to be adjusted in color according to the image to be adjusted in color; S108, converting the R pixel value, the G pixel value, and the B pixel value of the target pixel into normalized HSV values; S110, obtaining fusion weight values ​​of N primary colors according to the normalized HSV value and the initialized hue coordinates; S112, obtaining a hue adjustment value, a saturation adjustment value, and a brightness adjustment value according to the normalized HSV value, the hue shift parameter, the saturation shift parameter, and the brightness shift parameter; S114, converting the hue adjustment value, the saturation adjustment value, and the brightness adjustment value into an R pixel value adjustment value, a G pixel value adjustment value, and a B pixel value adjustment value; and S116 , obtaining a final pixel value of the target pixel according to the adjusted R pixel value adjustment value, G pixel value adjustment value, B pixel value adjustment value and the fusion weight value.

[0032] The color adjustment method in the prior art often uses the same value to adjust the hue of all colors in the image. This method of color adjustment will result in unnatural color transition. In the present disclosure, by selecting at least three colors in the hue circle (the at least three colors can be the colors of interest in the usage scenario), the hue circle is divided into different areas; for the image to be adjusted (i.e., the input image), a fusion weight value is obtained to limit the color from slowly overflowing so that the transition is natural. Moreover, compared with the prior art, the color adjustment method of the present disclosure has a small amount of computation and is convenient for transplantation to processors such as FPGA.

[0033] The content of the present disclosure will be described in detail below in conjunction with specific implementation forms.

[0034] S102: Obtain initial hue coordinates according to the normalized hue values ​​of the N primary colors. , , ; Where N is greater than or equal to 3, and c is [1, N].

[0035] In some embodiments, more than three colors can be selected from the color wheel as the N primary colors. In a specific embodiment, the N primary colors can be red primary color, blue primary color and green primary color, and there is an angle of 120 degrees between two of the three colors.

[0036] N can also be selected as other values ​​such as 4, 5, 6, etc. When the value of N is larger, although it has a better color adjustment effect, it will increase the amount of calculation of the color adjustment method of the present disclosure. Based on this, in the present disclosure, a suitable value of N can be selected based on the two influencing factors of the amount of calculation and the color adjustment effect.

[0037] The selection of primary colors can be determined according to the color adjustment requirements of the input image. In other words, the main colors that need to be adjusted in the input image can be selected as primary colors, and the final effect of the input image after color adjustment is jointly determined by the adjustment amounts of these N primary colors.

[0038] Taking the red primary color, blue primary color and green primary color as examples, the hue values ​​of these three primary colors after normalization are: ( ), Green primary color , blue primary color , thus, a set of ordered initial hue coordinates can be obtained .

[0039] In another embodiment, if a more refined distinction in color adjustment is required in a scene application, six primary colors, namely, red, yellow, green, cyan, blue, and magenta, are defined, and initial hue coordinates are obtained based on the six primary colors: = .

[0040] The initial hue coordinates obtained by other numbers of primary colors will not be described in detail in this disclosure.

[0041] S104 . According to color adjustment requirements, hue shift parameters, saturation shift parameters, and brightness shift parameters of the N primary colors are set.

[0042] In the present disclosure, the hue shift parameter may be set as: .

[0043] The saturation offset parameter can be set to: .

[0044] The brightness offset parameter can be set to: .

[0045] in, , The value range can be [-1,1].

[0046] Specifically, when you need to change one or several colors in the image to replace them with adjacent (-)\(+) colors in the hue circle, you need to adjust them through the hue offset parameter. Similarly, when you need to increase (+) or decrease (-) the vividness of one or several colors, you need to adjust them through the saturation offset parameter. When you need to increase (+) or decrease (-) the brightness of one or several colors, you need to adjust them through the brightness offset parameter.

[0047] In a specific embodiment, the red color tends to be magenta, but the actual color is pure red, and the overall saturation is too high, the brightness is too high, and the red is too bright, so the hue, saturation, and brightness parameters of the corresponding color need to be adjusted.

[0048] Thus, the parameters corresponding to red in the hue shift parameters can be set. , the purpose is to correct from magenta to red; set the global saturation parameter The purpose is to reduce the overall saturation; set the parameter corresponding to red in the saturation offset parameter The purpose is to reduce the red saturation and set the parameter corresponding to red in the brightness offset parameter The purpose is to reduce the red brightness value. Other parameters are set to the default value 0.

[0049] In addition, when the saturation of the entire image needs to be modified (-)\(+), it needs to be adjusted through the global saturation parameter. The global saturation parameter will be used below.

[0050] S106 , obtaining an image to be adjusted in color, and obtaining R pixel values, G pixel values, and B pixel values ​​of target pixels of the image to be adjusted in color according to the image to be adjusted in color.

[0051] In a preferred embodiment, the image whose color is to be adjusted may also be referred to as an input image, which may be a JPG image, and from which the R pixel value, G pixel value, and B pixel value of each pixel of the image whose color is to be adjusted can be directly obtained. Accordingly, some or all pixels of all pixels of the input image are selected as target pixels, and the target pixels are adjusted so that the input image produces a color adjustment effect.

[0052] S108 . Convert the R pixel value, G pixel value, and B pixel value of the target pixel into normalized HSV values.

[0053] In the present disclosure, a commonly used RGB to HSV conversion formula may be used to obtain an HSV value, and the HSV value may be normalized to obtain a normalized HSV value.

[0054] S110 , obtaining fusion weight values ​​of N primary colors according to the normalized HSV values ​​and the initialized hue coordinates.

[0055] Specifically, the fusion weight value W c It can be calculated by the following formula: ; Among them, MAX is the maximum value function; ; MIN is the minimum function; h is the h value in the normalized HSV value; is the initial hue coordinate; .

[0056] In other words, the clip function can make The value range of is [0, 1]; it should also be noted that the initial hue coordinates can be used cyclically, for example Right now ;at the same time, Right now .

[0057] In other words, in the present disclosure, the influence of each primary color adjustment amount on the final result of the target pixel can be controlled according to the difference between the hue value (h) of the target pixel and the hue values ​​of the N primary colors. The closer the colors are, the higher the fusion weight.

[0058] S112: Obtain a hue adjustment value, a saturation adjustment value, and a brightness adjustment value according to the normalized HSV value, the hue shift parameter, the saturation shift parameter, and the brightness shift parameter.

[0059] Specifically, in the present disclosure, if the hue shift parameter of a certain color is a positive value, the color will be shifted clockwise toward its adjacent color; if the hue shift parameter of a certain color is a negative value, the color will be shifted counterclockwise toward its adjacent color.

[0060] That is, the hue adjustment value is obtained according to the h value in the normalized HSV value and the hue shift parameter : ; in, is the hue shift parameter.

[0061] On the other hand, the present disclosure can also be used according to the s value in the normalized HSV value and the saturation offset parameter Get saturation adjustment value ; ; ; in, is the global saturation parameter, and its value range is [-1,1]; is the saturation offset parameter.

[0062] That is to say, if the saturation offset parameter of a certain color is a positive value, the saturation of the color is increased; if the saturation offset parameter of a certain color is a negative value, the saturation of the color is reduced; at the same time, the saturation of the color is affected by the global saturation parameter, so the saturation of the input image can be adjusted jointly by the global saturation parameter and the saturation offset parameter.

[0063] Furthermore, the brightness adjustment value is obtained according to the v value in the normalized HSV value and the brightness offset parameter ; ; ; in, is the brightness offset parameter; is the saturation adjustment value calculated above.

[0064] If the brightness offset parameter of a certain color is a positive value, the brightness of the color is increased; if the brightness offset parameter of a certain color is a negative value, the brightness of the color is reduced; at the same time, the brightness adjustment value of the present invention can be affected by the saturation adjustment value. Therefore, in the present invention, when the saturation is high, the brightness can be increased more quickly, so that the input image has a better color adjustment effect; in addition, it can also reduce the impact of non-fixed hue when the hue is close to gray, black, etc.

[0065] S114 , converting the hue adjustment value, the saturation adjustment value, and the brightness adjustment value into an R pixel value adjustment value, a G pixel value adjustment value, and a B pixel value adjustment value.

[0066] In the present disclosure, a group of target pixels ( , , ) is converted to a set of target pixels ( , , ).

[0067] Among them, the ( , , ) is an N×3 matrix, or in other words, it includes N×3 elements. Accordingly, ( , , ) is also an N×3 matrix, or in other words, it includes N×3 elements.

[0068] S116 , obtaining a final pixel value of the target pixel according to the adjusted R pixel value adjustment value, G pixel value adjustment value, B pixel value adjustment value and the fusion weight value.

[0069] Specifically, the final pixel value of the target pixel value is obtained by weighted combination of the adjustment results of each primary color.

[0070] The R component of the final pixel value of the destination pixel: ; The G component of the final pixel value of the target pixel: ; The B component of the final pixel value of the destination pixel: ; in, Adjust the value for the R pixel value; Adjust the value for the G pixel value; Adjust the value for the b pixel value.

[0071] Generally speaking, the color adjustment method disclosed in the present invention first defines N primary colors (colors of interest), sets parameters according to these N primary colors, and adjusts the target pixels in the input image in segments by color; at the same time, the global saturation parameter and the local saturation offset parameter can also be set to adjust the saturation of the image. Therefore, the color adjustment method disclosed in the present invention solves the problem that the adjustment of differentiated colors will affect adjacent color areas and cause color overflow, and can adjust the saturation, brightness and other information of a specific color, and adjust the image hue, saturation, and brightness information according to the color of interest, thereby more finely improving the image visual effect.

[0072] Figure 2 The figure is a schematic block diagram of the structure of a color adjustment device using a hardware implementation of a processor according to an embodiment of the present disclosure.

[0073] The color adjustment device may include corresponding modules for executing each or several steps in the above flowchart. Therefore, each step or several steps in the above flowchart may be executed by the corresponding module, and the device may include one or more of these modules. The module may be one or more hardware modules specially configured to execute the corresponding steps, or implemented by a processor configured to execute the corresponding steps, or stored in a computer-readable medium for implementation by a processor, or implemented by some combination.

[0074] The hardware structure of the color adjustment device of the present disclosure can be implemented using a bus architecture. The bus architecture may include any number of interconnected buses and bridges, depending on the specific application and overall design constraints of the hardware. The bus 1100 connects various circuits including one or more processors 1200, memory 1300, and / or hardware modules together. The bus 1100 may also connect various other circuits 1400 such as peripherals, voltage regulators, power management circuits, external antennas, etc.

[0075] The bus 1100 may be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Component (EISA) bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, the figure only uses one connecting line, but does not mean that there is only one bus or one type of bus.

[0076] Any process or method description in the flowchart or otherwise described herein can be understood as a module, fragment or portion of a code representing one or more executable instructions for implementing the steps of a specific logical function or process, and the scope of the preferred embodiments of the present disclosure includes other implementations, in which the functions may not be performed in the order shown or discussed, including performing the functions in a substantially simultaneous manner or in a reverse order according to the functions involved, which should be understood by a person skilled in the art of the present disclosure. The processor performs the various methods and processes described above. For example, the method implementation in the present disclosure can be implemented as a software program, which is tangibly contained in a machine-readable medium, such as a memory. In some embodiments, part or all of the software program can be loaded and / or installed via a memory and / or a communication interface. When the software program is loaded into the memory and executed by the processor, one or more steps in the method described above can be performed. Alternatively, in other embodiments, the processor can be configured to perform one of the above methods in any other appropriate manner (e.g., by means of firmware).

[0077] The logic and / or steps represented in the flowchart or otherwise described herein may be embodied in any readable storage medium for use by an instruction execution system, apparatus, or device (such as a computer-based system, a system including a processor, or other system that can fetch instructions from and execute instructions on an instruction execution system, apparatus, or device), or in combination with such instruction execution systems, apparatuses, or devices.

[0078] For the purposes of this specification, a "readable storage medium" may be any device that can contain, store, communicate, propagate or transmit a program for use with or in conjunction with an instruction execution system, device or apparatus. More specific examples of readable storage media (a non-exhaustive list) include the following: an electrical connection with one or more wirings (electronic device), a portable computer disk case (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable and editable read-only memory (EPROM or flash memory), a fiber optic device, and a portable read-only memory (CDROM). In addition, the readable storage medium may even be paper or other suitable medium on which the program can be printed, since the program can be obtained electronically, for example, by optically scanning the paper or other medium, followed by editing, deciphering or, if necessary, processing in another suitable manner, and then stored in a memory.

[0079] It should be understood that the various parts of the present disclosure can be implemented in hardware, software, or a combination thereof. In the above-mentioned embodiments, multiple steps or methods can be implemented in software stored in a memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or their combination: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.

[0080] A person skilled in the art may understand that all or part of the steps of implementing the above-mentioned implementation method may be completed by instructing related hardware through a program, and the program may be stored in a readable storage medium, which, when executed, includes one or a combination of the steps of the implementation method.

[0081] In addition, each functional unit in each embodiment of the present disclosure may be integrated into a processing module, or each unit may exist physically separately, or two or more units may be integrated into one module. The above-mentioned integrated module may be implemented in the form of hardware or in the form of a software functional module. If the integrated module is implemented in the form of a software functional module and sold or used as an independent product, it may also be stored in a readable storage medium. The storage medium may be a read-only memory, a disk or an optical disk, etc.

[0082] refer to Figure 2 According to one embodiment of the present disclosure, the color adjustment device of the present disclosure includes an initial hue value acquisition module 1002, a parameter setting module 1004, a pixel value acquisition module 1006, an HSV value acquisition module 1008, a fusion weight value acquisition module 1010, a first adjustment value acquisition module 1012, a second adjustment value acquisition module 1014 and a final pixel value calculation module 1016.

[0083] The initial hue value acquisition module 1002 is used to obtain initial hue coordinates according to the normalized hue values ​​of N primary colors, where N is greater than or equal to 3; The parameter setting module 1004 sets the hue shift parameters, saturation shift parameters and brightness shift parameters of the N primary colors according to the color adjustment requirements; The pixel value acquisition module 1006 is used to obtain the image to be adjusted in color, and obtain the R pixel value, G pixel value and B pixel value of the target pixel of the image to be adjusted in color according to the image to be adjusted in color; The HSV value acquisition module 1008 is used to convert the R pixel value, the G pixel value and the B pixel value of the target pixel into a normalized HSV value; The fusion weight value acquisition module 1010 is used to obtain the fusion weight values ​​of N primary colors according to the normalized HSV value and the initialized hue coordinates; The first adjustment value acquisition module 1012 is used to obtain a hue adjustment value, a saturation adjustment value and a brightness adjustment value according to the normalized HSV value, the hue shift parameter, the saturation shift parameter and the brightness shift parameter; The second adjustment value acquisition module 1014 is used to convert the hue adjustment value, the saturation adjustment value and the brightness adjustment value into an R pixel value adjustment value, a G pixel value adjustment value and a B pixel value adjustment value; and The final pixel value calculation module 1016 is used to obtain the final pixel value of the target pixel according to the adjusted R pixel value adjustment value, G pixel value adjustment value, B pixel value adjustment value and the fusion weight value.

[0084] The color adjustment method in the prior art often uses the same value to adjust the hue of all colors in the image. This method of color adjustment will result in unnatural color transition. In the present disclosure, by selecting at least three colors in the hue circle (the at least three colors can be the colors of interest in the usage scenario), the hue circle is divided into different areas; for the image to be adjusted (i.e., the input image), a fusion weight value is obtained to limit the color from slowly overflowing so that the transition is natural. Moreover, compared with the prior art, the color adjustment method of the present disclosure has a small amount of computation and is convenient for transplantation to processors such as FPGA.

[0085] The content of the present disclosure will be described in detail below in conjunction with specific implementation forms.

[0086] S102: Obtain initial hue coordinates according to the normalized hue values ​​of the N primary colors. , , ; Where N is greater than or equal to 3, and c is [1, N].

[0087] In some embodiments, more than three colors can be selected from the color wheel as the N primary colors. In a specific embodiment, the N primary colors can be red primary color, blue primary color and green primary color, and there is an angle of 120 degrees between two of the three colors.

[0088] N can also be selected as other values ​​such as 4, 5, 6, etc. When the value of N is larger, although it has a better color adjustment effect, it will increase the amount of calculation of the color adjustment method of the present disclosure. Based on this, in the present disclosure, a suitable value of N can be selected based on the two influencing factors of the amount of calculation and the color adjustment effect.

[0089] The selection of primary colors can be determined according to the color adjustment requirements of the input image. In other words, the main colors that need to be adjusted in the input image can be selected as primary colors, and the final effect of the input image after color adjustment is jointly determined by the adjustment amounts of these N primary colors.

[0090] Taking the red primary color, blue primary color and green primary color as examples, the hue values ​​of these three primary colors after normalization are: ( ), Green primary color , blue primary color , thus, a set of ordered initial hue coordinates can be obtained .

[0091] In another embodiment, if a more refined distinction in color adjustment is required in a scene application, six primary colors, namely, red, yellow, green, cyan, blue, and magenta, are defined, and initial hue coordinates are obtained based on the six primary colors: = .

[0092] The initial hue coordinates obtained by other numbers of primary colors will not be described in detail in this disclosure.

[0093] S104 . According to color adjustment requirements, hue shift parameters, saturation shift parameters, and brightness shift parameters of the N primary colors are set.

[0094] In the present disclosure, the hue shift parameter may be set as: .

[0095] The saturation offset parameter can be set to: .

[0096] The brightness offset parameter can be set to: .

[0097] in, , The value range can be [-1,1].

[0098] Specifically, when you need to change one or several colors in the image to replace them with adjacent (-)\(+) colors in the hue circle, you need to adjust them through the hue offset parameter. Similarly, when you need to increase (+) or decrease (-) the vividness of one or several colors, you need to adjust them through the saturation offset parameter. When you need to increase (+) or decrease (-) the brightness of one or several colors, you need to adjust them through the brightness offset parameter.

[0099] In a specific embodiment, the red color tends to be magenta, but the actual color is pure red, and the overall saturation is too high, the brightness is too high, and the red is too bright, so the hue, saturation, and brightness parameters of the corresponding color need to be adjusted.

[0100] In addition, when the saturation of the entire image needs to be modified (-)\(+), it needs to be adjusted through the global saturation parameter. The global saturation parameter will be used below.

[0101] Thus, the parameters corresponding to red in the hue shift parameters can be set. , the purpose is to correct from magenta to red; set the global saturation parameter The purpose is to reduce the overall saturation; set the parameter corresponding to red in the saturation offset parameter The purpose is to reduce the red saturation and set the parameter corresponding to red in the brightness offset parameter The purpose is to reduce the red brightness value. Other parameters are set to the default value 0.

[0102] S106 , obtaining an image to be adjusted in color, and obtaining R pixel values, G pixel values, and B pixel values ​​of target pixels of the image to be adjusted in color according to the image to be adjusted in color.

[0103] In a preferred embodiment, the image whose color is to be adjusted may also be referred to as an input image, which may be a JPG image, and from which the R pixel value, G pixel value, and B pixel value of each pixel of the image whose color is to be adjusted can be directly obtained. Accordingly, some or all pixels of all pixels of the input image are selected as target pixels, and the target pixels are adjusted so that the input image produces a color adjustment effect.

[0104] S108 . Convert the R pixel value, G pixel value, and B pixel value of the target pixel into normalized HSV values.

[0105] In the present disclosure, a commonly used RGB to HSV conversion formula may be used to obtain an HSV value, and the HSV value may be normalized to obtain a normalized HSV value.

[0106] S110 , obtaining fusion weight values ​​of N primary colors according to the normalized HSV values ​​and the initialized hue coordinates.

[0107] Specifically, the fusion weight value W c It can be calculated by the following formula: ; Among them, MAX is the maximum value function; ; MIN is the minimum function; h is the h value in the normalized HSV value; is the initial hue coordinate; .

[0108] In other words, the clip function can make The value range of is [0, 1]; it should also be noted that the initial hue coordinates can be used cyclically, for example Right now ;at the same time, Right now .

[0109] In other words, in the present disclosure, the influence of each primary color adjustment amount on the final result of the target pixel can be controlled according to the difference between the hue value (h) of the target pixel and the hue values ​​of the N primary colors. The closer the colors are, the higher the fusion weight.

[0110] S112: Obtain a hue adjustment value, a saturation adjustment value, and a brightness adjustment value according to the normalized HSV value, the hue shift parameter, the saturation shift parameter, and the brightness shift parameter.

[0111] Specifically, in the present disclosure, if the hue shift parameter of a certain color is a positive value, the color will be shifted clockwise toward its adjacent color; if the hue shift parameter of a certain color is a negative value, the color will be shifted counterclockwise toward its adjacent color.

[0112] That is, the hue adjustment value is obtained according to the h value in the normalized HSV value and the hue shift parameter : ; in, is the hue shift parameter.

[0113] On the other hand, the present disclosure can also be used according to the s value in the normalized HSV value and the saturation offset parameter Get saturation adjustment value ; ; ; in, is the global saturation parameter, and its value range is [-1,1]; is the saturation offset parameter.

[0114] That is to say, if the saturation offset parameter of a certain color is a positive value, the saturation of the color is increased; if the saturation offset parameter of a certain color is a negative value, the saturation of the color is reduced; at the same time, the saturation of the color is affected by the global saturation parameter, so the saturation of the input image can be adjusted jointly by the global saturation parameter and the saturation offset parameter.

[0115] Furthermore, the brightness adjustment value is obtained according to the v value in the normalized HSV value and the brightness offset parameter ; ; ; in, is the brightness offset parameter; is the saturation adjustment value calculated above.

[0116] If the brightness offset parameter of a certain color is a positive value, the brightness of the color is increased; if the brightness offset parameter of a certain color is a negative value, the brightness of the color is reduced; at the same time, the brightness adjustment value of the present invention can be affected by the saturation adjustment value. Therefore, in the present invention, when the saturation is high, the brightness can be increased more quickly, so that the input image has a better color adjustment effect; in addition, it can also reduce the impact of non-fixed hue when the hue is close to gray, black, etc.

[0117] S114 , converting the hue adjustment value, the saturation adjustment value, and the brightness adjustment value into an R pixel value adjustment value, a G pixel value adjustment value, and a B pixel value adjustment value.

[0118] In the present disclosure, a group of target pixels ( , , ) is converted to a set of target pixels ( , , ).

[0119] Among them, the ( , , ) is an N×3 matrix. Accordingly, ( , , ) is also an N×3 matrix.

[0120] S116 , obtaining a final pixel value of the target pixel according to the adjusted R pixel value adjustment value, G pixel value adjustment value, B pixel value adjustment value and the fusion weight value.

[0121] Specifically, the final pixel value of the target pixel value is obtained by weighted combination of the adjustment results of each primary color.

[0122] The R component of the final pixel value of the destination pixel: ; The G component of the final pixel value of the target pixel: ; The B component of the final pixel value of the destination pixel: ; in, Adjust the value for the R pixel value; Adjust the value for the G pixel value; Adjust the value for the b pixel value.

[0123] Generally speaking, the color adjustment method disclosed in the present invention first defines N primary colors (colors of interest), sets parameters according to these N primary colors, and adjusts the target pixels in the input image in segments by color; at the same time, the global saturation parameter and the local saturation offset parameter can also be set to adjust the saturation of the image. Therefore, the color adjustment method disclosed in the present invention solves the problem that the adjustment of differentiated colors will affect adjacent color areas and cause color overflow, and can adjust the saturation, brightness and other information of a specific color, and adjust the image hue, saturation, and brightness information according to the color of interest, thereby more finely improving the image visual effect.

[0124] The present disclosure also provides an electronic device, including: a memory, the memory storing execution instructions; and a processor or other hardware module, the processor or other hardware module executes the execution instructions stored in the memory, so that the processor or other hardware module executes the above method.

[0125] The present disclosure also provides a readable storage medium, in which execution instructions are stored. When the execution instructions are executed by a processor, they are used to implement the above method.

[0126] In the description of this specification, the description with reference to the terms "one embodiment / method", "some embodiments / methods", "example", "specific example", or "some examples" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment / method or example are included in at least one embodiment / method or example of the present application. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment / method or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments / methods or examples in a suitable manner. In addition, those skilled in the art may combine and combine the different embodiments / methods or examples described in this specification and the features of the different embodiments / methods or examples, unless they are contradictory.

[0127] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" and "second" may explicitly or implicitly include at least one of the features. In the description of this application, the meaning of "plurality" is at least two, such as two, three, etc., unless otherwise clearly and specifically defined.

[0128] Those skilled in the art should understand that the above embodiments are only for the purpose of clearly illustrating the present disclosure, and are not intended to limit the scope of the present disclosure. For those skilled in the art, other changes or modifications may be made based on the above disclosure, and these changes or modifications are still within the scope of the present disclosure.

Claims

1. A color adjustment method, characterized in that: include: According to the normalized hue values ​​of N primary colors, the initial hue coordinates are obtained; Where N is greater than or equal to 3; According to the color adjustment requirements, set the hue offset parameters, saturation offset parameters and brightness offset parameters of N primary colors; Obtaining an image to be adjusted in color, and obtaining an R pixel value, a G pixel value, and a B pixel value of a target pixel of the image to be adjusted in color according to the image to be adjusted in color; Convert the R pixel value, G pixel value and B pixel value of the target pixel into normalized HSV values; Obtain the fusion weight values ​​of N primary colors according to the normalized HSV value and the initialized hue coordinates; Obtaining a hue adjustment value, a saturation adjustment value, and a brightness adjustment value according to the normalized HSV value, the hue shift parameter, the saturation shift parameter, and the brightness shift parameter; Converting the hue adjustment value, the saturation adjustment value, and the brightness adjustment value into an R pixel value adjustment value, a G pixel value adjustment value, and a B pixel value adjustment value; The final pixel value of the target pixel is obtained according to the adjusted R pixel value adjustment value, G pixel value adjustment value, B pixel value adjustment value and the fusion weight value.

2. The color adjustment method according to claim 1, characterized in that: According to the normalized HSV value and the initialized hue coordinates, the fusion weight value W of N primary colors is obtained. c include: ; Among them, MAX is the maximum value function; ; h is the h value in the normalized HSV value; is the initial hue coordinate; .

3. The color adjustment method according to claim 2, characterized in that: The adjusted HSV value obtained according to the normalized HSV value, the hue shift parameter, the saturation shift parameter, and the brightness shift parameter includes: Get the hue adjustment value based on the h value in the normalized HSV value and the hue shift parameter ; ; in, is the hue shift parameter.

4. The color adjustment method according to claim 3, characterized in that: The adjusted HSV value obtained according to the normalized HSV value, the hue shift parameter, the saturation shift parameter, and the brightness shift parameter includes: Get the saturation adjustment value according to the s value in the normalized HSV value and the saturation offset parameter ; ; ; in, is the global saturation parameter; is the saturation offset parameter.

5. The color adjustment method according to claim 4, characterized in that: The adjusted HSV value obtained according to the normalized HSV value, the hue shift parameter, the saturation shift parameter, and the brightness shift parameter includes: Get the brightness adjustment value according to the v value in the normalized HSV value and the brightness offset parameter ; ; ; in, is the brightness offset parameter.

6. The color adjustment method according to claim 5, characterized in that: The final pixel value of the target pixel is obtained according to the adjusted R pixel value adjustment value, G pixel value adjustment value, B pixel value adjustment value and fusion weight value, including: ; ; ; in, Adjust the value for the R pixel value; Adjust the value for the G pixel value; Adjust the value for the b pixel value.

7. The color adjustment method according to claim 4, characterized in that: The value range of the hue shift parameter, the saturation shift parameter, the brightness shift parameter and the global saturation parameter is [-1, 1].

8. The color adjustment method according to claim 1, characterized in that: The N primary colors include red, green, and blue.

9. A color adjustment device, characterized in that: include: An initial hue value acquisition module, the initial hue value acquisition module is used to obtain initial hue coordinates according to the normalized hue values ​​of N primary colors; Where N is greater than or equal to 3; A parameter setting module, wherein the parameter setting module sets hue shift parameters, saturation shift parameters, and brightness shift parameters of N primary colors according to color adjustment requirements; A pixel value acquisition module, the pixel value acquisition module is used to obtain the image to be adjusted in color, and obtain the R pixel value, G pixel value and B pixel value of the target pixel of the image to be adjusted in color according to the image to be adjusted in color; An HSV value acquisition module, wherein the HSV value acquisition module is used to convert the R pixel value, the G pixel value and the B pixel value of the target pixel into a normalized HSV value; A fusion weight value acquisition module, which is used to obtain fusion weight values ​​of N primary colors according to normalized HSV values ​​and initialized hue coordinates; A first adjustment value acquisition module, the first adjustment value acquisition module is used to obtain a hue adjustment value, a saturation adjustment value and a brightness adjustment value according to the normalized HSV value, the hue shift parameter, the saturation shift parameter and the brightness shift parameter; a second adjustment value acquisition module, the second adjustment value acquisition module being used to convert the hue adjustment value, the saturation adjustment value and the brightness adjustment value into an R pixel value adjustment value, a G pixel value adjustment value and a B pixel value adjustment value; as well as The final pixel value calculation module is used to obtain the final pixel value of the target pixel according to the adjusted R pixel value adjustment value, G pixel value adjustment value, B pixel value adjustment value and fusion weight value.

10. An electronic device, characterized in that: include: A memory storing execution instructions; as well as A processor, wherein the processor executes the execution instruction stored in the memory, so that the processor executes the color adjustment method according to any one of claims 1 to 8.

Citation Information

Cited By

  • Plate imaging characteristic difference improving method based on ISP algorithm

    CN120410943A