Color adjusting method, color adjusting device, electronic equipment and readable medium
By obtaining the color adjustment requests and parameters in the video screen, and determining the target RGB data according to the preset area division type for color adjustment, the problem of inflexible color adjustment in the video screen in the prior art is solved, and the flexibility of local color adjustment is achieved and Accuracy.
Patent Information
- Application Number
- CN202411489256.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-23
- Publication Date
- 2024-12-03
AI Technical Summary
The existing video picture color adjustment methods lack flexibility and cannot be partially adjusted for different color areas.
By obtaining the color adjustment area and parameters in the color adjustment request, the target RGB data is determined according to the preset area division type, thereby performing targeted color adjustment processing to achieve local color adjustment.
It improves the flexibility of color adjustment of video images, can be adjusted locally according to different areas, and enhances the accuracy and flexibility of color adjustment.
Smart Images

Figure CN119071406A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the technical field of data processing, and in particular to a color adjustment method, a color adjustment device, an electronic device, and a readable medium. Background Art
[0002] Video screen color adjustment refers to adjusting the color parameters such as color and brightness in the video screen.
[0003] In the traditional video screen color adjustment method, the video screen can only be adjusted as a whole with fixed values, which lacks color adjustment flexibility. Summary of the invention
[0004] To this end, the present disclosure provides a color adjustment method, a color adjustment device, an electronic device and a readable medium to solve the problem of inflexible video picture color adjustment in the prior art.
[0005] In order to achieve the above object, the present disclosure provides a color adjustment method in a first aspect, the method comprising:
[0006] Acquire a color adjustment area and a color adjustment parameter included in the color adjustment request, wherein the color adjustment area is determined according to a preset area division type;
[0007] According to the preset area division type, determining target RGB data corresponding to the color adjustment area from a plurality of RGB data corresponding to a plurality of pixel points of the picture to be adjusted;
[0008] According to the color adjustment parameters, the target RGB data is subjected to color adjustment processing to obtain an adjustment picture after color adjustment.
[0009] In an optional implementation, determining, according to the preset area division type, target RGB data corresponding to the color adjustment area from a plurality of RGB data corresponding to a plurality of pixel points of the picture to be adjusted includes:
[0010] Determine a region threshold corresponding to the color adjustment region under the preset region division type;
[0011] According to the area threshold, target RGB data corresponding to the color adjustment area is determined from a plurality of RGB data corresponding to a plurality of pixel points of the picture to be adjusted.
[0012] In an optional implementation, when the preset area division type is an angle division type, a plurality of preset color partitions are pre-divided according to a preset angle, and the area threshold is an area angle threshold; then, according to the area threshold, determining the target RGB data corresponding to the color adjustment area from a plurality of RGB data corresponding to a plurality of pixel points of the picture to be adjusted, includes:
[0013] Determining, according to the area angle threshold, a matching color partition corresponding to the color adjustment area from the plurality of preset color partitions;
[0014] Determine the color change channel, the maximum color channel, and the minimum color channel corresponding to the matching color partition from the R channel, the G channel, and the B channel;
[0015] For each RGB data among the multiple RGB data, a data difference between a channel value of the maximum color channel contained in the RGB data and a channel value of the minimum color channel contained in the RGB data is calculated; and according to the data difference and the area angle threshold, a channel value variation range corresponding to the RGB data under the color conversion channel is determined;
[0016] For each RGB data, a channel change value corresponding to the RGB data under the color conversion channel is calculated, and when the channel change value satisfies the channel value change range, the RGB data is determined as the target RGB data.
[0017] In an optional implementation, the area angle threshold includes a starting area angle and an ending area angle, and determining the channel value variation range corresponding to the RGB data under the color conversion channel according to the data difference and the area angle threshold includes:
[0018] Calculating a first angle ratio value between the starting area angle and the area angle of the matching color partition, and determining a minimum channel change value corresponding to the color conversion channel according to the first angle ratio value and the data difference;
[0019] Calculating a second angle ratio value between the termination area angle and the area angle of the matching color partition, and determining a maximum channel change value corresponding to the color conversion channel according to the second angle ratio value and the data difference;
[0020] The channel value variation range is determined according to the minimum channel variation value and the maximum channel variation value.
[0021] In an optional implementation, the calculating the channel change value corresponding to the RGB data under the color conversion channel includes:
[0022] Determine a data change state corresponding to the channel value of the color change channel under the matching color partition;
[0023] When the data change state is an ascending state, a difference between a channel value of the color change channel included in the RGB data and a channel value of the minimum color channel included in the RGB data is calculated to obtain the channel change value;
[0024] When the data change state is a decreasing state, a difference between a channel value of the maximum color channel included in the RGB data and a channel value of the color change channel included in the RGB data is calculated to obtain the channel change value.
[0025] In an optional implementation, when the preset area division type is a saturation division type, the area threshold is an area saturation threshold, and determining, according to the area threshold, target RGB data corresponding to the color adjustment area from a plurality of RGB data corresponding to a plurality of pixel points of the picture to be adjusted, includes:
[0026] For each RGB data among the plurality of RGB data, calculating a saturation value corresponding to the RGB data;
[0027] For each RGB data, when a saturation value corresponding to the RGB data satisfies a regional saturation threshold corresponding to the color adjustment region, the RGB data is determined to be target RGB data corresponding to the color adjustment region.
[0028] In an optional implementation, when the preset area division type is a mixed division type, a plurality of local color partitions are pre-divided according to preset angles and preset saturation values, and the area threshold includes an area angle threshold and an area saturation threshold. Then, according to the area threshold, determining the target RGB data corresponding to the color adjustment area from a plurality of RGB data corresponding to a plurality of pixel points of the picture to be adjusted includes:
[0029] Determining a matching local color partition corresponding to the color adjustment area from a plurality of pre-divided local color partitions;
[0030] Determining, according to the matching local color partition and the regional angle threshold, first RGB data corresponding to the regional angle threshold from the plurality of RGB data;
[0031] According to the regional saturation threshold, determining second RGB data corresponding to the regional saturation threshold from the plurality of RGB data;
[0032] The intersection data of the first RGB data and the second RGB data is determined as the target RGB data.
[0033] In an optional implementation manner, the color adjustment request also includes a gradient adjustment area corresponding to the color adjustment area, and the method further includes:
[0034] Determining target gradient RGB data corresponding to the gradient adjustment area from a plurality of RGB data corresponding to the picture to be adjusted;
[0035] Determining a gradient adjustment coefficient corresponding to the target gradient RGB data according to a preset area division type corresponding to the color adjustment area and an area threshold corresponding to the gradient adjustment area;
[0036] The target gradient RGB data is subjected to color adjustment processing according to the gradient adjustment coefficient and the color adjustment parameter.
[0037] In an optional implementation, when the preset area division type is an angle division type, determining the gradient adjustment coefficient corresponding to the target gradient RGB data according to the preset area division type corresponding to the color adjustment area and the area threshold corresponding to the gradient adjustment area includes:
[0038] In a case where the gradient adjustment region corresponds to a plurality of preset color partitions, dividing the gradient adjustment region into a plurality of gradient adjustment partitions corresponding to the plurality of preset color partitions;
[0039] For each gradient adjustment partition, determining target gradient RGB sub-data corresponding to the gradient adjustment partition from the target gradient RGB data;
[0040] For each gradient adjustment partition, a gradient adjustment coefficient corresponding to the target gradient RGB sub-data is determined according to a partition threshold corresponding to the gradient adjustment partition.
[0041] In an optional implementation, determining the gradient adjustment coefficient corresponding to the target gradient RGB sub-data according to the partition threshold corresponding to the gradient adjustment partition includes:
[0042] According to the preset color partition corresponding to the gradient adjustment partition, target channel data is determined from the target gradient RGB sub-data, and an angle value corresponding to the target channel data is calculated;
[0043] Calculate a first angle difference between the angle value corresponding to the target channel data and the starting angle threshold corresponding to the gradual adjustment partition;
[0044] Calculating a second angle difference between a starting angle threshold corresponding to the gradual adjustment partition and an ending angle threshold corresponding to the gradual adjustment partition;
[0045] A gradient adjustment coefficient corresponding to the target gradient RGB sub-data is determined according to the first angle difference and the second angle difference.
[0046] In an optional implementation, when the preset area division type is a saturation division type, determining the gradient adjustment coefficient corresponding to the target gradient RGB data according to the preset area division type corresponding to the color adjustment area and the area threshold corresponding to the gradient adjustment area includes:
[0047] Calculate a first saturation difference between a saturation value corresponding to the target gradient RGB data and a starting saturation threshold corresponding to the gradient adjustment area;
[0048] Calculating a second saturation difference between a starting saturation threshold corresponding to the gradient adjustment region and a terminating saturation threshold corresponding to the gradient adjustment region;
[0049] A gradient adjustment coefficient corresponding to the target gradient RGB data is determined according to the first saturation difference and the second saturation difference.
[0050] In an optional implementation, when the preset area division type is a mixed division type, determining the gradient adjustment coefficient corresponding to the target gradient RGB data according to the preset area division type corresponding to the color adjustment area and the area threshold corresponding to the gradient adjustment area includes:
[0051] Determine a first gradient coefficient corresponding to the target gradient RGB data according to an angle value corresponding to the target gradient RGB data and a starting angle threshold and an ending angle threshold corresponding to the gradient adjustment area;
[0052] Determine a second gradient coefficient corresponding to the target gradient RGB data according to a saturation value corresponding to the target gradient RGB data and a starting saturation threshold and an ending saturation threshold corresponding to the gradient adjustment area;
[0053] The gradient adjustment coefficient is obtained according to the first gradient coefficient and the second gradient coefficient.
[0054] A second aspect of the present disclosure provides a color adjustment device, the device comprising:
[0055] An acquisition module, configured to acquire a color adjustment area and a color adjustment parameter included in a color adjustment request, wherein the color adjustment area is determined according to a preset area division type;
[0056] A determination module, configured to determine, according to the preset area division type, target RGB data corresponding to the color adjustment area from a plurality of RGB data corresponding to a plurality of pixel points of the picture to be adjusted;
[0057] The adjustment module is used to perform color adjustment processing on the target RGB data according to the color adjustment parameters to obtain an adjustment picture after color adjustment.
[0058] A third aspect of the present disclosure provides an electronic device, including:
[0059] one or more processors;
[0060] A storage device having one or more programs stored thereon, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the above-mentioned color adjustment method;
[0061] One or more I / O interfaces are connected between the processor and the memory and are configured to implement information interaction between the processor and the memory.
[0062] A fourth aspect of the present disclosure provides a computer-readable medium having a computer program stored thereon, wherein the program implements the above-mentioned color adjustment method when executed by a processor.
[0063] The present disclosure has the following advantages:
[0064] In the color adjustment method provided by the embodiment of the present disclosure, first, a color adjustment area and a color adjustment parameter included in a color adjustment request are obtained, wherein the color adjustment area can be determined according to a preset area division type, so that according to the preset area division type, target RGB data corresponding to the color adjustment area can be determined from multiple RGB data corresponding to multiple pixel points of the picture to be adjusted. Finally, it is only necessary to perform color adjustment processing on the target RGB data according to the color adjustment parameters, without the need to perform unified color adjustment on the entire picture to be adjusted, thereby realizing local color adjustment of the picture to be adjusted and greatly improving the flexibility of color adjustment of the video picture. BRIEF DESCRIPTION OF THE DRAWINGS
[0065] The accompanying drawings are used to provide further understanding of the present disclosure and constitute a part of the specification. They are used to explain the present disclosure together with the following detailed description, but do not constitute a limitation of the present disclosure.
[0066] Figure 1 A flow chart of a color adjustment method provided by an embodiment of the present disclosure;
[0067] Figure 2 It is a schematic diagram of the angle value corresponding to the HSV top view in the counterclockwise direction;
[0068] Figure 3 A flow chart of a color adjustment method provided by an embodiment of the present disclosure;
[0069] Figure 4 A schematic diagram of dividing the HSV top view into preset color partitions;
[0070] Figure 5 A flow chart of a color adjustment method provided by an embodiment of the present disclosure;
[0071] Figure 6 A flow chart of a color adjustment method provided by an embodiment of the present disclosure;
[0072] Figure 7 A schematic diagram of dividing a gradient adjustment area into gradient adjustment zones;
[0073] Figure 8 A flow chart of a color adjustment method provided by an embodiment of the present disclosure;
[0074] Fig. 9 It is a schematic diagram of the gradient adjustment coefficient under the angle division type;
[0075] Fig.10 It is a schematic diagram of the gradient adjustment area under the mixed partitioning type;
[0076] Fig.11 A block diagram of a color adjustment device provided in an embodiment of the present disclosure;
[0077] Fig.12 A block diagram of an electronic device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION
[0078] The specific implementation of the present disclosure is described in detail below in conjunction with the accompanying drawings. It should be understood that the specific implementation described herein is only used to illustrate and explain the present disclosure, and is not used to limit the present disclosure.
[0079] As used in this disclosure, the term "and / or" includes any and all combinations of one or more of the associated listed items.
[0080] The terms used in the present disclosure are only used to describe specific embodiments and are not intended to limit the present disclosure.As used in the present disclosure, the singular forms "a", "an" and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise.
[0081] When the terms “comprising” and / or “made of…” are used in the present disclosure, it specifies the existence of the stated features, integers, steps, operations, elements and / or components, but does not exclude the existence or addition of one or more other features, integers, steps, operations, elements, components and / or groups thereof.
[0082] The embodiments described in the present disclosure may be described with reference to plan views and / or cross-sectional views by way of ideal schematic diagrams of the present disclosure. Therefore, the exemplary illustrations may be modified according to manufacturing techniques and / or tolerances.
[0083] Unless otherwise defined, all terms (including technical and scientific terms) used in this disclosure have the same meaning as those commonly understood by those of ordinary skill in the art. It will also be understood that terms such as those defined in commonly used dictionaries should be interpreted as having a meaning consistent with their meaning in the context of the relevant art and this disclosure, and will not be interpreted as having an idealized or overly formal meaning unless explicitly defined in this disclosure.
[0084] In a first aspect, an embodiment of the present disclosure provides a color adjustment method. Figure 1 A flowchart of a color adjustment method provided in an embodiment of the present disclosure, referring to Figure 1 , the method comprising:
[0085] Step S110: Acquire a color adjustment area and color adjustment parameters included in the color adjustment request, wherein the color adjustment area is determined according to a preset area division type.
[0086] The color adjustment request refers to a data request sent by a color adjustment requester for adjusting the color of a picture to be adjusted.
[0087] The color adjustment request includes relevant information required for color adjustment, such as color adjustment area, color adjustment parameters, etc.
[0088] The color adjustment area refers to the color area to be adjusted selected in the HSV (Hue, Saturation, Value) top view, which is determined according to the preset area division type.
[0089] Specifically, the preset area division type is used to characterize the color partitioning method of the HSV top view, which may include an angle division type, a saturation division type, and a mixed division type.
[0090] Correspondingly, when the preset area division type is the angle division type, the color adjustment area can be selected from the HSV top view according to the angle. For example, the color area between 30 degrees and 60 degrees in the HSV top view is selected as the color adjustment area.
[0091] It should be noted that, for the HSV top view, the angle range is 0 to 360 degrees. When determining the angle value in the HSV top view, the connecting line between the center point of the HSV top view and any end point of the HSV top view can be determined as an angle of 0 degrees, so that starting from the angle of 0 degrees, the angle in the HSV top view is set to 360 degrees in a clockwise or counterclockwise direction, and the embodiments of the present disclosure are not limited to this.
[0092] For example, Figure 2 The angle values corresponding to the HSV top view along the counterclockwise direction are shown. Figure 2 , where the connecting line between the center point of the HSV top view and endpoint 1, i.e., the RGB value of (255,0,0), is determined to be an angle of 0 degrees, and along the counterclockwise direction, endpoint 2, i.e., the RGB value of (255,255,0), is determined to have an angle of 60 degrees, endpoint 3, i.e., the RGB value of (0,255,0), is determined to have an angle of 120 degrees, endpoint 4, i.e., the RGB value of (0,255,255), is determined to have an angle of 180 degrees, endpoint 5, i.e., the RGB (Red-Green-Blue) value of (0,0,255), is determined to have an angle of 240 degrees, and endpoint 6, i.e., the RGB value of (255,0,255), is determined to have an angle of 300 degrees.
[0093] When the preset area division type is the saturation division type, the color adjustment area can be selected from the HSV top view according to the saturation value, wherein the saturation value ranges from 0 to 1. Exemplarily, a color area with a saturation value between 0.2 and 0.5 in the HSV top view can be selected as the color adjustment area.
[0094] When the preset area division type is a mixed division type, a color adjustment area can be selected from the HSV top view according to a combination of angle and saturation value. For example, a color area with a saturation value of 0.2 to 0.5 and an angle of 30 to 60 degrees in the HSV top view is selected as the color adjustment area, which is not limited in the embodiments of the present disclosure.
[0095] Therefore, under different preset area division types, the color adjustment area can be flexibly determined to improve the flexibility of color adjustment.
[0096] The color adjustment parameter refers to the adjustment parameter set by the color adjustment demander, which is a color adjustment value. Different color adjustment parameters may correspond to different color adjustment types.
[0097] The color adjustment type is used to represent the color adjustment method, for example, adjusting saturation, brightness or hue.
[0098] Correspondingly, the color adjustment parameters include a saturation adjustment parameter for adjusting saturation, a brightness adjustment parameter for adjusting brightness, a hue adjustment parameter for adjusting hue, and the like.
[0099] Furthermore, the color adjustment request may also include a color adjustment type to identify the color adjustment type corresponding to the color adjustment parameter.
[0100] Step S120: According to the preset area division type, target RGB data corresponding to the color adjustment area is determined from a plurality of RGB data corresponding to a plurality of pixel points of the picture to be adjusted.
[0101] The picture to be adjusted refers to the video picture whose color is to be adjusted. The picture to be adjusted is composed of a plurality of pixels, and each pixel has corresponding RGB data.
[0102] The target RGB data refers to the RGB data corresponding to the color adjustment area, which is obtained by screening from a plurality of RGB data corresponding to a plurality of pixel points of the picture to be adjusted according to a preset area division type.
[0103] It should be noted that under different preset area division types, the color adjustment area corresponds to different area thresholds, such as area angle thresholds, area saturation thresholds, etc., so that the target RGB data corresponding to the color adjustment area can be determined from multiple RGB data corresponding to multiple pixel points of the picture to be adjusted based on the area threshold.
[0104] Correspondingly, according to the preset area division type, target RGB data corresponding to the color adjustment area is determined from multiple RGB data corresponding to multiple pixel points of the picture to be adjusted, including: determining the area threshold corresponding to the color adjustment area under the preset area division type; according to the area threshold, determining the target RGB data corresponding to the color adjustment area from multiple RGB data corresponding to multiple pixel points of the picture to be adjusted.
[0105] Among them, different area thresholds correspond to different preset division types.
[0106] Exemplarily, when the preset division type is an angle division type, the area threshold is an area angle threshold, and the area angle threshold may include a starting area angle and an ending area angle.
[0107] When the preset division type is the saturation division type, the region threshold is the region saturation threshold, and the region saturation threshold may include a starting saturation and an ending saturation.
[0108] When the preset division type is a mixed division type, the area threshold includes an area angle threshold and an area saturation threshold. Accordingly, the area angle threshold may specifically include a starting area angle and an ending area angle, and the area saturation threshold may specifically include a starting saturation and an ending saturation.
[0109] The starting area angle and the ending area angle are used to represent the area starting angle value and the area ending angle value corresponding to the color adjustment area, respectively.
[0110] The starting saturation and the ending saturation are respectively used to represent the starting saturation value and the ending saturation value of the region corresponding to the color adjustment region.
[0111] It should be noted that the embodiments of the present disclosure do not limit the method for determining the regional threshold corresponding to the color adjustment area under the preset area division type. For example, if the color adjustment demander directly sets the regional threshold of the color adjustment area in the color adjustment request, the regional threshold included in the color adjustment request can be directly used as the regional threshold. For another example, if the color adjustment demander specifies the preset partition corresponding to the preset area division type as the color adjustment area, the regional threshold corresponding to the color adjustment area can be determined according to the partition threshold corresponding to the specified preset partition.
[0112] Therefore, according to the area threshold corresponding to the color adjustment area under the preset area division type, the target RGB data corresponding to the color adjustment area can be determined from the multiple RGB data to improve the extraction accuracy of the target RGB data.
[0113] Step S130: Performing color adjustment processing on the target RGB data according to the color adjustment parameters to obtain an adjustment picture after color adjustment.
[0114] The color adjustment parameters may include a brightness adjustment parameter, a saturation adjustment parameter, and a hue adjustment parameter. Accordingly, the color adjustment process may be a brightness adjustment process, a saturation adjustment process, and a hue adjustment process corresponding to the color adjustment parameters.
[0115] It should be noted that when color adjustment is performed on target RGB data according to the color adjustment parameters, the target RGB data needs to be converted into YUV (a color encoding method) data, so as to perform color adjustment on the YUV data according to the color adjustment parameters.
[0116] Specifically, if the brightness of the YUV data needs to be adjusted, the value of the brightness component Y in the YUV data can be adjusted according to the brightness adjustment parameter. If the value of the brightness component Y is increased, the brightness increases, and if the value of the brightness component Y is reduced, the brightness decreases.
[0117] If the saturation of the YUV data needs to be adjusted, the values of the chroma component U and the chroma component V in the YUV data may be adjusted in the same proportion according to the saturation adjustment parameter, for example, the values of the chroma component U and the chroma component V may be increased in the same proportion.
[0118] If the hue of the YUV data needs to be adjusted, the values of the chromaticity component U and / or the chromaticity component V in the YUV data may be adjusted according to the hue adjustment parameter, for example, the value of the chromaticity component U may be increased or decreased by the parameter value of the hue adjustment parameter.
[0119] Correspondingly, after color adjustment processing is performed on the YUV data according to the color adjustment parameters, the YUV data needs to be converted into RGB data, so as to obtain an adjustment picture after color adjustment.
[0120] Therefore, compared with the picture to be adjusted, the adjustment picture only changes the data value of the target RGB data corresponding to the color adjustment area in the picture to be adjusted, thereby realizing flexible color adjustment of the picture to be adjusted.
[0121] In an optional implementation, the preset area division type may be an angle division type. Figure 3 A flowchart of a color adjustment method provided by an embodiment of the present disclosure is shown in the case where the preset area division type is an angle division type, referring to Figure 3 , the method comprising:
[0122] Step S310: obtaining a color adjustment area and color adjustment parameters included in the color adjustment request, wherein the color adjustment area is determined according to the angle division type.
[0123] Step S320: determining a region angle threshold corresponding to the color adjustment region under the angle division type.
[0124] The regional angle threshold may include a starting regional angle and an ending regional angle. When the color adjustment request includes the regional angle threshold, the regional angle threshold may be determined directly from the color adjustment request. When only a preset color partition is specified as the color adjustment area in the color adjustment request, for example, the color adjustment area is specified as preset color area 1 to preset color area 3, the regional angle threshold corresponding to the color adjustment area may be determined based on the partition angle threshold corresponding to the specified preset color partition.
[0125] Step S330: determining a matching color partition corresponding to the color adjustment area from a plurality of preset color partitions according to the area angle threshold.
[0126] Wherein, when the preset area division type is an angle division type, it is necessary to pre-divide into a plurality of preset color partitions according to preset angles.
[0127] The plurality of preset color partitions are color partitions obtained by dividing the HSV top view according to preset angles.
[0128] It should be noted that, in the RGB data corresponding to each preset color partition, only the channel value of one color channel changes. Therefore, the angle value of the preset angle cannot exceed 60 degrees.
[0129] For example, Figure 4 A schematic diagram showing the division of the HSV top view into preset color partitions is shown. Figure 4 , which divides the HSV top view into 6 preset color partitions at a preset angle of 60°: Area1 to Area6.
[0130] Among them, Area 1: 0-60°, Area 2: 60-120°, Area 3: 120-180°, Area 4: 180-240°, Area 5: 240-300°, Area 6: 300-360° (not shown in the figure, the same as the 0° position in the figure).
[0131] It should also be noted that the matching color partition corresponding to the color adjustment area refers to the preset color partition where the color adjustment area is located.
[0132] For example, continue to refer to Figure 4 If the area angle threshold corresponding to the color adjustment area is 80° for the starting area angle Hue_start and 100° for the ending area angle Hue_over, the corresponding matching color partition is Area2.
[0133] Step S340: Determine the color change channel, the maximum color channel, and the minimum color channel corresponding to the matching color partition from the R channel, the G channel, and the B channel.
[0134] Among them, under different matching color partitions, different color change channels, maximum color channels and minimum color channels correspond.
[0135] A color transformation channel means that in a matching color partition, as the angle changes, only the channel value of this channel changes.
[0136] The maximum color channel refers to the channel with the largest channel value in the matching color partition. Correspondingly, the minimum color channel refers to the channel with the smallest channel value in the matching color partition.
[0137] For example, refer to Figure 4, in Area1, as the angle value increases, only the channel value of the G channel changes. For example, at the outer boundary of Area1, as the angle increases from 0° to 60°, its RGB data changes from (255,0,0) to (255,255,0), then the color change channel in this area is the G channel, the maximum color channel max is the R channel, and the minimum color channel min is the B channel.
[0138] Similarly, if Area2: 60° to 120°, its outer boundary RGB data changes from (255,255,0) to (0,255,0) as the angle increases, that is, the R channel value decreases, max = G, min = B;
[0139] If Area3: 120° to 180°, the RGB data of its outer boundary changes from (0,255,0) to (0,255,255) as the angle increases, that is, the B channel value increases, max = G, min = R;
[0140] If Area4: 180° to 240°, the RGB data of its outer boundary changes from (0,255,255) to (0,0,255) as the angle increases, that is, the G channel value decreases, max = B, min = R;
[0141] If Area5: 240° to 300°, then its outer boundary RGB data changes from (0,0,255) to (255,0,255) as the angle increases, that is, the R channel value increases, max = B, min = G;
[0142] If Area6: 300° to 360°, its outer boundary RGB data changes from (255,0,255) to (255,0,0) as the angle increases, that is, the B channel value decreases, max=R, min=G.
[0143] Step S350: for each RGB data in the multiple RGB data, calculate the data difference between the channel value of the maximum color channel contained in the RGB data and the channel value of the minimum color channel contained in the RGB data; and determine the channel value change range corresponding to the RGB data under the color transformation channel according to the data difference and the area angle threshold.
[0144] The channel value of the maximum color channel included in the RGB data refers to the specific channel value of the maximum color channel corresponding to the matching color area in the RGB data.
[0145] The channel value of the minimum color channel included in the RGB data refers to the specific channel value of the minimum color channel corresponding to the matching color area in the RGB data.
[0146] For example, for RGB data of (253, 255, 0), if the maximum color channel corresponding to the matching color area is G and the minimum color channel is B, the channel value of the maximum color channel is 255 and the channel value of the minimum color channel is 253.
[0147] Correspondingly, the numerical difference is the difference between the channel value of the maximum color channel and the channel value of the minimum color channel2.
[0148] Among them, the channel value variation range corresponding to the RGB data under the color conversion channel refers to the value range interval of the channel difference between the channel value of the color conversion channel of the RGB data and the channel value of the starting channel value of the color conversion channel of the matching color area in the color adjustment area, which is determined according to the data difference and the angle threshold corresponding to the color adjustment area.
[0149] In an optional implementation, in order to improve the accuracy of the determined channel value variation range, the angle ratio value between the regional angles of the matching color partitions can be determined, so as to determine the channel value variation range based on the angle ratio value and the data difference.
[0150] Correspondingly, the regional angle threshold includes a starting regional angle and an ending regional angle, and the channel value change range corresponding to the RGB data under the color conversion channel is determined according to the data difference and the regional angle threshold, including: calculating a first angle ratio value between the starting regional angle and the regional angle of the matching color partition, and determining the minimum channel change value corresponding to the color conversion channel according to the first angle ratio value and the data difference; calculating a second angle ratio value between the ending regional angle and the regional angle of the matching color partition, and determining the maximum channel change value corresponding to the color conversion channel according to the second angle ratio value and the data difference; and determining the channel value change range according to the minimum channel change value and the maximum channel change value.
[0151] The area angle of the matching color partition refers to the area angle value of the matching color partition. For example, if the matching color partition is: 60° to 120°, the area angle of the matching color partition is 60°.
[0152] The first ratio value refers to the relative angle value of the starting area angle compared to the area angle. When calculating the first angle ratio value of the starting area angle and the area angle of the matching color partition, the first angle difference between the starting area angle and the starting partition angle of the matching color partition can be calculated, so as to obtain the first ratio value by calculating the ratio of the first angle difference to the area angle.
[0153] Correspondingly, after calculating the first ratio value, the minimum channel change value can be determined according to the data difference value and the first ratio value. The minimum channel change value is the starting range value of the channel value change range. For example, if the data difference value is 255 and the first ratio value is 0.2, the minimum channel change value can be 255×0.2=51.
[0154] The second ratio value refers to the relative angle value of the end area angle compared to the area angle. When calculating the second angle ratio value of the end area angle and the area angle of the matching color partition, the second angle difference between the end area angle and the start area angle of the matching color partition can be calculated, so as to obtain the second ratio value by calculating the ratio of the second angle difference to the area angle.
[0155] Correspondingly, after calculating the second ratio value, the maximum channel change value can be determined according to the data difference value and the second ratio value. The maximum channel change value is the end range value of the channel value change range. For example, if the data difference value is 255 and the first ratio value is 0.8, the minimum channel change value can be 255×0.8=204.
[0156] Therefore, the channel value variation range can be determined according to the minimum channel variation value and the maximum channel variation value.
[0157] For example, the minimum channel change value is 51, and the maximum channel change value is 204, then the channel value change range can be 51 to 204.
[0158] Step S360: for each RGB data, the channel change value corresponding to the RGB data under the color transformation channel is calculated, and when the channel change value satisfies the channel value change range, the RGB data is determined as the target RGB data.
[0159] The channel change value corresponding to the RGB data under the color change channel refers to the channel difference between the channel value of the color change channel included in the RGB data and the starting channel value corresponding to the matching color interval under the color change channel.
[0160] It should be noted that for different matching color intervals, the data change states corresponding to the color change channels are different. Therefore, when calculating the channel change value, it is necessary to determine the data change state corresponding to the channel value of the color change channel under the matching color partition, and then calculate the channel change value based on the data change state.
[0161] In an optional implementation, in order to improve the calculation accuracy of the channel change value, calculating the channel change value corresponding to the RGB data under the color change channel may include: determining the data change state corresponding to the channel value of the color change channel under the matching color partition; when the data change state is an ascending state, calculating the difference between the channel value of the color change channel contained in the RGB data and the channel value of the minimum color channel contained in the RGB data, to obtain the channel change value; when the data change state is a descending state, calculating the difference between the channel value of the maximum color channel contained in the RGB data and the channel value of the color change channel contained in the RGB data, to obtain the channel change value.
[0162] The data change state corresponding to the channel value of the color change channel under the matching color partition refers to the data change trend corresponding to the channel value of the color change channel as the angle value increases.
[0163] When the data change state is an upward state, the data change trend corresponding to the channel value of the color change channel is an upward trend. When the data change state is a downward state, the data change trend corresponding to the channel value of the color change channel is a downward trend.
[0164] For example, for Figure 4 The color change channel of Area 1 in the figure is the G channel. As the angle value increases, the channel value of the G channel increases. Therefore, the data change state corresponding to Area 1 is an upward state. Figure 4 In the area Area2, the color change channel is the R channel. As the angle value increases, the channel value of the R channel decreases. Therefore, the data change state corresponding to the area Area2 is a decreasing state.
[0165] Therefore, when the data change state is an ascending state, the channel change value can be obtained by calculating the difference between the channel value of the color conversion channel included in the RGB data and the channel value of the minimum color channel included in the RGB data.
[0166] For example, for Figure 4 The corresponding color change channel of area Area1 in is G channel, and the minimum color channel is B channel. Therefore, for RGB data such as (255, 200, 0), by calculating the difference between G channel and B channel, the channel change value, 200-0=200, can be obtained.
[0167] for Figure 4 The corresponding color change channel of area Area2 is the R channel, and the maximum color channel is the G channel. Therefore, for RGB data such as (254, 255, 0), by calculating the difference between the G channel and the R channel, the channel change value, that is, 255-254=1, can be obtained.
[0168] It should be noted that the reason why whether the RGB data is the target RGB data is determined based on the channel change value and the channel value change range is that only when the RGB data corresponds to the color adjustment area, the channel change value corresponding to the RGB data will satisfy the channel value change range corresponding to the RGB data.
[0169] For example, if the color adjustment area is from 80° to 100°, the corresponding matching color partition is Figure 4 The area Area2 in is 60° to 120°. At this time, the color change channel is the R channel, the maximum color channel is G, the minimum color channel is B, the starting area angle Hue_start is 80°, and the ending area angle Hue_over is 100°.
[0170] For the RGB data (255, 254, 0), the channel change value is calculated as GR, that is, 254-255=-1, and the channel value change range is (GB)*(Hue_start-Hue_s) / (Hue_o-Hue_s) to (GB)*(Hue_over-Hue_s) / (Hue_o-Hue_s), where Hue_s is the starting angle value of the matching color partition, and Hue_o is the ending angle value of the matching color partition, that is, the channel value change range is 84.67 to 169.33.
[0171] Obviously, the channel change value of RGB data (255, 254, 0) does not satisfy the channel value change range.
[0172] For RGB data (130, 255, 0), referring to the above method, its channel change value is calculated as GR, that is, 255-130=125, and its channel value change range is 85 to 170. Obviously, the channel change value of RGB data (130, 255, 0) satisfies the channel value change range.
[0173] Therefore, the RGB data (255, 254, 0) is not the RGB data corresponding to the color adjustment area, but the RGB data (130, 255, 0) is the RGB data corresponding to the color adjustment area.
[0174] Step S370: performing color adjustment processing on the target RGB data according to the color adjustment parameters to obtain an adjustment picture after color adjustment.
[0175] It can be seen that according to the color adjustment method provided by the embodiment of the present disclosure, the preset color partitions can be divided according to the preset angles, so that for the color adjustment area determined by the angle division type, the matching color partition corresponding to the color adjustment area can be determined, and finally, according to the matching color partition, the target RGB data corresponding to the color adjustment area is screened out from the multiple RGB data of the picture to be adjusted, so as to perform targeted color adjustment according to the target RGB data, thereby improving the flexibility of color adjustment and ensuring the accuracy of color adjustment under the angle division type.
[0176] In an optional implementation, the preset area division type may be a saturation division type. Figure 5 A flowchart of a color adjustment method provided by an embodiment of the present disclosure is shown in the case where the preset area division type is a saturation division type, referring to Figure 5 , the method comprising:
[0177] Step S510: obtaining a color adjustment region and color adjustment parameters included in the color adjustment request, wherein the color adjustment region is determined according to the saturation division type.
[0178] Step S520: determining a region saturation threshold corresponding to the color adjustment region under the saturation division type.
[0179] Step S530: for each RGB data among the plurality of RGB data, calculating the saturation value corresponding to the RGB data.
[0180] The saturation value corresponding to the RGB data may be calculated according to the saturation calculation formula S=(Dmax-Dmin) / Dmax.
[0181] Among them, Dmax is the maximum value in RGB data, Dmin is the minimum value in RGB data, and S is the saturation value corresponding to RGB data.
[0182] Step S540: for each RGB data, when the saturation value corresponding to the RGB data satisfies the regional saturation threshold corresponding to the color adjustment region, determine that the RGB data is the target RGB data corresponding to the color adjustment region.
[0183] The regional saturation threshold may include a starting saturation used to characterize a starting boundary of saturation and an ending saturation used to characterize an ending boundary of saturation.
[0184] Therefore, the saturation value corresponding to the RGB data satisfies the regional saturation threshold corresponding to the color adjustment region, which means that the saturation value satisfies the saturation interval constructed by the starting saturation and the ending saturation.
[0185] Step S550: performing color adjustment processing on the target RGB data according to the color adjustment parameters to obtain an adjustment picture after color adjustment.
[0186] It can be seen that according to the color adjustment method provided in the embodiment of the present disclosure, it is possible to determine the color adjustment area according to the saturation division type, so that according to the regional saturation threshold corresponding to the saturation division type, the target RGB data corresponding to the color adjustment area can be screened out from the multiple RGB data of the picture to be adjusted, so as to perform targeted color adjustment according to the target RGB data, thereby improving the flexibility of color adjustment and ensuring the accuracy of color adjustment under the saturation division type.
[0187] In an optional implementation, the preset area division type may be a mixed division type. Figure 6 A flowchart of a color adjustment method provided by an embodiment of the present disclosure is shown in the case where the preset area division type is a mixed division type, referring to Figure 6 , the method comprising:
[0188] Step S610: obtaining a color adjustment region and color adjustment parameters included in the color adjustment request, wherein the color adjustment region is determined according to the mixed division type.
[0189] Step S620: Determine a region angle threshold and a region saturation threshold corresponding to the color adjustment region under the mixed division type.
[0190] Specifically, the color adjustment area can be determined by specifying a local color partition to improve the setting efficiency of the color adjustment area.
[0191] At this time, the regional angle threshold and regional saturation threshold corresponding to the color adjustment area can be determined according to the partition angle threshold and partition saturation threshold corresponding to the specified local color partition. For example, matching local color partition 1 is an angle of 30 to 60 degrees and a saturation of 0.2-0.3, matching local color partition 2 is an angle of 30 to 60 degrees and a saturation of 0.3-0.4, then the color adjustment area is an angle of 30 to 60 degrees and a saturation of 0.2-0.4.
[0192] In addition, if the color adjustment area is determined directly by setting the area threshold, the area angle threshold and the area saturation threshold can also be directly obtained from the color adjustment request.
[0193] Step S630: determining a matching local color partition corresponding to the color adjustment area from a plurality of pre-divided local color partitions.
[0194] The local color partition is pre-divided according to a preset angle and a preset saturation value, that is, a plurality of preset color partitions are divided according to a preset angle, and then the plurality of preset color partitions are divided into a plurality of local color partitions according to a preset saturation value.
[0195] In each preset color partition, only one color channel has a channel value that changes, so the angle value of the preset angle cannot exceed 60°.
[0196] The preset saturation value may be adaptively set according to actual division needs. For example, the preset saturation value may be set to 0.2, so that local color partition division is performed every 0.2.
[0197] Step S640: determining first RGB data corresponding to the regional angle threshold from a plurality of RGB data according to matching the local color partition and the regional angle threshold.
[0198] Among them, according to matching the local color partition and the regional angle threshold, the method of determining the first RGB data corresponding to the regional angle threshold from multiple RGB data can refer to the implementation method of determining the target RGB data under the angle division type mentioned above.
[0199] Specifically, by determining the color change channel, the maximum color channel and the minimum color channel corresponding to the matching local color partition.
[0200] Thus, for each RGB data in the multiple RGB data, the color channel change value corresponding to the RGB data and the channel difference between the maximum color channel and the minimum color channel are determined; according to the channel difference and the regional angle threshold, the channel change range corresponding to the RGB data is determined; for each RGB data, the channel change value corresponding to the RGB data under the color transformation channel is calculated, and when the channel change value satisfies the channel value change range, the RGB data is determined as the first RGB data corresponding to the regional angle threshold.
[0201] Step S650: Determine second RGB data corresponding to the regional saturation threshold from multiple RGB data according to the regional saturation threshold.
[0202] Among them, according to the regional saturation threshold, the method of determining the second RGB data corresponding to the regional saturation threshold from multiple RGB data can refer to the above-mentioned implementation method of determining the target RGB data under the saturation division type.
[0203] Specifically, for each RGB data among the multiple RGB data, the saturation value corresponding to the RGB data is calculated; when the saturation value corresponding to the RGB data satisfies the regional saturation threshold, the RGB data is determined to be second RGB data corresponding to the regional saturation threshold.
[0204] Step S660: determining the intersection data of the first RGB data and the second RGB data as the target RGB data.
[0205] By determining the intersection data between the first RGB data and the second RGB data, the intersection data is the target RGB data corresponding to the regional angle threshold and the regional saturation threshold.
[0206] Step S670: performing color adjustment processing on the target RGB data according to the color adjustment parameters to obtain an adjustment picture after color adjustment.
[0207] It can be seen that according to the color adjustment method provided in the embodiment of the present disclosure, it is possible to determine the color adjustment area according to the mixing type, so that according to the area threshold corresponding to the mixing type, the target RGB data corresponding to the color adjustment area can be screened out from the multiple RGB data of the picture to be adjusted, so as to perform targeted color adjustment according to the target RGB data, thereby improving the flexibility of color adjustment and ensuring the accuracy of color adjustment under the mixed division type.
[0208] In an optional implementation, considering that local color adjustment may cause color mutation, a gradient adjustment area corresponding to the color adjustment area can be further set in the color adjustment request, so that the image to be adjusted can be gradiently adjusted according to the gradient adjustment area. Accordingly, the color adjustment request also includes the gradient adjustment area corresponding to the color adjustment area, and the color adjustment method also includes: determining the target gradient RGB data corresponding to the gradient adjustment area from the multiple RGB data corresponding to the image to be adjusted; determining the gradient adjustment coefficient corresponding to the target gradient RGB data according to the preset area division type corresponding to the color adjustment area and the area threshold corresponding to the gradient adjustment area; and performing color adjustment processing on the target gradient RGB data according to the gradient adjustment coefficient and the color adjustment parameter.
[0209] The gradient adjustment region corresponding to the color adjustment region refers to a color region set for gradient color adjustment. Specifically, there is an adjacent position relationship between the gradient adjustment region and the color adjustment region.
[0210] Correspondingly, the gradient adjustment area and the color adjustment area correspond to the same preset division type, that is, the area threshold of the gradient adjustment area and the area threshold of the color adjustment area are of the same type.
[0211] The target gradient RGB data is the RGB data corresponding to the gradient adjustment area in the image to be adjusted.
[0212] Specifically, the target gradient RGB data corresponding to the color adjustment area may be determined from a plurality of RGB data corresponding to a plurality of pixel points of the picture to be adjusted according to the area threshold of the gradient adjustment area.
[0213] It should be noted that, when the preset area division type is the angle division type, the area threshold of the gradient adjustment area is the area angle threshold, so that the target gradient RGB data corresponding to the color adjustment area can be determined from the multiple RGB data corresponding to the multiple pixels of the image to be adjusted according to the area angle threshold of the gradient adjustment area. The method for determining the target gradient RGB data can refer to the above steps S330 to S360, which will not be described in detail here.
[0214] In the case where the preset area division type is the saturation division type, the area threshold of the gradient adjustment area is the area saturation threshold, so that the target gradient RGB data corresponding to the color adjustment area can be determined from the multiple RGB data corresponding to the multiple pixels of the image to be adjusted according to the area saturation threshold of the gradient adjustment area. Specifically, the method for determining the target gradient RGB data can refer to the above steps S530 to S540, which will not be described in detail here.
[0215] In the case where the preset area division type is a mixed division type, the area threshold of the gradient adjustment area includes an area angle threshold and an area saturation threshold, so that the target gradient RGB data corresponding to the color adjustment area can be determined from the multiple RGB data corresponding to the multiple pixel points of the image to be adjusted according to the area angle threshold and the area saturation threshold of the gradient adjustment area. Specifically, the method for determining the target gradient RGB data can refer to the specific implementation method of determining the target RGB data according to the area threshold in the case of the mixed division type, which will not be described in detail here.
[0216] The gradient adjustment coefficient is used to determine the gradient color adjustment parameter corresponding to the target gradient RGB data.
[0217] Specifically, the gradient color adjustment parameter is determined according to the color adjustment parameter and the gradient adjustment coefficient. By determining the gradient adjustment coefficient and determining the gradient color adjustment parameter according to the gradient adjustment coefficient, the gradient color adjustment process can be performed on the target gradient RGB data according to the gradient color adjustment parameter.
[0218] It should be noted that the gradient adjustment coefficient is used to characterize the relative position of the target gradient RGB data in the gradient adjustment area under the preset area division type.
[0219] Therefore, the gradient adjustment coefficient needs to be determined according to the preset area division type corresponding to the color adjustment area and the area threshold corresponding to the gradient adjustment area.
[0220] In an optional implementation, when the preset area division type is an angle division type, the gradient adjustment area can be divided into gradient adjustment partitions according to the preset color partitions corresponding to the gradient adjustment area, so that the gradient adjustment coefficient can be determined according to the partition threshold of the gradient adjustment partition.
[0221] Correspondingly, according to the preset area division type corresponding to the color adjustment area and the area threshold corresponding to the gradient adjustment area, the gradient adjustment coefficient corresponding to the target gradient RGB data is determined, including: when the gradient adjustment area corresponds to multiple preset color partitions, the gradient adjustment area is divided into multiple gradient adjustment partitions corresponding to the multiple preset color partitions; for each gradient adjustment partition, the target gradient RGB sub-data corresponding to the gradient adjustment partition is determined from the target gradient RGB data; for each gradient adjustment partition, the gradient adjustment coefficient corresponding to the target gradient RGB sub-data is determined according to the partition threshold corresponding to the gradient adjustment partition.
[0222] The gradient adjustment area may be divided into gradient adjustment partitions according to a partition threshold of a preset color partition corresponding to the gradient adjustment area.
[0223] It should be noted that, for each gradient adjustment partition, in the partition, as the angle value changes, only the channel value of one color channel changes.
[0224] For example, Figure 7 A schematic diagram showing the division of the gradient adjustment area into gradient adjustment zones is shown, referring to Figure 7 :
[0225] exist Figure 7 (a) shows a schematic diagram of the division of the gradient adjustment partitions when the gradient adjustment area is on the right side of the color adjustment area.
[0226] Among them, Start_buf and Over_buf are the starting angle threshold and the ending angle threshold of the gradient adjustment area respectively, Hue_over is the ending area angle of the color adjustment area, the color adjustment area is the area between Hue_over and Over_buf, the gradient adjustment area is the area between Start_buf and Over_buf, Hue_s 1 is the ending area angle of the preset color partition 1 (not shown in the figure), and the starting area angle of the preset color partition 2 (not shown in the figure).
[0227] from Figure 7 As can be seen in (a), according to the preset color partition threshold Hue_s 1, the gradient adjustment area is divided into gradient adjustment partitions: partition one and partition two.
[0228] exist Figure 7(b) shows a schematic diagram of the division of the gradient adjustment partitions when the gradient adjustment area is on the left side of the color adjustment area.
[0229] Among them, Start_buf and Over_buf are the starting angle threshold and the ending angle threshold of the gradient adjustment area respectively, Hue_start is the starting area angle of the color adjustment area, the color adjustment area is the area between Hue_start and Start_buf, the gradient adjustment area is the area between Start_buf and Over_buf, Hue_s2 is the ending area angle of the preset color partition 2 (not shown in the figure), and the starting area angle of the preset color partition 3 (not shown in the figure).
[0230] from Figure 7 As can be seen in (b), according to the preset color partition threshold Hue_s2, the gradient adjustment area is divided into gradient adjustment partitions: partition three and partition four.
[0231] exist Figure 7 (c) shows a schematic diagram of the division of the gradient adjustment partitions when the gradient adjustment area is on the left and right sides of the color adjustment area.
[0232] Among them, Start_buf1 and Over_buf1 are the starting angle threshold and ending angle threshold of gradient adjustment area 1 (not shown in the figure), Start_buf2 and Over_buf2 are the starting angle threshold and ending angle threshold of gradient adjustment area 2 (not shown in the figure), the color adjustment area is the area between Over_buf1 and Start_buf2, the gradient adjustment area 1 is the area between Start_buf1 and Over_buf1, and the gradient adjustment area 2 is the area between Start_buf2 and Over_buf2.
[0233] Hue_s 1 is the end area angle of the preset color partition 1 (not shown in the figure), and the start area angle of the preset color partition 2 (not shown in the figure). Hue_s2 is the end area angle of the preset color partition 2 (not shown in the figure), and the start area angle of the preset color partition 3 (not shown in the figure).
[0234] from Figure 7 It can be seen in (c) that according to the preset color partition threshold Hue_s 1, the gradient adjustment area 1 is divided into gradient adjustment partitions: partition 5 and partition 6, and according to the preset color partition threshold Hue_s2, the gradient adjustment area 2 is divided into gradient adjustment partitions: partition 7 and partition 8.
[0235] After the gradient adjustment partition is divided, the target gradient RGB sub-data corresponding to the gradient adjustment partition needs to be determined from the target gradient RGB data. Specifically, the target gradient RGB sub-data corresponding to the partition threshold corresponding to the gradient adjustment partition can be determined from the target gradient RGB data.
[0236] Therefore, the gradient adjustment coefficient corresponding to the target gradient RGB sub-data is determined according to the partition threshold corresponding to the gradient adjustment partition.
[0237] In an optional implementation, in order to improve the accuracy of the gradient adjustment coefficient, the angle value corresponding to the target gradient RGB sub-data can be calculated, and then the gradient adjustment coefficient corresponding to the target gradient RGB sub-data can be determined based on the angle value corresponding to the target gradient RGB sub-data and the partition threshold corresponding to the gradient adjustment partition.
[0238] Correspondingly, according to the partition threshold corresponding to the gradient adjustment partition, the gradient adjustment coefficient corresponding to the target gradient RGB sub-data is determined, including: according to the preset color partition corresponding to the gradient adjustment partition, the target channel data is determined from the target gradient RGB sub-data, and the angle value corresponding to the target channel data is calculated; the first angle difference between the angle value corresponding to the target channel data and the starting angle threshold corresponding to the gradient adjustment partition is calculated; the second angle difference between the starting angle threshold corresponding to the gradient adjustment partition and the ending angle threshold corresponding to the gradient adjustment partition is calculated; according to the first angle difference and the second angle difference, the gradient adjustment coefficient corresponding to the target gradient RGB sub-data is determined.
[0239] The preset color partition is the color partition divided by the HSV top view according to the preset angle, for example, Figure 4 Area1 to Area6 in the.
[0240] The preset color partition corresponding to the gradient adjustment partition refers to the preset color partition where the gradient adjustment partition is located. For example, when the gradient adjustment partition is located in preset color partition 1, preset color partition 1 is the preset color partition corresponding to the gradient adjustment partition.
[0241] The target channel data refers to the channel data of the color conversion channel included in the target gradient RGB sub-data, and the color conversion channel is determined according to the preset color partition corresponding to the gradient adjustment partition.
[0242] Therefore, the corresponding angle value can be calculated according to the target channel data. The angle value can be the relative angle value of the target channel data in the preset color partition.
[0243] Specifically, the data change value of the target channel data may be calculated, and thus the angle value corresponding to the target channel data may be obtained according to the data change value and the angle value corresponding to the unit data change value.
[0244] For example, the preset color partition corresponding to the gradient adjustment partition is Figure 4 When the color conversion channel is Area2 in the image, the color conversion channel is the R channel, the maximum color channel is the G channel, and the minimum color channel is the B channel. Therefore, GR can be used to obtain the data change value of the target channel data.
[0245] It should be noted that, according to different preset color partitions, the calculation method of the data change value of the target channel data can be adaptively adjusted, and the embodiments of the present disclosure are not limited to this.
[0246] Furthermore, the angle value corresponding to the unit data change value can be obtained by calculating the ratio between the area angle value corresponding to the preset color partition and the channel difference between the maximum color channel G and the minimum color channel B in the target gradient RGB sub-data.
[0247] Therefore, after the angle value corresponding to the target channel data is calculated, the first angle difference value can be obtained by calculating the angle difference between the angle value and the starting angle threshold value corresponding to the gradual adjustment partition.
[0248] The second angle difference may be obtained by calculating the angle difference between the starting angle threshold corresponding to the gradual adjustment partition and the ending angle threshold corresponding to the gradual adjustment partition.
[0249] Finally, by calculating the ratio between the first angle difference and the second angle difference, the gradient adjustment coefficient corresponding to the target gradient RGB sub-data can be obtained, and the gradient adjustment coefficient represents the relative angle position of the angle value of the target gradient RGB data in the area threshold of the gradient adjustment area.
[0250] In an optional implementation, when the preset area division type is a saturation division type, in order to ensure the calculation accuracy of the gradient adjustment coefficient, the gradient adjustment coefficient can be determined based on the saturation value corresponding to the target gradient RGB data and the zone threshold corresponding to the gradient adjustment area.
[0251] Correspondingly, in the case where the preset area division type is a saturation division type, the gradient adjustment coefficient corresponding to the target gradient RGB data is determined according to the preset area division type corresponding to the color adjustment area and the area threshold corresponding to the gradient adjustment area, including: calculating a first saturation difference between the saturation value corresponding to the target gradient RGB data and the starting saturation threshold corresponding to the gradient adjustment area; calculating a second saturation difference between the starting saturation threshold corresponding to the gradient adjustment area and the ending saturation threshold corresponding to the gradient adjustment area; and determining the gradient adjustment coefficient corresponding to the target gradient RGB data according to the first saturation difference and the second saturation difference.
[0252] The first saturation difference may be obtained by calculating the difference between the saturation value corresponding to the target gradient RGB data and the initial saturation threshold corresponding to the gradient adjustment area.
[0253] The second saturation difference can be obtained by calculating the difference between the starting saturation threshold corresponding to the gradient adjustment area and the ending saturation threshold corresponding to the gradient adjustment area.
[0254] Therefore, by calculating the ratio between the first saturation difference and the second saturation difference, the gradient adjustment coefficient can be determined, and the gradient adjustment coefficient represents the relative saturation position of the saturation value of the target gradient RGB data in the area threshold of the gradient adjustment area.
[0255] In an optional implementation, when the preset area division type is a mixed division type, in order to ensure the calculation accuracy of the gradient adjustment coefficient, the gradient adjustment coefficient can be determined based on the angle value, saturation value corresponding to the target gradient RGB data and the zone threshold value corresponding to the gradient adjustment area.
[0256] Correspondingly, in the case where the preset area division type is a mixed division type, the gradient adjustment coefficient corresponding to the target gradient RGB data is determined according to the preset area division type corresponding to the color adjustment area and the area threshold corresponding to the gradient adjustment area, including: determining the first gradient coefficient corresponding to the target gradient RGB data according to the angle value corresponding to the target gradient RGB data and the starting angle threshold and the ending angle threshold corresponding to the gradient adjustment area; determining the second gradient coefficient corresponding to the target gradient RGB data according to the saturation value corresponding to the target gradient RGB data and the starting saturation threshold and the ending saturation threshold corresponding to the gradient adjustment area; and obtaining the gradient adjustment coefficient according to the first gradient coefficient and the second gradient coefficient.
[0257] The first gradient coefficient is used to characterize the relative angle position of the angle value corresponding to the target gradient RGB data in the area threshold corresponding to the gradient adjustment area. The first gradient coefficient is determined in the same manner as the gradient adjustment coefficient corresponding to the target gradient RGB sub-data under the angle division type, and will not be described in detail here.
[0258] The second gradient coefficient is used to characterize the relative saturation position of the saturation value corresponding to the target gradient RGB data in the area threshold corresponding to the gradient adjustment area. The second gradient coefficient is determined in the same manner as the gradient adjustment coefficient corresponding to the target gradient RGB data under the saturation division type, and is not described in detail here.
[0259] It should be noted that, when the preset area division type is a mixed division type, the gradient adjustment area can be a single gradient area only in the angle direction or only in the saturation direction. At this time, only the corresponding first gradient coefficient or the second gradient coefficient needs to be calculated.
[0260] Correspondingly, only when the gradient adjustment area is a mixed gradient area in the angle direction and the saturation direction, it is necessary to simultaneously determine the first gradient coefficient and the second gradient coefficient.
[0261] Therefore, the final gradient adjustment coefficient can be obtained according to the first gradient coefficient and the second gradient coefficient, and the gradient adjustment coefficient represents the relative position of the target gradient RGB data in the gradient adjustment area.
[0262] In the color adjustment method provided by the embodiment of the present disclosure, first, a color adjustment area and a color adjustment parameter included in a color adjustment request are obtained, wherein the color adjustment area can be determined according to a preset area division type, so that according to the preset area division type, target RGB data corresponding to the color adjustment area can be determined from multiple RGB data corresponding to multiple pixel points of the picture to be adjusted. Finally, it is only necessary to perform color adjustment processing on the target RGB data according to the color adjustment parameters, without the need to perform unified color adjustment on the entire picture to be adjusted, thereby realizing local color adjustment of the picture to be adjusted and greatly improving the flexibility of color adjustment of the video picture.
[0263] To facilitate understanding, the specific implementation details in the above embodiment are described below with an example.
[0264] In the related art, the video image is adjusted as a whole, such as adjusting the hue, saturation, and brightness with fixed values. The above adjustment method cannot achieve local color adjustment, that is, the color partition part is relatively rigid.
[0265] In view of this, an embodiment of the present disclosure provides a color adjustment method, which can locally and freely adjust the hue, saturation, brightness, etc. of a color area.
[0266] Figure 8 A flow chart of a color adjustment method provided by an embodiment of the present disclosure is shown. Figure 8 , the method comprising:
[0267] Step S810: obtaining a color adjustment area, a gradient adjustment area corresponding to the color adjustment area, and a color adjustment parameter included in the color adjustment request, wherein the color adjustment area is determined according to a preset area division type.
[0268] Step S820: According to a preset area division type, target RGB data corresponding to the color adjustment area is determined from a plurality of RGB data corresponding to a plurality of pixel points of the image to be adjusted.
[0269] Wherein, when the preset area division type is an angle division type, a plurality of preset color partitions may be divided according to a preset angle such as 60°, such as Figure 4 shown.
[0270] Specifically, in Figure 4 In the figure, the color change rules of the RGB data at the outer edges of each preset color area, namely Area1 to Area6, are as follows:
[0271] In counter-clockwise direction:
[0272] Area1: 0-60°: (255,0,0) to (255,255,0), G increasing, maximum color channel max = R, minimum color channel min = B;
[0273] Area2: 60-120°: (255,255,0) to (0,255,0), R decreases, max=G, min=B;
[0274] Area3: 120-180°: (0,255,0) to (0,255,255), B increases, max=G, min=R;
[0275] Area4: 180-240°: (0,255,255) to (0,0,255), G minus, max=B, min=R;
[0276] Area5: 240-300°: (0,0,255) to (255,0,255), R increases, max=B, min=G;
[0277] Area6: 300-360°: (255,0,255) to (255,0,0), B minus, max=R, min=G.
[0278] In clockwise direction:
[0279] Area1: 60-0°: (255,255,0) to (255,0,0), G minus, max=R, min=B;
[0280] Area2: 120-60°: (0,255,0) to (255,255,0), R increases, max = G, min = B;
[0281] Area3: 180-120°: (0,255,255) to (0,255,0), B minus, max=G, min=R;
[0282] Area4: 240-180°: (0,0,255) to (0,255,255), G increases, max=B, min=R;
[0283] Area5: 300-240°: (255,0,255) to (0,0,255), R decreases, max=B, min=G;
[0284] Area6: 360-300°: (255,0,0) to (255,0,255), B increases, max=R, min=G.
[0285] Furthermore, it is necessary to determine the preset color partition where the color adjustment area is located according to the area threshold of the color adjustment area, such as the starting area angle and the ending area angle.
[0286] Therefore, when determining the target RGB data corresponding to the color adjustment area, for each RGB data among the multiple RGB data corresponding to the to-be-adjusted picture, it is necessary to determine whether it is the target RGB data according to the preset color partition where the color adjustment area is located.
[0287] In practical applications, for ease of processing, 12-bit angle data can be used, that is, 0-4095 is used to represent the angle 0-360°. If the preset color partition is divided by the preset angle of 60°, then for each preset color partition, its area angle is 60°, so when the 12-bit angle data is used, 60° can be divided into 682 parts, and the last 60° preset color partition needs to make up for the missing part.
[0288] For example, if the preset color partition where the color adjustment area is located is the 60-120° area, namely Area 2, then the RGB data corresponding to the color adjustment area should meet the following conditions:
[0289] (max-R)>=(max-min)*mod(Hue_start / 682) / 682;
[0290] (max-R)<=(max-min)*mod(Hue_over / 682) / 682;
[0291] Among them, max is the channel value of the maximum color channel under the preset color partition contained in the RGB data, min is the channel value of the minimum color channel under the preset color partition contained in the RGB data, R is the channel value of the R channel contained in the RGB data, Hue_start is the starting area angle of the color adjustment area, and Hue_over is the ending area angle of the color adjustment area.
[0292] For ease of processing, further conversion can be done:
[0293] (max-R)*1024>=(max-min / 512)*(512 / 682)*mod(Hue_start / 682)*1024;
[0294] (max-R)*1024<=(max-min / 512)*(512 / 682)*mod(Hue_over / 682)*1024;
[0295] The max-R portion may be adaptively adjusted according to different preset color partitions. For example, if the preset color partition is Area 1, the max-R portion may be G-min.
[0296] Wherein, when the preset area division type is the saturation division type, the target RGB data can be determined in the following manner:
[0297] The saturation value corresponding to the RGB data may be calculated according to the saturation calculation formula S=(Dmax-Dmin) / Dmax.
[0298] Among them, Dmax is the maximum value in RGB data, Dmin is the minimum value in RGB data, and S is the saturation value corresponding to RGB data.
[0299] In practical applications, in order to facilitate processing, a bit width of 11 bits may be used to represent saturation data, and accordingly, S*2048=2048*(Dmax-Dmin) / Dmax.
[0300] Furthermore, for ease of processing, it can be further converted into:
[0301] S=((max-min) / 512)*(512 / max)*2048.
[0302] Therefore, after calculating the saturation value corresponding to the RGB data, a comparison can be made based on the area threshold corresponding to the color adjustment area, that is, the starting saturation Sat_start and the ending saturation Sat_over, and whether it is the target RGB data can be determined based on the comparison result.
[0303] In which, when the preset area division type is a mixed division type, multiple local color partitions can be divided according to a preset angle such as 60° and a preset saturation such as 0.2.
[0304] The local color partition is obtained by adding a saturation partition according to a preset saturation value on the basis of a preset color partition divided according to a preset angle.
[0305] Therefore, when selecting a color adjustment area, a local color partition can be directly selected as the color adjustment area.
[0306] For example, the preset color partition is evenly divided into 8 parts in the saturation direction, that is, 8 gears. Therefore, for each preset color partition, it corresponds to 8 divided saturation partitions, that is, 8 local color partitions.
[0307] Furthermore, the target RGB data may be determined from the plurality of RGB data according to a partition threshold of the local color partition corresponding to the color adjustment area.
[0308] Step S830: determining target gradient RGB data corresponding to the gradient adjustment area from a plurality of RGB data corresponding to a plurality of pixel points of the image to be adjusted.
[0309] The target gradient RGB data may be determined according to the area threshold corresponding to the gradient adjustment area.
[0310] Step S840: determining a gradient adjustment coefficient corresponding to the target gradient RGB data according to the preset region division type corresponding to the color adjustment region and the region threshold corresponding to the gradient adjustment region.
[0311] When the preset division type is the angle division type, it is necessary to determine whether the gradient adjustment area crosses the axis according to the area threshold corresponding to the gradient adjustment area, that is, it corresponds to multiple preset color partitions.
[0312] If it does not cross the axis, then this gradient adjustment area corresponds to only one preset color partition. In this case, it is necessary to determine the gradient adjustment coefficient corresponding to the position of the target gradient RGB data in the gradient adjustment area according to the data value of the target gradient RGB data.
[0313] Fig. 9 A schematic diagram showing the gradient adjustment coefficient under the angle division type is shown. Fig. 9 :
[0314] Hue_start_buf is the starting angle threshold of the gradient adjustment area, Hue_start and Hue_over are the starting area angle and ending area angle of the color adjustment area respectively. At this time, the gradient adjustment area and the color adjustment area are located in the same preset color partition. Correspondingly, the gradient adjustment coefficient can be calculated as follows: Gradient adjustment coefficient Y = ((max-R)*(682 / (max-min))-mod(Hue_start_buf / 682)) / buf gear.
[0315] Among them, max is the channel value of the maximum color channel under the preset color partition contained in the target gradient RGB data, min is the channel value of the minimum color channel under the preset color partition contained in the target gradient RGB data, R is the channel value of the R channel contained in the target gradient RGB data, Hue_start_buf is the starting angle threshold of the gradient adjustment area, and the buf gear is the area angle of the gradient adjustment area.
[0316] That is, the gradient adjustment coefficient is the percentage of the angle difference between the pixel angle value of the target gradient RGB data and the outer boundary axis of the gradient adjustment area in the area angle of the gradient adjustment area.
[0317] It can be seen that in the gradient adjustment area, the gradient adjustment coefficients at its two boundary axes are respectively a minimum value of 0 and a maximum value of 1.
[0318] If the gradient adjustment area crosses axes, that is, it corresponds to multiple preset color partitions, the gradient adjustment area needs to be divided into gradient adjustment partitions, and then the corresponding gradient adjustment coefficients in the area are determined for different gradient adjustment partitions.
[0319] For example, for Figure 7 In the gradient adjustment area in (a), the gradient adjustment coefficient of the target gradient RGB data in partition 1 can be calculated as follows: gradient adjustment coefficient Y = ((G-min)*(682 / (max-min))-mod(hue_start_buf / 682)) / buf gear.
[0320] Among them, max is the channel value of the maximum color channel under the preset color partition contained in the target gradient RGB data, min is the channel value of the minimum color channel under the preset color partition contained in the target gradient RGB data, G is the channel value of the G channel contained in the target gradient RGB data, hue_start_buf is the starting angle threshold of the gradient adjustment area, and buf gear is the area angle of the gradient adjustment area.
[0321] It should be noted that, at this time, the angle value of the buf gear position ranges from 0° to 360°, corresponding to an angle value of 0 to 4095, and the angle value can be input into a preset angle conversion module for calculation.
[0322] When the preset division type is the saturation division type, it needs to be determined according to the area threshold corresponding to the gradient adjustment area, the starting saturation Sat_over_buf and the ending saturation Sat_start_buf.
[0323] Exemplarily, if the saturation value of the target gradient RGB data is S, the corresponding gradient adjustment coefficient is: Y=(S-Sat_start_buf) / (Sat_over_buf-Sat_start_buf).
[0324] When the preset division type is a mixed division type, it is necessary to determine the gradient coefficient in the angle direction and / or the gradient coefficient in the saturation direction according to the gradient direction corresponding to the gradient adjustment area, so as to obtain the final gradient adjustment coefficient according to the above gradient coefficient.
[0325] Fig.10 A schematic diagram showing the gradient adjustment area under the mixed partitioning type is shown. Fig.10 :
[0326] For the color adjustment area A, its corresponding gradient adjustment areas are A1 to A8, where A1 and A2 are only gradient adjustment areas in the saturation direction, A4 and A7 are only gradient adjustment areas in the angle direction, and A3, A5, A6, and A8 are gradient adjustment areas in both the angle direction and the saturation direction.
[0327] Step S850: performing color adjustment processing on the target RGB data according to the color adjustment parameters, and performing color adjustment processing on the target gradient RGB data according to the gradient adjustment coefficient and the color adjustment parameters, to obtain an adjustment picture after color adjustment.
[0328] Specifically, the target RGB data may be converted into YUV data, thereby performing color adjustment processing on the YUV data according to the color adjustment parameter. For example, when adjusting the brightness, the brightness may be enhanced or reduced by increasing or decreasing the value of the brightness component Y in the YUV data by the parameter value of the color adjustment parameter.
[0329] When color adjustment is performed on the target gradient RGB data, the gradient adjustment coefficient needs to be multiplied by the color adjustment parameter to obtain the gradient color adjustment parameter, so as to perform color adjustment processing on the target gradient RGB data according to the gradient color adjustment parameter.
[0330] In practical applications, for the color adjustment parameter of hue, 0-1023 can be used to represent hue 0° to 360°, so it can be directly multiplied by the gradient adjustment coefficient.
[0331] For the brightness color adjustment parameter Bri_offset, 13-bit complement data can be used to represent it, that is, 10000 0000 0000 represents unchanged, and 11111 1111 1111 represents an increase of 4095. Therefore, when multiplying with the gradient adjustment coefficient, the highest bit can be taken out, the [11:0] part of the data is multiplied by the gradient ratio coefficient, and then the highest bit data is complemented.
[0332] Similarly, for the saturation color adjustment parameter Sat_ratio, 10-bit complement data can be used to represent it, that is, 10 0000 0000 represents unchanged, and 11 1111 1111 represents enhancement to the maximum saturation. Therefore, when multiplying with the gradient adjustment coefficient, the highest bit can be taken out, the [9:0] part of the data is multiplied with the gradient ratio coefficient, and then the highest bit data is complemented.
[0333] In the color adjustment method provided by the embodiment of the present disclosure, the color adjustment area is divided by the HSV top view. Therefore, for the RGB data of the picture to be adjusted, the area determination is first performed to determine whether it is in the corresponding color adjustment area, and then the RGB data is converted into YUV data, and the corresponding color adjustment processing is performed, and finally the RGB data is converted to obtain the adjusted picture after adjustment, which can locally and relatively highly freely adjust the hue, saturation, brightness, etc. of the color area to be changed.
[0334] The step division of the above methods is only for the purpose of clear description. When implemented, they can be combined into one step or some steps can be split and decomposed into multiple steps. As long as they include the same logical relationship, they are all within the scope of protection of this patent; adding insignificant modifications to the algorithm or process or introducing insignificant designs without changing the core design of the algorithm and process are all within the scope of protection of this patent.
[0335] In a second aspect, an embodiment of the present disclosure provides a color adjustment device. Fig.11 A block diagram of a color adjustment device provided by an embodiment of the present disclosure is shown, and the color adjustment device includes:
[0336] An acquisition module 11 is used to acquire a color adjustment area and a color adjustment parameter included in a color adjustment request, wherein the color adjustment area is determined according to a preset area division type;
[0337] A determination module 12, configured to determine target RGB data corresponding to the color adjustment area from a plurality of RGB data corresponding to a plurality of pixel points of the picture to be adjusted according to the preset area division type;
[0338] The adjustment module 13 is used to perform color adjustment processing on the target RGB data according to the color adjustment parameters to obtain an adjustment picture after color adjustment.
[0339] In an optional implementation, the determination module 12 determines the target RGB data corresponding to the color adjustment area from the multiple RGB data corresponding to the multiple pixel points of the picture to be adjusted according to the preset area division type, including:
[0340] Determine a region threshold corresponding to the color adjustment region under the preset region division type;
[0341] According to the area threshold, target RGB data corresponding to the color adjustment area is determined from a plurality of RGB data corresponding to a plurality of pixel points of the picture to be adjusted.
[0342] In an optional implementation, when the preset area division type is an angle division type, a plurality of preset color partitions are pre-divided according to a preset angle, and the area threshold is an area angle threshold; then, according to the area threshold, determining the target RGB data corresponding to the color adjustment area from a plurality of RGB data corresponding to a plurality of pixel points of the picture to be adjusted, includes:
[0343] Determining, according to the area angle threshold, a matching color partition corresponding to the color adjustment area from the plurality of preset color partitions;
[0344] Determine the color change channel, the maximum color channel, and the minimum color channel corresponding to the matching color partition from the R channel, the G channel, and the B channel;
[0345] For each RGB data among the multiple RGB data, a data difference between a channel value of the maximum color channel contained in the RGB data and a channel value of the minimum color channel contained in the RGB data is calculated; and according to the data difference and the area angle threshold, a channel value variation range corresponding to the RGB data under the color conversion channel is determined;
[0346] For each RGB data, a channel change value corresponding to the RGB data under the color conversion channel is calculated, and when the channel change value satisfies the channel value change range, the RGB data is determined as the target RGB data.
[0347] In an optional implementation, the area angle threshold includes a starting area angle and an ending area angle, and determining the channel value variation range corresponding to the RGB data under the color conversion channel according to the data difference and the area angle threshold includes:
[0348] Calculating a first angle ratio value between the starting area angle and the area angle of the matching color partition, and determining a minimum channel change value corresponding to the color conversion channel according to the first angle ratio value and the data difference;
[0349] Calculating a second angle ratio value between the termination area angle and the area angle of the matching color partition, and determining a maximum channel change value corresponding to the color conversion channel according to the second angle ratio value and the data difference;
[0350] The channel value variation range is determined according to the minimum channel variation value and the maximum channel variation value.
[0351] In an optional implementation, the calculating the channel change value corresponding to the RGB data under the color conversion channel includes:
[0352] Determine a data change state corresponding to the channel value of the color change channel under the matching color partition;
[0353] When the data change state is an ascending state, a difference between a channel value of the color change channel included in the RGB data and a channel value of the minimum color channel included in the RGB data is calculated to obtain the channel change value;
[0354] When the data change state is a decreasing state, a difference between a channel value of the maximum color channel included in the RGB data and a channel value of the color change channel included in the RGB data is calculated to obtain the channel change value.
[0355] In an optional implementation, when the preset area division type is a saturation division type, the area threshold is an area saturation threshold, and determining, according to the area threshold, target RGB data corresponding to the color adjustment area from a plurality of RGB data corresponding to a plurality of pixel points of the picture to be adjusted, includes:
[0356] For each RGB data among the plurality of RGB data, calculating a saturation value corresponding to the RGB data;
[0357] For each RGB data, when a saturation value corresponding to the RGB data satisfies a regional saturation threshold corresponding to the color adjustment region, the RGB data is determined to be target RGB data corresponding to the color adjustment region.
[0358] In an optional implementation, when the preset area division type is a mixed division type, a plurality of local color partitions are pre-divided according to preset angles and preset saturation values, and the area threshold includes an area angle threshold and an area saturation threshold. Then, according to the area threshold, determining the target RGB data corresponding to the color adjustment area from a plurality of RGB data corresponding to a plurality of pixel points of the picture to be adjusted includes:
[0359] Determining a matching local color partition corresponding to the color adjustment area from a plurality of pre-divided local color partitions;
[0360] Determining, according to the matching local color partition and the regional angle threshold, first RGB data corresponding to the regional angle threshold from the plurality of RGB data;
[0361] According to the regional saturation threshold, determining second RGB data corresponding to the regional saturation threshold from the plurality of RGB data;
[0362] The intersection data of the first RGB data and the second RGB data is determined as the target RGB data.
[0363] In an optional implementation manner, the color adjustment request also includes a gradient adjustment area corresponding to the color adjustment area, and the method further includes:
[0364] Determining target gradient RGB data corresponding to the gradient adjustment area from a plurality of RGB data corresponding to the picture to be adjusted;
[0365] Determining a gradient adjustment coefficient corresponding to the target gradient RGB data according to a preset area division type corresponding to the color adjustment area and an area threshold corresponding to the gradient adjustment area;
[0366] The target gradient RGB data is subjected to color adjustment processing according to the gradient adjustment coefficient and the color adjustment parameter.
[0367] In an optional implementation, when the preset area division type is an angle division type, determining the gradient adjustment coefficient corresponding to the target gradient RGB data according to the preset area division type corresponding to the color adjustment area and the area threshold corresponding to the gradient adjustment area includes:
[0368] In a case where the gradient adjustment region corresponds to a plurality of preset color partitions, dividing the gradient adjustment region into a plurality of gradient adjustment partitions corresponding to the plurality of preset color partitions;
[0369] For each gradient adjustment partition, determining target gradient RGB sub-data corresponding to the gradient adjustment partition from the target gradient RGB data;
[0370] For each gradient adjustment partition, a gradient adjustment coefficient corresponding to the target gradient RGB sub-data is determined according to a partition threshold corresponding to the gradient adjustment partition.
[0371] In an optional implementation, determining the gradient adjustment coefficient corresponding to the target gradient RGB sub-data according to the partition threshold corresponding to the gradient adjustment partition includes:
[0372] According to the preset color partition corresponding to the gradient adjustment partition, target channel data is determined from the target gradient RGB sub-data, and an angle value corresponding to the target channel data is calculated;
[0373] Calculate a first angle difference between the angle value corresponding to the target channel data and the starting angle threshold corresponding to the gradual adjustment partition;
[0374] Calculating a second angle difference between a starting angle threshold corresponding to the gradual adjustment partition and an ending angle threshold corresponding to the gradual adjustment partition;
[0375] A gradient adjustment coefficient corresponding to the target gradient RGB sub-data is determined according to the first angle difference and the second angle difference.
[0376] In an optional implementation, when the preset area division type is a saturation division type, determining the gradient adjustment coefficient corresponding to the target gradient RGB data according to the preset area division type corresponding to the color adjustment area and the area threshold corresponding to the gradient adjustment area includes:
[0377] Calculate a first saturation difference between a saturation value corresponding to the target gradient RGB data and a starting saturation threshold corresponding to the gradient adjustment area;
[0378] Calculating a second saturation difference between a starting saturation threshold corresponding to the gradient adjustment region and a terminating saturation threshold corresponding to the gradient adjustment region;
[0379] A gradient adjustment coefficient corresponding to the target gradient RGB data is determined according to the first saturation difference and the second saturation difference.
[0380] In an optional implementation, when the preset area division type is a mixed division type, determining the gradient adjustment coefficient corresponding to the target gradient RGB data according to the preset area division type corresponding to the color adjustment area and the area threshold corresponding to the gradient adjustment area includes:
[0381] Determine a first gradient coefficient corresponding to the target gradient RGB data according to an angle value corresponding to the target gradient RGB data and a starting angle threshold and an ending angle threshold corresponding to the gradient adjustment area;
[0382] Determine a second gradient coefficient corresponding to the target gradient RGB data according to a saturation value corresponding to the target gradient RGB data and a starting saturation threshold and an ending saturation threshold corresponding to the gradient adjustment area;
[0383] The gradient adjustment coefficient is obtained according to the first gradient coefficient and the second gradient coefficient.
[0384] The functions or modules included in the device provided in the embodiments of the present disclosure can be used to execute the method described in the first aspect of the method embodiment above. Its specific implementation and technical effects can be referred to the description of the method embodiment above. For the sake of brevity, they will not be repeated here.
[0385] It should be noted that all modules involved in this embodiment are logic modules. In practical applications, a logic unit may be a physical unit, or a part of a physical unit, or may be implemented as a combination of multiple physical units. In addition, in order to highlight the innovative part of the present disclosure, this embodiment does not introduce units that are not closely related to solving the technical problems proposed by the present disclosure, but this does not mean that there are no other units in this embodiment.
[0386] Reference Fig.12 , an embodiment of the present disclosure provides an electronic device, comprising:
[0387] One or more processors 1201;
[0388] A memory 1202 having one or more programs stored thereon, and when the one or more programs are executed by one or more processors, the one or more processors implement any one of the above color adjustment methods;
[0389] One or more I / O interfaces 1203 are connected between the processor and the memory and are configured to implement information exchange between the processor and the memory.
[0390] Among them, the processor 1201 is a device with data processing capabilities, including but not limited to a central processing unit (CPU); the memory 1202 is a device with data storage capabilities, including but not limited to random access memory (RAM, more specifically SDRAM, DDR, etc.), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory (FLASH); the I / O interface (read-write interface) 1203 is connected between the processor 901 and the memory 902, and can realize information interaction between the processor 1201 and the memory 1202, including but not limited to a data bus (Bus), etc.
[0391] In some embodiments, the processor 1201 , the memory 1202 , and the I / O interface 1203 are connected to each other via a bus, and further connected to other components of the computing device.
[0392] This embodiment further provides a computer-readable medium on which a computer program is stored. When the program is executed by a processor, the color adjustment method provided by this embodiment is implemented. To avoid repeated description, the specific steps of the color adjustment method are not repeated here.
[0393] It will be appreciated by those skilled in the art that all or some of the steps, systems, and functional modules / units in the invented method described above may be implemented as software, firmware, hardware, and appropriate combinations thereof. In hardware implementations, the division between the functional modules / units mentioned in the above description does not necessarily correspond to the division of physical components; for example, a physical component may have multiple functions, or a function or step may be performed by several physical components in cooperation. Some physical components or all physical components may be implemented as software executed by a processor, such as a central processing unit, a digital signal processor, or a microprocessor, or implemented as hardware, or implemented as an integrated circuit, such as an application-specific integrated circuit. Such software may be distributed on a computer-readable medium, which may include a computer storage medium (or non-transitory medium) and a communication medium (or temporary medium). As known to those skilled in the art, the term computer storage medium includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, program modules, or other data). Computer storage media include, but are not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, digital versatile disks (DVD) or other optical disk storage, magnetic cassettes, magnetic tapes, magnetic disk storage or other magnetic storage devices, or any other medium that can be used to store the desired information and can be accessed by a computer. In addition, it is well known to those skilled in the art that communication media typically contain computer-readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave or other transport mechanism, and may include any information delivery media.
[0394] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.
[0395] Those skilled in the art will understand that although some embodiments described herein include certain features included in other embodiments but not other features, the combination of features from different embodiments is meant to be within the scope of the present embodiment and to form different embodiments.
[0396] It is to be understood that the above embodiments are merely exemplary embodiments used to illustrate the principles of the present disclosure, but the present disclosure is not limited thereto. For those of ordinary skill in the art, various modifications and improvements can be made without departing from the spirit and substance of the present disclosure, and these modifications and improvements are also considered to be within the scope of protection of the present disclosure.
Claims
1. A color adjustment method, characterized in that: The method comprises: Acquire a color adjustment area and a color adjustment parameter included in the color adjustment request, wherein the color adjustment area is determined according to a preset area division type; According to the preset area division type, determining target RGB data corresponding to the color adjustment area from a plurality of RGB data corresponding to a plurality of pixel points of the picture to be adjusted; According to the color adjustment parameters, the target RGB data is subjected to color adjustment processing to obtain an adjustment picture after color adjustment.
2. The color adjustment method according to claim 1, characterized in that: The step of determining target RGB data corresponding to the color adjustment area from a plurality of RGB data corresponding to a plurality of pixel points of the picture to be adjusted according to the preset area division type includes: Determine a region threshold corresponding to the color adjustment region under the preset region division type; According to the area threshold, target RGB data corresponding to the color adjustment area is determined from a plurality of RGB data corresponding to a plurality of pixel points of the picture to be adjusted.
3. The color adjustment method according to claim 2, characterized in that: In the case where the preset area division type is an angle division type, a plurality of preset color partitions are pre-divided according to a preset angle, and the area threshold is an area angle threshold; then, according to the area threshold, determining the target RGB data corresponding to the color adjustment area from a plurality of RGB data corresponding to a plurality of pixel points of the picture to be adjusted, includes: Determining, according to the area angle threshold, a matching color partition corresponding to the color adjustment area from the plurality of preset color partitions; Determine the color change channel, the maximum color channel, and the minimum color channel corresponding to the matching color partition from the R channel, the G channel, and the B channel; For each RGB data among the multiple RGB data, a data difference between a channel value of the maximum color channel contained in the RGB data and a channel value of the minimum color channel contained in the RGB data is calculated; and according to the data difference and the area angle threshold, a channel value variation range corresponding to the RGB data under the color conversion channel is determined; For each RGB data, a channel change value corresponding to the RGB data under the color conversion channel is calculated, and when the channel change value satisfies the channel value change range, the RGB data is determined as the target RGB data.
4. The color adjustment method according to claim 3, characterized in that: The area angle threshold includes a starting area angle and an ending area angle, and determining the channel value variation range corresponding to the RGB data under the color conversion channel according to the data difference and the area angle threshold includes: Calculating a first angle ratio value between the starting area angle and the area angle of the matching color partition, and determining a minimum channel change value corresponding to the color conversion channel according to the first angle ratio value and the data difference; Calculating a second angle ratio value between the termination area angle and the area angle of the matching color partition, and determining a maximum channel change value corresponding to the color conversion channel according to the second angle ratio value and the data difference; The channel value variation range is determined according to the minimum channel variation value and the maximum channel variation value.
5. The color adjustment method according to claim 3, characterized in that: The calculating the channel change value corresponding to the RGB data under the color conversion channel includes: Determine a data change state corresponding to the channel value of the color change channel under the matching color partition; When the data change state is an ascending state, a difference between a channel value of the color change channel included in the RGB data and a channel value of the minimum color channel included in the RGB data is calculated to obtain the channel change value; When the data change state is a decreasing state, a difference between a channel value of the maximum color channel included in the RGB data and a channel value of the color change channel included in the RGB data is calculated to obtain the channel change value.
6. The color adjustment method according to claim 2, characterized in that: In the case where the preset area division type is a saturation division type, the area threshold is an area saturation threshold, and determining, according to the area threshold, target RGB data corresponding to the color adjustment area from a plurality of RGB data corresponding to a plurality of pixel points of the picture to be adjusted, includes: For each RGB data among the plurality of RGB data, calculating a saturation value corresponding to the RGB data; For each RGB data, when a saturation value corresponding to the RGB data satisfies a regional saturation threshold corresponding to the color adjustment region, the RGB data is determined to be target RGB data corresponding to the color adjustment region.
7. The color adjustment method according to claim 2, characterized in that: In the case where the preset area division type is a mixed division type, a plurality of local color partitions are pre-divided according to preset angles and preset saturation values, and the area threshold includes an area angle threshold and an area saturation threshold, then determining, according to the area threshold, target RGB data corresponding to the color adjustment area from a plurality of RGB data corresponding to a plurality of pixel points of the picture to be adjusted, includes: Determining a matching local color partition corresponding to the color adjustment area from a plurality of pre-divided local color partitions; Determining, according to the matching local color partition and the regional angle threshold, first RGB data corresponding to the regional angle threshold from the plurality of RGB data; According to the regional saturation threshold, determining second RGB data corresponding to the regional saturation threshold from the plurality of RGB data; The intersection data of the first RGB data and the second RGB data is determined as the target RGB data.
8. The color adjustment method according to any one of claims 1 to 7, characterized in that: If the color adjustment request also includes a gradient adjustment area corresponding to the color adjustment area, the method further includes: Determining target gradient RGB data corresponding to the gradient adjustment area from a plurality of RGB data corresponding to the picture to be adjusted; Determining a gradient adjustment coefficient corresponding to the target gradient RGB data according to a preset area division type corresponding to the color adjustment area and an area threshold corresponding to the gradient adjustment area; The target gradient RGB data is subjected to color adjustment processing according to the gradient adjustment coefficient and the color adjustment parameter.
9. The color adjustment method according to claim 8, characterized in that: In the case where the preset area division type is an angle division type, determining the gradient adjustment coefficient corresponding to the target gradient RGB data according to the preset area division type corresponding to the color adjustment area and the area threshold corresponding to the gradient adjustment area includes: In a case where the gradient adjustment region corresponds to a plurality of preset color partitions, dividing the gradient adjustment region into a plurality of gradient adjustment partitions corresponding to the plurality of preset color partitions; For each gradient adjustment partition, determining target gradient RGB sub-data corresponding to the gradient adjustment partition from the target gradient RGB data; For each gradient adjustment partition, a gradient adjustment coefficient corresponding to the target gradient RGB sub-data is determined according to a partition threshold corresponding to the gradient adjustment partition.
10. The color adjustment method according to claim 9, characterized in that: The step of determining the gradient adjustment coefficient corresponding to the target gradient RGB sub-data according to the partition threshold corresponding to the gradient adjustment partition includes: According to the preset color partition corresponding to the gradient adjustment partition, target channel data is determined from the target gradient RGB sub-data, and an angle value corresponding to the target channel data is calculated; Calculate a first angle difference between the angle value corresponding to the target channel data and the starting angle threshold corresponding to the gradual adjustment partition; Calculating a second angle difference between a starting angle threshold corresponding to the gradual adjustment partition and an ending angle threshold corresponding to the gradual adjustment partition; A gradient adjustment coefficient corresponding to the target gradient RGB sub-data is determined according to the first angle difference and the second angle difference.
11. The color adjustment method according to claim 8, characterized in that: In the case where the preset area division type is a saturation division type, determining the gradient adjustment coefficient corresponding to the target gradient RGB data according to the preset area division type corresponding to the color adjustment area and the area threshold corresponding to the gradient adjustment area includes: Calculate a first saturation difference between a saturation value corresponding to the target gradient RGB data and a starting saturation threshold corresponding to the gradient adjustment area; Calculating a second saturation difference between a starting saturation threshold corresponding to the gradient adjustment region and a terminating saturation threshold corresponding to the gradient adjustment region; A gradient adjustment coefficient corresponding to the target gradient RGB data is determined according to the first saturation difference and the second saturation difference.
12. The color adjustment method according to claim 8, characterized in that: In the case where the preset area division type is a mixed division type, determining the gradient adjustment coefficient corresponding to the target gradient RGB data according to the preset area division type corresponding to the color adjustment area and the area threshold corresponding to the gradient adjustment area includes: Determine a first gradient coefficient corresponding to the target gradient RGB data according to an angle value corresponding to the target gradient RGB data and a starting angle threshold and an ending angle threshold corresponding to the gradient adjustment area; Determine a second gradient coefficient corresponding to the target gradient RGB data according to a saturation value corresponding to the target gradient RGB data and a starting saturation threshold and an ending saturation threshold corresponding to the gradient adjustment area; The gradient adjustment coefficient is obtained according to the first gradient coefficient and the second gradient coefficient.
13. A color adjustment device, characterized in that: The device comprises: An acquisition module, configured to acquire a color adjustment area and a color adjustment parameter included in a color adjustment request, wherein the color adjustment area is determined according to a preset area division type; A determination module, configured to determine, according to the preset area division type, target RGB data corresponding to the color adjustment area from a plurality of RGB data corresponding to a plurality of pixel points of the picture to be adjusted; The adjustment module is used to perform color adjustment processing on the target RGB data according to the color adjustment parameters to obtain an adjustment picture after color adjustment.
14. An electronic device, characterized in that: include: one or more processors; A storage device having one or more programs stored thereon, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 12; One or more I / O interfaces are connected between the processor and the memory and are configured to implement information interaction between the processor and the memory.
15. A computer readable medium having a computer program stored thereon, wherein when the program is executed by a processor, the method according to any one of claims 1 to 12 is implemented.
Citation Information
Cited By
Prism ink screen special-shaped image configuration method and device, terminal equipment and storage medium
CN120144078A
