Image processing method and device, storage medium and electronic equipment
By adjusting the coordinates of the target pixel in the RGB color space that are equal to the target pixel hue, the problem of complex and inefficient image color processing is solved, achieving high efficiency in image processing and color enhancement.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- BEIJING XIAOMI MOBILE SOFTWARE CO LTD
- Filing Date
- 2021-07-16
- Publication Date
- 2026-06-12
AI Technical Summary
Current image color processing techniques are complex and inefficient, especially when it comes to enhancing memory colors such as blue sky and green plant colors, where there is a lack of effective methods.
In the RGB color space, multiple coordinate points with the same hue as the target pixel are determined, and the target pixel is adjusted according to the RGB parameters of these coordinate points to achieve image enhancement processing.
It improves image processing efficiency without altering the image's color tone, ensuring the accuracy and vibrancy of color adjustments, with a particularly significant enhancement effect on memory colors such as blue skies and greenery.
Smart Images

Figure CN115619879B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of image processing technology, and more specifically, to an image processing method, apparatus, storage medium, and electronic device. Background Technology
[0002] As people's demands for camera capabilities increase, color enhancement processing can be applied to images to make them more vibrant and lifelike. However, current technologies for color processing are complex and inefficient. Summary of the Invention
[0003] To overcome the problems existing in related technologies, this disclosure provides an image processing method, apparatus, storage medium, and electronic device.
[0004] According to a first aspect of the present disclosure, an image processing method is provided, the method comprising:
[0005] Obtain the target pixels in the image to be processed;
[0006] Obtain the RGB parameters of the target pixel in the RGB color space;
[0007] Based on the RGB parameters of the target pixel, a plurality of first coordinate points in the RGB color space are determined, wherein the hue of the first coordinate points is equal to the hue of the target pixel;
[0008] Based on the RGB parameters of the first coordinate point, the RGB parameters of the target pixel are adjusted to enhance the image to be processed.
[0009] Optionally, adjusting the RGB parameters of the target pixel based on the RGB parameters of the first coordinate point includes:
[0010] Multiple second coordinate points are determined from the plurality of first coordinate points, wherein the first color parameter of the second coordinate point is the same as that of the target pixel, and the first color parameter includes any one of brightness, chroma and saturation;
[0011] The RGB parameters of the target pixel are adjusted based on the RGB parameters of the plurality of second coordinate points.
[0012] Optionally, adjusting the RGB parameters of the target pixel based on the RGB parameters of the plurality of second coordinate points includes:
[0013] The first candidate coordinate point is calculated based on the preset first color enhancement parameter and the RGB parameters of the plurality of second coordinate points. The preset first color enhancement parameter is used to enhance other color parameters among the brightness, chroma and saturation that are different from the first color parameter.
[0014] The RGB parameters of the target pixel are adjusted based on the RGB parameters of the first candidate coordinate point.
[0015] Optionally, adjusting the RGB parameters of the target pixel based on the RGB parameters of the first candidate coordinate point includes:
[0016] The RGB parameters of the first candidate coordinate point are used as the RGB parameters of the target pixel.
[0017] Optionally, adjusting the RGB parameters of the target pixel based on the RGB parameters of the plurality of second coordinate points includes:
[0018] The second candidate coordinate point is calculated based on the preset second color enhancement parameter and the RGB parameters of the plurality of second coordinate points. The preset second color enhancement parameter is used to enhance other color parameters among the brightness, chroma and saturation that are different from the first color parameter.
[0019] Based on the second candidate coordinate point, a plurality of third coordinate points are determined from the plurality of first coordinate points. The second color parameter of the third coordinate point is the same as that of the second candidate coordinate point. The second color parameter is the color parameter used by the second color enhancement parameter for enhancement.
[0020] The RGB parameters of the target pixel are adjusted based on the RGB parameters of the plurality of third coordinate points.
[0021] Optionally, adjusting the RGB parameters of the target pixel based on the RGB parameters of the plurality of third coordinate points includes:
[0022] Based on the preset third color enhancement parameter and the RGB parameters of the plurality of third coordinate points, a third candidate coordinate point is calculated. The preset third color enhancement parameter is used to enhance the other color parameters in brightness, chroma and saturation besides the first color parameter and the second color parameter.
[0023] The RGB parameters of the third candidate coordinate point are used as the RGB parameters of the target pixel.
[0024] Optionally, the color of the target pixel is a memory color.
[0025] According to a second aspect of the present disclosure, an image processing apparatus is provided, the apparatus comprising:
[0026] The target pixel acquisition module is configured to acquire target pixels in the image to be processed;
[0027] The RGB parameter acquisition module is configured to acquire the RGB parameters of the target pixel in the RGB color space;
[0028] The coordinate point acquisition module is configured to determine multiple first coordinate points in the RGB color space based on the RGB parameters of the target pixel, wherein the hue of the first coordinate points is equal to the hue of the target pixel;
[0029] The RGB parameter adjustment module is configured to adjust the RGB parameters of the target pixel based on the RGB parameters of the first coordinate point in order to enhance the image to be processed.
[0030] Optionally, the RGB parameter adjustment module is configured to determine a plurality of second coordinate points from the plurality of first coordinate points, wherein the first color parameter of the second coordinate points is the same as that of the target pixel, and the first color parameter includes any one of brightness, chroma, and saturation; and to adjust the RGB parameters of the target pixel according to the RGB parameters of the plurality of second coordinate points.
[0031] Optionally, the RGB parameter adjustment module is configured to calculate a first candidate coordinate point based on a preset first color enhancement parameter and the RGB parameters of the plurality of second coordinate points, wherein the preset first color enhancement parameter is used to enhance other color parameters among the brightness, chroma, and saturation that are different from the first color parameter; and to adjust the RGB parameters of the target pixel based on the RGB parameters of the first candidate coordinate point.
[0032] Optionally, the RGB parameter adjustment module is configured to use the RGB parameters of the first candidate coordinate point as the RGB parameters of the target pixel.
[0033] Optionally, the RGB parameter adjustment module is configured to calculate a second candidate coordinate point based on a preset second color enhancement parameter and the RGB parameters of the plurality of second coordinate points, wherein the preset second color enhancement parameter is used to enhance other color parameters among the brightness, chroma, and saturation that are different from the first color parameter; determine a plurality of third coordinate points from the plurality of first coordinate points based on the second candidate coordinate points, wherein the second color parameter of the third coordinate points is the same as that of the second candidate coordinate points, and the second color parameter is the color parameter that the second color enhancement parameter is used to enhance; and adjust the RGB parameters of the target pixel based on the RGB parameters of the plurality of third coordinate points.
[0034] Optionally, the RGB parameter adjustment module is configured to calculate a third candidate coordinate point based on a preset third color enhancement parameter and the RGB parameters of the plurality of third coordinate points. The preset third color enhancement parameter is used to enhance the other color parameters in brightness, chroma, and saturation besides the first and second color parameters. The RGB parameters of the third candidate coordinate point are used as the RGB parameters of the target pixel.
[0035] Optionally, the color of the target pixel is a memory color.
[0036] According to a third aspect of the present disclosure, an electronic device is provided, comprising:
[0037] processor;
[0038] Memory used to store processor-executable instructions;
[0039] The processor is configured to perform the steps of the image processing method provided in the first aspect of this disclosure.
[0040] According to a fourth aspect of the present disclosure, a computer-readable storage medium is provided that stores computer program instructions thereon, which, when executed by a processor, implement the steps of the image processing method provided in the first aspect of the present disclosure.
[0041] The technical solutions provided by the embodiments of this disclosure can include the following beneficial effects: By acquiring a target pixel in the image to be processed, the RGB parameters of the target pixel in the RGB color space are obtained; based on the RGB parameters, a plurality of first coordinate points in the RGB color space are determined, the hue of the first coordinate points being equal to the hue of the target pixel; based on the RGB parameters of the first coordinate points, the RGB parameters of the target pixel are adjusted to enhance the image to be processed. In this way, color adjustment of the target pixel is achieved based on the RGB color space without requiring a change in color space, which avoids distortion caused by changes in image hue and improves image processing efficiency.
[0042] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit this disclosure. Attached Figure Description
[0043] The accompanying drawings, which are incorporated in and form a part of this specification, illustrate embodiments consistent with this disclosure and, together with the description, serve to explain the principles of this disclosure.
[0044] Figure 1 This is a flowchart illustrating an image processing method according to an exemplary embodiment.
[0045] Figure 2 This is a schematic diagram illustrating an RGB color space according to an exemplary embodiment.
[0046] Figure 3 This is a schematic diagram illustrating RGB parameter adjustment of a target pixel according to an exemplary embodiment.
[0047] Figure 4 This is a schematic diagram illustrating another method for adjusting the RGB parameters of a target pixel according to an exemplary embodiment.
[0048] Figure 5 This is a block diagram illustrating an image processing apparatus according to an exemplary embodiment.
[0049] Figure 6 This is a block diagram of an electronic device according to an exemplary embodiment. Detailed Implementation
[0050] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numerals in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this disclosure. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this disclosure as detailed in the appended claims.
[0051] First, the application scenarios of this disclosure are explained. This disclosure can be applied to image processing scenarios. To make the colors of captured images more vivid and realistic, the colors of the image can be processed, especially the memory colors. Memory colors refer to colors that people have deeply remembered through long-term practice, thus their perception of these colors has certain rules and forms inherent habits; these colors are called memory colors. For example, the colors of the blue sky and green plants can be memory colors. In related technologies, image color processing is relatively complex and inefficient. For example, in related technologies, the RGB (Red, Blue, Green) color space of an image can be converted to the visually perceptual HSV (Hue Saturation Value) color space. Based on the HSV color space, the image colors are enhanced, and the enhanced image is then converted back from the HSV color space to the RGB color space to obtain the enhanced image. This method involves two color space conversions, increasing computational complexity and resulting in low efficiency.
[0052] To address the aforementioned problems, this disclosure provides an image processing method, apparatus, storage medium, and electronic device. Based on the RGB color space, multiple first coordinate points with the same hue as a target pixel are determined. The RGB parameters of the target pixel are then adjusted according to the RGB parameters of these first coordinate points to enhance the image. In this way, color adjustment of the target pixel is achieved based on the RGB color space without requiring color space changes, thus avoiding distortion caused by hue alterations and improving image processing efficiency.
[0053] The present disclosure will now be described in conjunction with specific embodiments.
[0054] Figure 1 This is an image processing method illustrated according to an exemplary embodiment, such as... Figure 1 As shown, the method may include:
[0055] S101. Obtain the target pixels in the image to be processed.
[0056] For example, a color thresholding method can be used to segment the image to be processed based on the grayscale values and texture information of the pixels, obtaining target pixels that meet the target color requirements; alternatively, the image to be processed can be input into a pre-trained image segmentation model to obtain target pixels that meet the target color requirements. This image segmentation model may include a deep convolutional neural network.
[0057] Furthermore, a target color filter can be used to obtain target pixels from the image to be processed that meet the target color requirements. For example, solid color pixels in the image to be processed can be used as target pixels.
[0058] S102. Obtain the RGB parameters of the target pixel in the RGB color space.
[0059] The RGB color space is based on three primary colors: R (Red), G (Green), and B (Blue). Different levels of superposition are used to produce a rich and wide range of colors, hence it is commonly known as the three-primary-color model.
[0060] Figure 2 This is a schematic diagram illustrating an RGB color space according to an exemplary embodiment, such as... Figure 2As shown, this RGB color space uses a cube of unit length to represent colors. The eight common colors—black, blue, green, cyan, red, purple, yellow, and white—are located at the eight vertices of the cube. Black is typically placed at the origin of a three-dimensional Cartesian coordinate system, while the three primary colors—red, green, and blue—are placed on the three coordinate axes. The values of the red, green, and blue coordinate axes can range from 0 to 255, or they can be normalized to between 0 and 1. This explanation uses the normalized range of 0 to 1 for the red, green, and blue coordinate axes as an example, but it should be noted that the method of this disclosure is also applicable to cases where the value range can be between 0 and 255.
[0061] In this RGB color space, each coordinate point can represent a color, which can be determined by RGB parameters, including three parameters: red, green, and blue. For example, the RGB parameters for black can be (0,0,0); the RGB parameters for white can be (1,1,1); and the RGB parameters for red can be (1,0,0).
[0062] The RGB parameters of the target pixel in the RGB space can be determined based on the color of the target pixel. The RGB parameters can include the parameter values of the target pixel at the R, B, and G coordinates.
[0063] S103. Based on the RGB parameters of the target pixel, determine multiple first coordinate points in the RGB color space.
[0064] The hue of the first coordinate point is equal to the hue of the target pixel.
[0065] In this step, the first coordinate point with RGB parameters (x1, y1, z1) can be determined in the RGB color space using the following formula (1):
[0066]
[0067] Where (R, G, B) represent the RGB parameters of the target pixel, and (x1, y1, z1) represent the RGB parameters of the first coordinate point.
[0068] It should be noted that multiple first coordinate points determined by formula (1) are on the same plane, and the plane composed of multiple first coordinate points can be regarded as the isochromatic plane.
[0069] Furthermore, in this step, the isotone plane can also be determined based on the RGB parameters of the target pixel, and multiple coordinate points on the isotone plane can be used as the first coordinate point mentioned above.
[0070] For example, in Figure 2In the RGB color space shown, the RGB parameters of point O are (0,0,0), the RGB parameters of point K are (1,1,1), and the RGB parameters of point P are the RGB parameters of the target pixel. The straight line from point O to point K can be used as the grayscale axis. Thus, the isotone plane corresponding to the target pixel is determined based on the straight line from point O to point K and the grayscale axis, which is based on the vector... and The resulting plane is the isotone plane corresponding to the target pixel, and multiple coordinate points on this isotone plane can all be used as the first coordinate point mentioned above. It should be noted that adjustments to brightness and saturation made on this isotone plane will not affect the hue of the processed color, and the boundaries of the isotone plane also limit the range of color adjustments. Therefore, it can be ensured that the colors are not distorted after image processing, improving the fidelity of image processing.
[0071] S104. Based on the RGB parameters of the first coordinate point, adjust the RGB parameters of the target pixel to enhance the image to be processed.
[0072] For example, based on the parameter adjustment requirements of the target pixel, a first coordinate point that meets the parameter adjustment requirements can be selected from multiple first coordinate points, and the RGB parameters of the first coordinate point can be used as the RGB parameters of the target pixel. For instance, if the parameter adjustment requirement of the target pixel is to enhance brightness, a first coordinate point with a brightness greater than that of the target pixel can be selected from multiple first coordinate points; if the parameter adjustment requirement of the target pixel is to enhance saturation, a first coordinate point with a saturation greater than that of the target pixel can be selected from multiple first coordinate points.
[0073] Using the above method, the target pixel in the image to be processed is obtained, and its RGB parameters in the RGB color space are acquired. Based on these RGB parameters, multiple first coordinate points in the RGB color space are determined, and the hue of each first coordinate point is equal to the hue of the target pixel. Based on the RGB parameters of these first coordinate points, the RGB parameters of the target pixel are adjusted to enhance the image. In this way, color adjustment of the target pixel is achieved based on the RGB color space without requiring a change in color space, which avoids distortion caused by hue alteration and improves image processing efficiency.
[0074] Furthermore, step S104 above, adjusting the RGB parameters of the target pixel based on the RGB parameters of the first coordinate point, may include the following steps:
[0075] First, determine multiple second coordinate points from multiple first coordinate points.
[0076] The first color parameter of the second coordinate point is the same as that of the target pixel, and this first color parameter includes any one of brightness, chroma, and saturation. Example:
[0077] When the first color parameter includes brightness, the second coordinate point with RGB parameters (x2, y2, z2) can be determined according to the following formula (2):
[0078]
[0079] Where (R, G, B) represent the RGB parameters of the target pixel, and (x2, y2, z2) represent the RGB parameters of the second coordinate point.
[0080] It should be noted that the brightness of the second coordinate point determined by the above formula (2) is the same as that of the target pixel, and it is a straight line on the isotone plane. The straight line formed by the second coordinate point can be called the isotone axis corresponding to the target pixel.
[0081] When the first color parameter includes chromaticity, the second coordinate point with RGB parameters (x3, y3, z3) can be determined according to the following formula (3):
[0082]
[0083] Where (R, G, B) represent the RGB parameters of the target pixel, and (x3, y3, z3) represent the RGB parameters of the second coordinate point.
[0084] It should also be noted that the chromaticity of the second coordinate point determined by the above formula (3) is the same as that of the target pixel, and it is a straight line on the isochromatic plane. The straight line formed by the second coordinate point can be called the isochromatic axis corresponding to the target pixel.
[0085] When the first color parameter includes saturation, the second coordinate point with RGB parameters (x4, y4, z4) can be determined according to the following formula (4):
[0086]
[0087] Where (R, G, B) represent the RGB parameters of the target pixel, and (x4, y4, z4) represent the RGB parameters of the second coordinate point.
[0088] It should also be noted that the saturation of the second coordinate point determined by the above formula (4) is the same as that of the target pixel, and it is a straight line on the isochromatic plane. The straight line formed by the second coordinate point can be called the isochromatic axis corresponding to the target pixel.
[0089] Then, based on the RGB parameters of the multiple second coordinate points, the RGB parameters of the target pixel are adjusted.
[0090] Similarly, based on the parameter adjustment requirements of the target pixel, a second coordinate point that meets the parameter adjustment requirements can be selected from multiple second coordinate points, and the RGB parameters of the second coordinate point can be used as the RGB parameters of the target pixel.
[0091] This ensures that the hue and primary color parameters remain unchanged after the target pixel is adjusted, further preventing color distortion.
[0092] Furthermore, adjusting the RGB parameters of the target pixel based on the RGB parameters of the multiple second coordinate points can include:
[0093] First, the first candidate coordinate point is calculated based on the preset first color enhancement parameter and the RGB parameters of the multiple second coordinate points.
[0094] The preset first color enhancement parameter is used to enhance other color parameters that are different from the first color parameter in terms of brightness, chroma, and saturation.
[0095] Then, based on the RGB parameters of the first candidate coordinate point, the RGB parameters of the target pixel are adjusted.
[0096] For example, the RGB parameters of the first candidate coordinate point can be used as the RGB parameters of the target pixel.
[0097] For example, the first color parameter can be brightness, and the preset first color enhancement parameter can be a preset first saturation enhancement parameter used to enhance saturation. The preset first color enhancement parameter can be any value between 1 and 5, such as 2.
[0098] In this way, the first candidate coordinate point can be calculated, and the RGB parameters of the first candidate coordinate point can be used as the RGB parameters of the target pixel.
[0099] In another embodiment of this disclosure, adjusting the RGB parameters of the target pixel based on the RGB parameters of the plurality of second coordinate points may include:
[0100] First, the second candidate coordinate points are calculated based on the preset second color enhancement parameters and the RGB parameters of the multiple second coordinate points.
[0101] The preset second color enhancement parameter is used to enhance other color parameters in brightness, chroma, and saturation that are different from the first color parameter.
[0102] For example, the first color parameter can be chroma, and the preset second color enhancement parameter can be a preset brightness enhancement parameter used to enhance brightness. The preset second color enhancement parameter can be any value between 1 and 3, such as 1.5.
[0103] Secondly, based on the second candidate coordinate point, multiple third coordinate points are determined from multiple first coordinate points. The second color parameter of the third coordinate point is the same as that of the second candidate coordinate point. The second color parameter is the color parameter used by the second color enhancement parameter for enhancement.
[0104] Finally, the RGB parameters of the target pixel are adjusted based on the RGB parameters of the multiple third coordinate points.
[0105] For example, the first color parameter mentioned above can be chroma, the second color parameter mentioned above can be luminance, and the preset second color enhancement parameter mentioned above can be a preset luminance enhancement parameter used to enhance luminance. This preset second color enhancement parameter can be any value between 1 and 3, such as 1.5. In this way, firstly, the hue and chroma of the target pixel are kept unchanged, and the luminance of the target pixel is adjusted; after the luminance adjustment is completed, the luminance is kept unchanged, and the other RGB parameters of the target pixel are adjusted, thereby completing the RGB parameter adjustment of the target pixel.
[0106] In this way, the color parameters of the target pixel are adjusted for the first time while keeping the hue and the first color parameter unchanged; then, the color parameters of the target pixel are adjusted for the second time while keeping the second color parameter unchanged. Through these two adjustments, the vividness of the target pixel can be enhanced while avoiding color hue distortion.
[0107] Furthermore, adjusting the RGB parameters of the target pixel based on the RGB parameters of the multiple third coordinate points may include the following steps:
[0108] First, the third candidate coordinate point is calculated based on the preset third color enhancement parameters and the RGB parameters of the multiple third coordinate points.
[0109] The preset third color enhancement parameter is used to enhance the other color parameters in brightness, chroma, and saturation besides the first and second color parameters.
[0110] For example, if the first color parameter can be chroma, the preset second color enhancement parameter can be used to enhance brightness, and the second color parameter can be brightness, then the preset third color enhancement parameter can be used to enhance saturation.
[0111] Then, the RGB parameters of the third candidate coordinate point are used as the RGB parameters of the target pixel.
[0112] In this way, the third candidate coordinate point can be calculated, and the RGB parameters of the third candidate coordinate point can be used as the RGB parameters of the target pixel.
[0113] In another embodiment of this disclosure, the color of the target pixel can be a memory color, which may include the color of the blue sky or green plants. That is, the memory color type of the target pixel includes either the blue sky or green plants. In related technologies, there is no distinction between the enhancement methods for the blue sky and green plants when performing image enhancement processing. The inventors discovered that different methods can be used to enhance the color of the blue sky and the green plants: when enhancing the blue sky, the main focus is on saturation, while its brightness can remain unchanged; however, enhancing the green plants requires enhancing both its brightness and saturation. In this way, the enhanced image can be more vibrant and realistic.
[0114] In this embodiment, the pixels of the image to be processed can be filtered first by the memory color filter to obtain the memory color type of the target pixel. If the memory color type of the target pixel is blue sky or green plants, different image processing can be performed.
[0115] Figure 3 This is a schematic diagram illustrating RGB parameter adjustment of a target pixel according to an exemplary embodiment. When the target pixel's memory color type is blue sky, the aforementioned first color parameter may include brightness. Thus, as... Figure 3 As shown, adjusting the RGB parameters of the target pixel based on the RGB parameters of the first coordinate point can include the following steps:
[0116] First, determine the RBG parameters of multiple second coordinate points from the multiple first coordinate points mentioned above.
[0117] The second coordinate point can be either the first endpoint or the second endpoint of the isoluminance axis. For example:
[0118] The first endpoint P can be determined according to the following formulas (5) and (6). 01 ;
[0119] R0=G0=B0=0.299*R+0.587*G+0.114*B (5);
[0120] P 01 ={R0,G0,B0} (6);
[0121] Where (R, G, B) represent the RGB parameters of the target pixel, and (R0, G0, B0) represent the first endpoint P. 01 The RGB parameters.
[0122] The second endpoint P can be determined according to the following formula (7).max1 ;
[0123] P max1 =[R,G,B] T +k max1 *[RV achromatic1 GV achromatic1 ,B-Vachromatic1]T (7);
[0124] Among them, P max1 The second endpoint represents the RGB parameters, (R, G, B) represents the RGB parameters of the target pixel, and V represents the RGB parameters of the target pixel. achromatic1 k represents the brightness value of the target pixel. max1 This represents the first adjustment factor.
[0125] The above V achromatic1 It can be calculated using the following formula (8):
[0126] V achromatic1 =0.299*R+0.587*G+0.114*B (8)
[0127] Where (R, G, B) represent the RGB parameters of the target pixel, V achromatic1 This represents the brightness value of the target pixel.
[0128] The above k max1 This can be calculated using the following formula (9):
[0129]
[0130] Where (R, G, B) represent the RGB parameters of the target pixel, V achromatic1 k represents the brightness value of the target pixel. max1 This represents the adjustment factor.
[0131] It should be noted that, In order to ensure that according to P max1 The adjusted RGB parameters satisfy the non-negativity constraint. In order to ensure that according to P max1 The adjusted RGB parameter value does not exceed the maximum value of 1.
[0132] This ensures that the calculated P max1 Located on the boundary of the RGB color space, subsequent steps are based on this P. 01 and P max1 Adjusting the RGB parameters of the target pixel ensures that the adjusted RGB parameters remain within the RGB color space, thus avoiding color distortion.
[0133] Then, based on the preset first color enhancement parameter and the RGB parameters of the first endpoint and the second endpoint, the first candidate coordinate point is calculated.
[0134] The preset first color enhancement parameter can be a preset first saturation enhancement parameter, which is used to enhance the saturation of the pixel and can be any value between 1 and 5, such as 2.
[0135] For example, the RGB parameters of the first candidate coordinate point can be calculated according to the following formula (10):
[0136]
[0137] Among them, P h1 Represents the RGB parameters of the first candidate coordinate point; γ sky This indicates the preset first saturation enhancement parameter; P 01 P represents the RGB parameters of the first endpoint. max1 L0 represents the RGB parameters of the second endpoint; L0 represents the vector. The norm, for example, can represent a vector. The second norm, that is, P 01 and p max1 The distance between two coordinate points; L represents the vector. The norm, for example, can represent a vector. The second norm, that is, P 01 The distance between two coordinate points P and P, where P represents the RGB parameters corresponding to the target pixel.
[0138] Finally, the RGB parameters of the first candidate coordinate point are used as the RGB parameters of the target pixel.
[0139] In this way, when the memory color type of the target pixel is blue sky, targeted parameter adjustments can be made for the blue sky scene. By defining the boundary on the isotone plane based on the two endpoints, the problem of saturation overflow can be avoided, making the colors of the image more vivid and realistic.
[0140] Figure 4 This is a schematic diagram illustrating another method for adjusting the RGB parameters of a target pixel according to an exemplary embodiment. When the memory color type of the target pixel is greenery, the first color parameter may include chromaticity. Thus, as... Figure 4 As shown, adjusting the RGB parameters of the target pixel based on the RGB parameters of the first coordinate point can include the following steps:
[0141] First, determine the second coordinate point from the multiple first coordinate points mentioned above.
[0142] The second coordinate point may include the two endpoints P where the isochromatic axis intersects the isohue plane. 0_C and P max_C .
[0143] Secondly, based on the preset second color enhancement parameters and the two endpoints P mentioned above... 0_C and P max_C The second candidate coordinate point is obtained by calculating the RGB parameters.
[0144] The preset second color enhancement parameter can be a preset brightness enhancement parameter, which is used to enhance the brightness of the pixel. It can be any value between 1 and 3, such as 1.5.
[0145] For example, the RGB parameters of the second candidate coordinate point can be calculated according to the following formula (11):
[0146]
[0147] Among them, P h2 Represents the RGB parameters of the second candidate coordinate point; γ lightness Indicates the preset brightness enhancement parameter; P 0_C and P max_C These represent the RGB parameters at the two endpoints where the aforementioned isochromaticity axes intersect the isohue plane; Lightness P Indicates the brightness of the target pixel; Indicates endpoint P 0_C Brightness; Represents another endpoint P max_C The brightness.
[0148] Next, based on the second candidate coordinate point, a plurality of third coordinate points are determined from the plurality of first coordinate points.
[0149] The second color parameter of the third coordinate point is the same as that of the second candidate coordinate point. This second color parameter is the color parameter used for enhancement by the second color enhancement parameter. For example, if the second color enhancement parameter is a parameter for enhancing brightness, then the second color parameter can be brightness, and the third coordinate point can be the third and fourth endpoints of the isoluminance axis corresponding to the second candidate coordinate point among the plurality of first coordinate points.
[0150] The third endpoint P can be determined according to the following formulas (12) and (13). 02 ;
[0151] R02=G02=B02=0.299*R3+0.587*G3+0.114*B3 (12);
[0152] P 02={R02,G02,B02} (13);
[0153] Where (R3, G3, B3) represent the RGB parameters of the second candidate coordinate point, and (R02, G02, B02) represent the third endpoint P. 02 The RGB parameters.
[0154] The fourth endpoint P can be determined according to the following formula (14). max2 ;
[0155] P max2 =
[0156] [R3,G3,B3] T +k max2 *[R3-V achromatic2 G3-V achromatic2 ,B3-Vachromatic2]T (14);
[0157] Among them, P max2 The RGB parameters of the fourth endpoint are represented by (R3, G3, B3), which represent the RGB parameters of the second candidate coordinate point mentioned above. achromatic2 k represents the brightness value of the second candidate coordinate point mentioned above. max2 This represents the second adjustment factor.
[0158] The above V achromatic2 It can be calculated using the following formula (15):
[0159] V achromatic2 =0.299*R3+0.587*G3+0.114*B3 (15)
[0160] Where (R3, G3, B3) represent the RGB parameters of the second candidate coordinate point mentioned above, V achromatic2 This represents the brightness value of the second candidate coordinate point mentioned above.
[0161] The above k max2 It can be calculated using the following formula (16):
[0162]
[0163] Where (R3, G3, B3) represent the RGB parameters of the second candidate coordinate point mentioned above, V achromatic2 k represents the brightness value of the second candidate coordinate point mentioned above. max2 This represents the second adjustment factor.
[0164] This ensures that the calculated P max2 Located on the boundary of the RGB color space, subsequent steps are based on this P. 02 and Pmax2 Adjusting the RGB parameters of the target pixel ensures that the adjusted RGB parameters remain within the RGB color space, thus avoiding color distortion.
[0165] Then, the third candidate coordinate point is calculated based on the preset third color enhancement parameter, the second candidate coordinate point, the RGB parameters of the third endpoint and the fourth endpoint.
[0166] The preset third color enhancement parameter can be the preset second saturation enhancement parameter, which can also be used to enhance the saturation of pixels. It can also be any value between 1 and 5, such as 2.
[0167] For example, the RGB parameters of the third candidate coordinate point can be calculated according to the following formula (17):
[0168]
[0169] Among them, P h3 Represents the RGB parameters of the third candidate coordinate point; γ foliage This indicates the preset second saturation enhancement parameter; P 02 Represents the RGB parameters of the third endpoint; P max2 Indicates the RGB parameters of the fourth endpoint; L 20 Representing vectors The norm, for example, can represent a vector. The second norm, that is, P 02 and P max2 The distance between two coordinate points; L2 represents a vector. The norm, for example, can represent a vector. The second norm, that is, P 01 and P h2 The distance P between two coordinate points h2 This represents the RGB parameters corresponding to the second candidate coordinate point.
[0170] Finally, the RGB parameters of the third candidate coordinate point are used as the RGB parameters of the target pixel.
[0171] In this way, when the memory color type of the target pixel is greenery, targeted parameter adjustments can be made for greenery scenes. By defining the boundary on the isotone plane based on the endpoints, the problem of saturation overflow can be avoided, making the colors of the image more vivid and realistic.
[0172] Figure 5 This is a block diagram illustrating an image processing apparatus 500 according to an exemplary embodiment, such as... Figure 5 As shown, the device 500 may include:
[0173] The target pixel acquisition module 501 is configured to acquire target pixels in the image to be processed;
[0174] The RGB parameter acquisition module 502 is configured to acquire the RGB parameters of the target pixel in the RGB color space;
[0175] The coordinate point acquisition module 503 is configured to determine multiple first coordinate points in the RGB color space based on the RGB parameters of the target pixel, wherein the hue of the first coordinate points is equal to the hue of the target pixel.
[0176] The RGB parameter adjustment module 504 is configured to adjust the RGB parameters of the target pixel based on the RGB parameters of the first coordinate point in order to enhance the image to be processed.
[0177] Optionally, the RGB parameter adjustment module 504 is configured to determine a plurality of second coordinate points from the plurality of first coordinate points, wherein the first color parameter of the second coordinate point is the same as that of the target pixel, and the first color parameter includes any one of brightness, chroma and saturation; and adjust the RGB parameters of the target pixel according to the RGB parameters of the plurality of second coordinate points.
[0178] Optionally, the RGB parameter adjustment module 504 is configured to calculate a first candidate coordinate point based on a preset first color enhancement parameter and the RGB parameters of the plurality of second coordinate points, wherein the preset first color enhancement parameter is used to enhance other color parameters in brightness, chroma, and saturation that are different from the first color parameter; and to adjust the RGB parameters of the target pixel based on the RGB parameters of the first candidate coordinate point.
[0179] Optionally, the RGB parameter adjustment module 504 is configured to use the RGB parameters of the first candidate coordinate point as the RGB parameters of the target pixel.
[0180] Optionally, the RGB parameter adjustment module 504 is configured to calculate a second candidate coordinate point based on a preset second color enhancement parameter and the RGB parameters of the plurality of second coordinate points, wherein the preset second color enhancement parameter is used to enhance other color parameters in brightness, chroma, and saturation that are different from the first color parameter; determine a plurality of third coordinate points from the plurality of first coordinate points based on the second candidate coordinate points, wherein the second color parameter of the third coordinate points is the same as that of the second candidate coordinate points, and the second color parameter is the color parameter that the second color enhancement parameter is used to enhance; and adjust the RGB parameters of the target pixel based on the RGB parameters of the plurality of third coordinate points.
[0181] Optionally, the RGB parameter adjustment module 504 is configured to calculate a third candidate coordinate point based on a preset third color enhancement parameter and the RGB parameters of the plurality of third coordinate points. The preset third color enhancement parameter is used to enhance the other color parameters in brightness, chroma, and saturation besides the first and second color parameters. The RGB parameters of the third candidate coordinate point are used as the RGB parameters of the target pixel.
[0182] Optionally, the color of the target pixel is a memory color.
[0183] Regarding the apparatus in the above embodiments, the specific manner in which each module performs its operation has been described in detail in the embodiments related to the method, and will not be elaborated upon here.
[0184] In summary, this disclosure enhances the image by acquiring a target pixel in the image to be processed and obtaining its RGB parameters in the RGB color space; determining multiple first coordinate points in the RGB color space based on these RGB parameters, wherein the hue of each first coordinate point is equal to the hue of the target pixel; and adjusting the RGB parameters of the target pixel based on the RGB parameters of these first coordinate points. Thus, color adjustment of the target pixel is achieved based on the RGB color space without requiring color space changes, avoiding distortion caused by hue alterations and improving image processing efficiency.
[0185] This disclosure also provides a computer-readable storage medium having stored thereon computer program instructions that, when executed by a processor, implement the steps of any of the image processing methods provided above.
[0186] Figure 6 This is a block diagram illustrating an electronic device 600 according to an exemplary embodiment. For example, electronic device 600 may be a mobile phone, computer, digital broadcasting terminal, messaging device, game console, tablet device, medical device, fitness equipment, personal digital assistant, router, etc.
[0187] Reference Figure 6 The electronic device 600 may include one or more of the following components: a processing component 602, a memory 604, a power component 606, a multimedia component 608, an audio component 610, an input / output (I / O) interface 612, a sensor component 614, and a communication component 616.
[0188] Processing component 602 typically controls the overall operation of electronic device 600, such as operations associated with display, telephone calls, data communication, camera operation, and recording. Processing component 602 may include one or more processors 620 to execute instructions to complete all or part of the steps of the image processing method described above. Furthermore, processing component 602 may include one or more modules to facilitate interaction between processing component 602 and other components. For example, processing component 602 may include a multimedia module to facilitate interaction between multimedia component 608 and processing component 602.
[0189] Memory 604 is configured to store various types of data to support the operation of electronic device 600. Examples of this data include instructions for any application or method operating on electronic device 600, contact data, phonebook data, messages, pictures, videos, etc. Memory 604 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk.
[0190] Power component 606 provides power to various components of electronic device 600. Power component 606 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to electronic device 600.
[0191] Multimedia component 608 includes a screen that provides an output interface between the electronic device 600 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touchscreen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touches, swipes, and gestures on the touch panel. The touch sensors may sense not only the boundaries of the touch or swipe action but also the duration and pressure associated with the touch or swipe operation. In some embodiments, multimedia component 608 includes a front-facing camera and / or a rear-facing camera. When the electronic device 600 is in an operating mode, such as a shooting mode or a video mode, the front-facing camera and / or the rear-facing camera may receive external multimedia data. Each front-facing camera and rear-facing camera may be a fixed optical lens system or have focal length and optical zoom capabilities.
[0192] Audio component 610 is configured to output and / or input audio signals. For example, audio component 610 includes a microphone (MIC) configured to receive external audio signals when electronic device 600 is in an operating mode, such as call mode, recording mode, and voice recognition mode. The received audio signals may be further stored in memory 604 or transmitted via communication component 616. In some embodiments, audio component 610 also includes a speaker for outputting audio signals.
[0193] I / O interface 612 provides an interface between processing component 602 and peripheral interface modules, such as keyboards, click wheels, buttons, etc. These buttons may include, but are not limited to, home buttons, volume buttons, power buttons, and lock buttons.
[0194] Sensor assembly 614 includes one or more sensors for providing state assessments of various aspects of electronic device 600. For example, sensor assembly 614 can detect the on / off state of electronic device 600, the relative positioning of components such as the display and keypad of electronic device 600, changes in position of electronic device 600 or a component of electronic device 600, the presence or absence of user contact with electronic device 600, orientation or acceleration / deceleration of electronic device 600, and temperature changes of electronic device 600. Sensor assembly 614 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. Sensor assembly 614 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, sensor assembly 614 may also include an accelerometer, gyroscope, magnetometer, pressure sensor, or temperature sensor.
[0195] Communication component 616 is configured to facilitate wired or wireless communication between electronic device 600 and other devices. Electronic device 600 can access wireless networks based on communication standards, such as Wi-Fi, 2G, 3G, 4G, 5G, NB-IoT, eMTC, or other 6G networks, or combinations thereof. In one exemplary embodiment, communication component 616 receives broadcast signals or broadcast-related information from an external broadcast management system via a broadcast channel. In one exemplary embodiment, communication component 616 also includes a near-field communication (NFC) module to facilitate short-range communication. For example, the NFC module may be implemented based on radio frequency identification (RFID) technology, Infrared Data Association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology, and other technologies.
[0196] In an exemplary embodiment, the electronic device 600 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field-programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to perform the image processing method described above.
[0197] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 604 including instructions, which can be executed by a processor 620 of an electronic device 600 to complete the image processing method described above. For example, the non-transitory computer-readable storage medium may be a ROM, random access memory (RAM), CD-ROM, magnetic tape, floppy disk, and optical data storage device, etc.
[0198] In another exemplary embodiment, a computer program product is also provided, which includes a computer program executable by a programmable device, the computer program having a code portion for performing the above-described image processing method when executed by the programmable device.
[0199] Other embodiments of this disclosure will readily occur to those skilled in the art upon consideration of the specification and practice of this disclosure. This application is intended to cover any variations, uses, or adaptations of this disclosure that follow the general principles of this disclosure and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this disclosure are indicated by the following claims.
[0200] It should be understood that this disclosure is not limited to the precise structures described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this disclosure is limited only by the appended claims.
Claims
1. An image processing method, characterized in that, The method includes: Obtain the target pixels in the image to be processed; Obtain the RGB parameters of the target pixel in the RGB color space; Based on the RGB parameters of the target pixel, a plurality of first coordinate points in the RGB color space are determined, wherein the hue of the first coordinate points is equal to the hue of the target pixel; The RGB parameters of the target pixel are adjusted according to a preset first color enhancement parameter and the RGB parameters of multiple second coordinate points to enhance the image to be processed. The multiple second coordinate points are determined based on the multiple first coordinate points. The first color parameter of the second coordinate points is the same as that of the target pixel. The first color parameter includes any one of brightness, chroma, and saturation. The preset first color enhancement parameter is used to enhance other color parameters among brightness, chroma, and saturation that are different from the first color parameter.
2. The method according to claim 1, characterized in that, The step of adjusting the RGB parameters of the target pixel based on a preset first color enhancement parameter and the RGB parameters of multiple second coordinate points to enhance the image to be processed includes: The first candidate coordinate point is calculated based on the preset first color enhancement parameter and the RGB parameters of the plurality of second coordinate points; The RGB parameters of the target pixel are adjusted based on the RGB parameters of the first candidate coordinate point.
3. The method according to claim 2, characterized in that, The step of adjusting the RGB parameters of the target pixel based on the RGB parameters of the first candidate coordinate point includes: The RGB parameters of the first candidate coordinate point are used as the RGB parameters of the target pixel.
4. The method according to claim 1, characterized in that, The method further includes: The second candidate coordinate point is calculated based on the preset second color enhancement parameter and the RGB parameters of the plurality of second coordinate points. The preset second color enhancement parameter is used to enhance other color parameters among the brightness, chroma and saturation that are different from the first color parameter. Based on the second candidate coordinate point, a plurality of third coordinate points are determined from the plurality of first coordinate points. The second color parameter of the third coordinate point is the same as that of the second candidate coordinate point. The second color parameter is the color parameter used by the second color enhancement parameter for enhancement. The RGB parameters of the target pixel are adjusted based on the RGB parameters of the plurality of third coordinate points.
5. The method according to claim 4, characterized in that, Adjusting the RGB parameters of the target pixel based on the RGB parameters of the plurality of third coordinate points includes: Based on the preset third color enhancement parameter and the RGB parameters of the plurality of third coordinate points, a third candidate coordinate point is calculated. The preset third color enhancement parameter is used to enhance the other color parameters in brightness, chroma and saturation besides the first color parameter and the second color parameter. The RGB parameters of the third candidate coordinate point are used as the RGB parameters of the target pixel.
6. The method according to any one of claims 1 to 5, characterized in that, The color of the target pixel is a memory color.
7. An image processing apparatus, characterized in that, The device includes: The target pixel acquisition module is configured to acquire target pixels in the image to be processed; The RGB parameter acquisition module is configured to acquire the RGB parameters of the target pixel in the RGB color space; The coordinate point acquisition module is configured to determine multiple first coordinate points in the RGB color space based on the RGB parameters of the target pixel, wherein the hue of the first coordinate points is equal to the hue of the target pixel; The RGB parameter adjustment module is configured to adjust the RGB parameters of the target pixel based on a preset first color enhancement parameter and the RGB parameters of multiple second coordinate points to enhance the image to be processed. The multiple second coordinate points are determined based on the multiple first coordinate points. The first color parameter of the second coordinate points is the same as that of the target pixel. The first color parameter includes any one of brightness, chroma, and saturation. The preset first color enhancement parameter is used to enhance other color parameters among brightness, chroma, and saturation that are different from the first color parameter.
8. An electronic device, characterized in that, include: A memory on which computer programs are stored; A processor for executing the computer program in the memory to implement the steps of the method according to any one of claims 1 to 6.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When executed by the processing device, the program implements the steps of the method according to any one of claims 1 to 6.