Image processing method and device, computer device and computer readable storage medium

By calculating and adjusting the differences in image brightness, the problems of jagged edges and blurring in the image after hue shift were solved, thus improving the image processing effect.

CN117635503BActive Publication Date: 2026-11-24NETEASE (HANGZHOU) NETWORK CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202311665782.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-12-06
Publication Date
2026-11-24
Estimated Expiration
2043-12-06

AI Technical Summary

Technical Problem

Existing image processing tools produce jagged edges and blurry marks at the edges of images after hue shifting, affecting the image's performance.

Method used

By calculating the brightness difference between the initial image and the hue-shifted image, the brightness of the hue-shifted image is adjusted to correct edge jaggedness and blurriness. Image processing is optimized using gamma correction formulas and edge detection algorithms.

Benefits of technology

It improves the image quality after hue shift processing, clarifies edge areas, and restores the image's brightness consistency and contrast.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117635503B_ABST
    Figure CN117635503B_ABST
Patent Text Reader

Abstract

The application provides an image processing method, device, computer equipment and computer readable storage medium, the method comprises: obtaining an initial image; by image processing tool, the initial image is handled by hue offset, and the initial hue offset image is obtained; the first brightness of the initial image is calculated, and the second brightness of the initial hue offset image is calculated; according to the first brightness and the second brightness, the initial hue offset image is adjusted, and the target hue offset image is obtained.The image processing method provided in the embodiment of the application adjusts the initial hue offset image based on the brightness corresponding to the initial image and the brightness corresponding to the initial hue offset image obtained by processing the related image processing tool, can further correct the edge sawtooth or the blur mark appearing in the gradual change area of some hue slow change in the image due to the hue offset, and further improves the image effect of the final obtained hue offset.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of image processing technology, specifically to an image processing method, apparatus, computer device, and computer-readable storage medium. Background Technology

[0002] Hue shift refers to the overall shifting of the hue (also known as tone) of a color to adjust the overall appearance of an image. It is commonly used in image processing projects, such as photography, gaming, and film, to enrich the visual effects of images. With technological advancements, more and more image processing tools, such as game engines and other software programs with image editing capabilities, provide users with corresponding modules to perform hue shifting.

[0003] However, in practical engineering applications, it has been found that after existing image processing tools perform hue shift processing on images, the resulting images will have some incorrect jagged edges at the edges of some color circles. The light relationship at these color circle edges is also disrupted, resulting in some edge areas in the image showing blurry traces similar to those after image compression, thus affecting the hue shift effect of the final image. Summary of the Invention

[0004] Therefore, it is necessary to provide an image processing method, apparatus, computer device, and computer-readable storage medium to address the aforementioned technical problems, thereby resolving the issue that the image edge effect is destroyed after hue shifting of an image using relevant image processing tools, thus affecting the final image performance.

[0005] In a first aspect, this application provides an image processing method, comprising:

[0006] Obtain the initial image to be processed;

[0007] The initial image is subjected to hue shift processing using a preset image processing tool to obtain an initial hue shift image;

[0008] Calculate the first brightness corresponding to the initial image and the second brightness corresponding to the initial hue-shifted image;

[0009] The initial hue-shifted image is adjusted based on the first brightness and the second brightness to obtain the target hue-shifted image.

[0010] Secondly, this application provides an image processing apparatus, comprising:

[0011] The acquisition module is used to acquire the initial image to be processed;

[0012] The processing module is used to perform hue shift processing on the initial image using a preset image processing tool to obtain an initial hue shift image;

[0013] The calculation module is used to calculate the first brightness corresponding to the initial image and the second brightness corresponding to the initial hue-shifted image;

[0014] The adjustment module is used to adjust the initial hue-shifted image according to the first brightness and the second brightness to obtain the target hue-shifted image.

[0015] Thirdly, this application also provides a computer device, the computer device comprising:

[0016] One or more processors;

[0017] Memory; and

[0018] One or more applications, wherein the one or more applications are stored in the memory and configured to be executed by the processor to implement the image processing method provided above.

[0019] Fourthly, this application also provides a computer-readable storage medium having a computer program stored thereon, the computer program being loaded by a processor to perform the image processing method provided above.

[0020] Fifthly, embodiments of this application provide a computer program product or computer program that includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the image processing method described above.

[0021] The image processing method provided in this application, after acquiring an initial image and using an image processing tool to perform hue shift on the initial image to obtain an initial hue-shifted image, further adjusts the initial hue-shifted image based on the brightness corresponding to the initial image and the brightness corresponding to the initial hue-shifted image. This can further correct edge jaggedness or blurry traces that appear in some gradient areas where the hue changes slowly in the image due to hue shift, thereby further improving the final hue-shifted image effect. Attached Figure Description

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

[0023] Figure 1a A schematic diagram of the effect of an original image provided for an embodiment of this application;

[0024] Figure 1b A schematic diagram of the effect of an image obtained by performing hue shift processing on the original image using an image processing tool, provided as an embodiment of this application;

[0025] Figure 2a This is a schematic flowchart of the steps of an image processing method provided in an embodiment of this application;

[0026] Figure 2b This is a schematic diagram of the effect of another original image provided in an embodiment of this application;

[0027] Figure 2c A schematic diagram of the effect of an initial hue-shifted image obtained by performing hue-shifting processing on the original image using an image processing tool, provided as an embodiment of this application;

[0028] Figure 2d A schematic diagram illustrating the effect of a target hue shift image obtained by the image processing method provided in this application, as provided in an embodiment of this application.

[0029] Figure 3 This application provides a schematic flowchart of a step for adjusting an initial hue-shifted image based on brightness, as shown in the embodiments of this application.

[0030] Figure 4 This application provides a flowchart illustrating the steps for adjusting pixel values ​​based on an offset coefficient to obtain a target hue-shifted image.

[0031] Figure 5 This is a flowchart illustrating the steps of another image processing method provided in an embodiment of this application.

[0032] Figure 6 This application provides a schematic flowchart illustrating the steps for calculating image brightness based on pixels within an edge region.

[0033] Figure 7 This is a schematic diagram of the structure of an image processing apparatus provided in an embodiment of this application;

[0034] Figure 8This is a schematic diagram of the structure of a computer device provided in an embodiment of this application. Detailed Implementation

[0035] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0036] In the description of this application, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the stated features. In the description of this application, "multiple" means two or more, unless otherwise explicitly specified.

[0037] In the description of this application, the word "for example" is used to mean "used as an example, illustration, or description." Any embodiment described as "for example" in this application is not necessarily to be construed as being more preferred or advantageous than other embodiments. The following description is provided to enable any person skilled in the art to make and use the invention. Details are set forth in the following description for purposes of explanation. It should be understood that those skilled in the art will recognize that the invention can be made without using these specific details. In other instances, well-known structures and processes will not be described in detail to avoid obscuring the description of the invention with unnecessary detail. Therefore, the invention is not intended to be limited to the embodiments shown, but is consistent with the broadest scope of the principles and features disclosed in this application.

[0038] To facilitate understanding of the image processing method provided in this application embodiment, the application scenarios of the image processing method are first described. The image processing method provided in this application embodiment is mainly applied to image processing projects such as photography, games, and film and television industries. In these industries, there are often some professional image processing tools or software programs with image processing functions, such as game engines (such as Unreal Engine and Unity Engine) in the game industry, and PS (Photoshop, an image processing software) in the photography industry. Users can directly use the hue shift function module in the image processing tool to process the image resources that need to be processed, thereby achieving the purpose of adjusting and enriching the image expression effect.

[0039] Specifically, hue shift mainly refers to the overall shift of the hue (also known as tone) of an image. Therefore, in conventional image processing tools, images in the RGB (Red-Green-Blue, a color model that describes the color values ​​of each pixel in an image using three primary colors) color space are converted to the HSL (Hue-Saturation-Lightness, a way of representing points in the RGB color model in a cylindrical coordinate system) color space for processing. Since hue is represented by an angle value between 0° and 360° in the HSL color space, hue shift can be simply understood as a rotation of the corresponding angle of the hue. Therefore, in the process of hue shift, image processing tools usually use a rotation formula around an axis. For example, the Rodriguez rotation formula is commonly used to achieve the rotation of the corresponding angle of the hue, thereby achieving the hue shift processing. After completion, the image in the HSL color space is further converted back to the original RGB color space to obtain the hue-shifted image.

[0040] However, in practical applications, it has been found that after performing hue shift processing on images using relevant image processing tools, such as the Hue Shift function node in Unreal Engine (UE defalt HueShift) or Photoshop, incorrect jagged edges may appear at some color circle edges in the image. The light relationship at the color circle edges is also disrupted, resulting in some edge areas of the image showing blurry traces similar to those after image compression, thus affecting the final hue shift effect of the image. To facilitate understanding of the above, specifically, as... Figure 1a As shown, Figure 1a This is a schematic diagram of an original image provided for an embodiment of this application. Figure 1b This is a schematic diagram of the processed image obtained after applying a color shift to the original image using Photoshop. It can be seen that, corresponding to... Figure 1a Area 101 and Figure 1b In region 103, at the edge of the color circle, the image after hue shift shows relatively more noticeable jagged edges at the edge of the color circle, or, corresponding to... Figure 1a Area 102 and Figure 1b In region 104, the relationship between the robot's edge light is disrupted, resulting in abnormal colors appearing at the edges. Figure 1a and Figure 1b (It has already been processed to grayscale, which will be more noticeable in the original color image).

[0041] By analyzing the aforementioned image processing engineering problems, it was determined that in the conventional hue shift process, the neglect of image brightness changes leads to jagged blurring artifacts in some gradient areas due to the slow hue changes. Therefore, to solve the problems actually existing in image processing engineering, this application provides an image processing method, apparatus, computer device, and computer-readable storage medium. This method further utilizes the difference between the brightness of the hue-shifted image and the brightness of the initial image to correct the brightness of the hue-shifted image, ensuring that the brightness of the final hue-shifted image is the same as the original image. This repairs the jagged blurring artifacts caused by the slow hue changes in gradient areas, improving the performance of the final hue-shifted image in the image processing engineering. The image processing method is typically installed as a computer program in an image processing device, which is typically a processor located on a computer device (e.g., a local device with a client or a remote server device). The image processing device in the computer device executes the computer program corresponding to the image processing method, thereby executing the image processing method provided in the embodiments of this application. Specifically, as... Figure 2a As shown, Figure 2a This is a flowchart illustrating the steps of an image processing method provided in an embodiment of this application, including steps S210 to S240:

[0042] S210, Obtain the initial image to be processed.

[0043] In this embodiment of the application, as can be seen from the relevant description of the aforementioned application scenarios, the initial image refers to the image resource that needs to undergo hue shift processing in the photography, gaming, and film and television industries. For example, common examples include game scene images, special effects scene images, etc. This embodiment of the application does not limit the type of initial image.

[0044] S220, the initial image is subjected to hue shift processing using a preset image processing tool to obtain an initial hue shift image.

[0045] In this embodiment, based on the aforementioned determination of the initial image, the image processing device further performs hue shift processing on the initial image through the corresponding program functions of the image tool. For example, it can perform hue shift processing on the initial image by calling the API (Application Programming Interface) of a preset image processing tool, thereby obtaining an initial hue-shifted image. It should be noted that the image processing tool here typically performs hue shift processing on the initial image based on angular rotation to obtain the initial hue-shifted image. For example, as mentioned above, it typically involves converting the RGB image to the HSL color space, then using a certain angular rotation formula to rotate the angular values ​​corresponding to the colors in the original image to obtain a new hue, and then converting it back to the RGB color space to obtain the initial hue-shifted image. Commonly, image processing tools can be game engines, such as Unreal Engine, or Photoshop, etc. This embodiment does not limit the type of image processing tool. Any software program that uses the above working principle to perform hue shift processing on the initial image can be considered within the scope of the image processing tool claimed in this application. In this case, combined with the foregoing... Figure 1a and Figure 1b The provided image effect diagram shows that, compared to the original image, the initial hue-shifted image after hue shift may exhibit jagged edges or other blurry marks similar to those seen in compressed images in some edge areas, thus affecting the image's performance.

[0046] S230, calculate the first brightness corresponding to the initial image and the second brightness corresponding to the initial hue-shifted image.

[0047] In order to address potential defects in the initial hue-shifted image, in this embodiment, the image processing device further calculates the first brightness corresponding to each pixel in the initial image and the second brightness corresponding to each pixel in the initial hue-shifted image. This allows for subsequent correction of the brightness of the initial hue-shifted image based on the brightness difference between the two images, thereby repairing jagged edges and other blurry marks similar to those after image compression that appear in the edge region of the initial hue-shifted image.

[0048] Specifically, in the embodiments of this application, the brightness of an image roughly reflects the lightness and darkness of each object in the image. It is typically calculated based on the three color channel values ​​(R, G, and B values) corresponding to each pixel in the RGB color space. For example, considering that the human eye has different sensitivities to different chromaticities of light—being more sensitive to cool-colored light (high-frequency light, blue-violet light) and less sensitive to warm-colored light (low-frequency light)—brightness is generally calculated by weighting the three color channel values ​​according to a certain proportional coefficient. For example, as one of the most common feasible implementations, the specific formula for calculating brightness is roughly as follows:

[0049] L = 0.30R + 0.59G + 0.11B.

[0050] By calculating the brightness of the image using the above formula and then adjusting the initial hue-shifted image, the target hue-shifted image after brightness restoration can be obtained, thus ensuring the performance of the final target hue-shifted image to a certain extent.

[0051] However, the aforementioned calculation of image brightness typically only relates to the user's visual viewing experience. In reality, considering that images are usually displayed on computer devices via display terminals such as monitors or screens, and that these terminals generally control the brightness of the displayed image by adjusting power, and that the human eye's perception of brightness is not directly proportional to power but rather a power function, to compensate for brightness variations caused by screen display, another feasible embodiment of this application provides a different scheme for calculating the brightness of each pixel in an image using a preset gamma correction formula. Specifically, this involves inputting the three color channel values ​​corresponding to each pixel in the initial image into the gamma correction formula to obtain the first brightness of the initial image, and inputting the three color channel values ​​corresponding to each pixel in the initial hue-shifted image into the gamma correction formula to obtain the second brightness of the initial hue-shifted image. The specific form of the gamma correction formula is as follows:

[0052]

[0053] Where L is the final calculated brightness, γ is the gamma correction parameter related to the display, typically ranging from 1.8 to 2.6; as a feasible implementation, γ can be set to 2.2, and k is a coefficient related to γ. When γ is 2.2, k is approximately equal to 0.547373, and R, G, and B are the red, green, and blue color channel values, respectively. The image brightness is calculated using the above formula. Compared to the previously provided method of weighting the three color channel values ​​according to a certain proportional coefficient, this method can further improve the final performance of the target hue-shifted image during subsequent user correction of the initial hue-shifted image.

[0054] Furthermore, considering that in practical applications, blurry marks such as jagged edges in the initial hue-shifted image, similar to those seen after image compression, typically appear in the edge regions of the image, i.e., the gradient regions where colors gradually change, as a feasible embodiment of this application, in the further processing of the initial hue-shifted image, it is possible to first determine whether there are any blurry marks requiring adjustment within the edge regions based on edge detection of the initial hue-shifted image. Only after certain conditions are met will the subsequent scheme of adjusting the initial hue-shifted image based on brightness be executed. Specific implementation schemes can be found in the following sections. Figure 5 And its explanations and descriptions.

[0055] S240, the initial hue-shifted image is adjusted according to the first brightness and the second brightness to obtain the target hue-shifted image.

[0056] In this embodiment of the application, after obtaining the first brightness and the second brightness, the difference between the brightness is used to adjust the brightness of each pixel in the initial hue-shifted image so as to restore the brightness of each pixel in the initial hue-shifted image to be the same as that of the initial image, and thus the final target hue-shifted image can be obtained.

[0057] Specifically, such as Figure 3 As shown, Figure 3 This application provides a flowchart illustrating steps for adjusting an initial hue-shifted image based on brightness, specifically including steps S310 to S320:

[0058] S310, for each pixel of the initial hue-shifted image, the offset coefficient corresponding to the pixel is calculated based on the ratio between the second brightness of the pixel and the first brightness of the corresponding pixel in the initial image.

[0059] In this embodiment of the application, for each pixel in the initial hue-shifted image, the second brightness L2 corresponding to the pixel in the initial hue-shifted image can be calculated by processing the three-channel pixel value R2G2B2 of the pixel based on the brightness calculation formula mentioned in step S210. Correspondingly, the first brightness L1 of the corresponding pixel in the initial image can be calculated by processing the three-channel pixel value R1G1B1 of the corresponding pixel in the initial image using the brightness calculation formula. On this basis, the offset coefficient S = L1 / L2 corresponding to the pixel can be further calculated.

[0060] S320, adjust the pixel values ​​of corresponding pixels in the initial hue-shifted image according to the offset coefficients of each pixel to obtain the target hue-shifted image.

[0061] In this embodiment of the application, after obtaining the offset coefficient corresponding to each pixel using the aforementioned brightness calculation, the pixel value of the corresponding pixel in the initial hue offset image can be adjusted by using the offset coefficient corresponding to each pixel, so as to obtain the final target hue offset image.

[0062] Specifically, considering that the initial hue-shifted image is usually in the RGB color space, the pixel values ​​of the corresponding pixels in the initial hue-shifted image are adjusted according to the offset coefficients of each pixel. This usually refers to adjusting the three color channel values ​​of the corresponding pixels in the image. For specific implementation details, please refer to the subsequent sections. Figure 4 And its explanations and descriptions.

[0063] like Figure 4 As shown, Figure 4 This application provides a flowchart illustrating a process for adjusting pixel values ​​based on an offset coefficient to obtain a target hue-shifted image. Specifically, it includes steps S410 to S420:

[0064] S410, adjust the three color channel values ​​of the corresponding pixels in the initial hue offset image according to the offset coefficients corresponding to each pixel, and obtain the adjusted three color channel values ​​of each pixel.

[0065] In this embodiment of the application, if the three color channel values ​​of a pixel in the initial hue offset image are R2G2B2 respectively, then the final calculated adjusted three color channel values ​​are R2*S, G2*S and B2*S, where S=L1 / L2 is the offset coefficient corresponding to the pixel.

[0066] S420 generates a target hue-shifted image based on the adjusted three color channel values ​​corresponding to each pixel.

[0067] In this embodiment of the application, based on the aforementioned determination of the adjusted three color channel values ​​corresponding to each pixel, the target hue shift image in the RGB color space can be finally obtained.

[0068] Specifically, to facilitate understanding of the differences between the final target hue-shifted image and the initial hue-shifted image, as well as the initial image, in the embodiments of this application, specifically, as follows: Figure 2b , Figure 2c as well as Figure 2d The diagrams shown illustrate the effects of the initial image, the initial hue-shifted image obtained through image processing tools, and the target hue-shifted image obtained through the image processing method provided in this application. Specifically, corresponding to... Figure 2b Area 201 in Figure 2c area 204 and Figure 2d In region 207, it can be seen that... Figure 2c In the initial hue shift image shown, there is a clear anomaly in this region (i.e., region 204) where lines appear blurred due to color gradation. Figure 2d In the target hue-shifted image shown, because the image's brightness has been restored to the same level as the original image, the abnormal blurring of lines has been reduced accordingly, and the lines in area 207 are relatively clear, corresponding to... Figure 2b Area 202 in Figure 2c Area 205 and Figure 2d In region 208, it can be seen that... Figure 2c In the initial hue shift image shown, there is a clear phenomenon of bright areas disappearing (i.e., reduced contrast) in this region (i.e., region 205), while... Figure 2d In the target hue-shifted image shown, the contrast recovery in this region (i.e., region 208) corresponds to... Figure 2b Area 203 in Figure 2c Area 206 in and Figure 2d In region 209, it can be seen that... Figure 2c In the initial hue shift image shown, there is an abnormal brightness (i.e., a significant increase in contrast) in this region (i.e., region 206). Similarly, in Figure 2d In the target hue shift image shown, the contrast in this region (i.e., region 209) is also restored to its original state.

[0069] The image processing method provided in this application, after acquiring an initial image and using an image processing tool to perform hue shift on the initial image to obtain an initial hue-shifted image, further adjusts the initial hue-shifted image based on the brightness corresponding to the initial image and the brightness corresponding to the initial hue-shifted image. This can further correct edge jaggedness or blurry traces that appear in some gradient areas where the hue changes slowly in the image due to hue shift, thereby further improving the final hue-shifted image effect.

[0070] Furthermore, as described above, considering that jagged edges and other blurry marks similar to those found in compressed images typically appear in the edge regions of the initial hue-shifted image, in a feasible embodiment of this application, during further processing of the initial hue-shifted image, edge detection can be performed to determine whether any blurry marks requiring adjustment exist within the edge regions, thereby determining whether a subsequent luminance-based adjustment of the initial hue-shifted image is necessary. Specifically, as... Figure 5 As shown, Figure 5 A flowchart illustrating another image processing method provided in this application embodiment includes steps S510 to S530:

[0071] S510, perform edge detection on the initial hue-shifted image to obtain the edge regions in the initial hue-shifted image.

[0072] In this embodiment of the application, edge detection of the initial hue shift image can be based on edge detection algorithms, such as the Laplacian operator, the Canny edge detection operator, etc., which will not be elaborated here. By performing edge detection on the initial hue shift image, the edge regions in the initial hue shift image where the color has a gradient can be determined.

[0073] S520, Extract the pixel change features of the pixels in the edge region.

[0074] In this embodiment, after edge detection of the initial hue-shifted image and extraction of edge regions, the image processing device further extracts corresponding pixel change features based on pixel change information of pixels in the edge regions. Specifically, pixel change features can reflect, to some extent, whether there are abnormal jagged edges or other blurry traces in the edge region.

[0075] S530, if the pixel change feature meets the preset condition, then calculate the first brightness corresponding to the initial image and the second brightness corresponding to the initial hue shift image.

[0076] In this embodiment, as described above, if the pixel change features meet preset conditions—for example, if abnormal jagged edges or other blurry marks are identified in the edge region based on the pixel change features—then the pixel change features are considered to meet the preset conditions. This indicates that the hue shift effect of the currently obtained initial hue shift image is abnormal, and a subsequent step of repairing the initial hue shift image using brightness is required. Specifically, the first brightness corresponding to the initial image and the second brightness corresponding to the initial hue shift image need to be calculated first. Conversely, if abnormal jagged edges or other blurry marks are identified in the edge region based on the pixel change features, the pixel change features are considered not to meet the preset conditions. This indicates that the hue shift effect of the currently obtained initial hue shift image is normal. Therefore, the initial hue shift image obtained by processing the initial image using an image processing tool can be output as the final target hue shift image. Of course, the specific implementation scheme for calculating the brightness corresponding to the image can be found in the aforementioned step S230, which will not be repeated here.

[0077] like Figure 6 As shown, Figure 6 This application provides a flowchart illustrating the steps for calculating image brightness based on pixels within an edge region, specifically including steps S610 to S620:

[0078] S610, calculate the first brightness of the initial image based on the pixels corresponding to the edge region in the initial image.

[0079] After extracting the edge region in the initial image through edge detection, since there is a relatively abnormal performance effect in this region, it is possible to calculate the first brightness of the initial image based on the pixels in the initial image that correspond to the edge region. Specifically, unlike the calculation of the first brightness in the aforementioned step S230, in this embodiment, the first brightness of the initial image is only calculated for the pixels in the edge region.

[0080] S620, calculate the second brightness corresponding to the initial hue-shifted image based on the pixel values ​​of the pixels in the edge region of the initial hue-shifted image.

[0081] In this embodiment of the application, similar to the aforementioned step S610, the second brightness corresponding to the initial hue shift image is calculated only for the pixels in the edge region of the initial hue shift image.

[0082] Of course, after calculating the brightness of the image based on the pixels in the edge region as described above, as another optional embodiment of this application, in the subsequent process of adjusting the initial hue-shifted image based on brightness, it is possible to consider adjusting the pixel values ​​of the corresponding pixels in the edge region of the initial hue-shifted image using brightness, thereby achieving targeted repair of abnormal performance effects in the initial hue-shifted image and improving image processing efficiency.

[0083] To better implement the image processing method provided in the embodiments of this application, based on the image processing method provided in the embodiments of this application, an image processing apparatus is also provided in the embodiments of this application, such as... Figure 7 As shown, the image processing apparatus 700 includes:

[0084] The acquisition module 710 is used to acquire the initial image to be processed;

[0085] Processing module 720 is used to perform hue shift processing on the initial image using a preset image processing tool to obtain an initial hue shift image;

[0086] The calculation module 730 is used to calculate the first brightness corresponding to the initial image and the second brightness corresponding to the initial hue-shifted image;

[0087] The adjustment module 740 is used to adjust the initial hue shift image according to the first brightness and the second brightness to obtain the target hue shift image.

[0088] In some embodiments of this application, the adjustment module 740 is used to calculate the offset coefficient corresponding to each pixel of the initial hue-shifted image based on the ratio between the second brightness of the pixel and the first brightness of the corresponding pixel in the initial image; and to adjust the pixel value of the corresponding pixel in the initial hue-shifted image according to the offset coefficient of each pixel to obtain the target hue-shifted image.

[0089] In some embodiments of this application, the adjustment module 740 is used to adjust the three color channel values ​​of corresponding pixels in the initial hue-shifted image according to the offset coefficients corresponding to each pixel, so as to obtain the adjusted three color channel values ​​of each pixel; and to generate a target hue-shifted image based on the adjusted three color channel values ​​of each pixel.

[0090] In some embodiments of this application, the calculation module 730 is used to input the three color channel values ​​corresponding to each pixel in the initial image into a preset gamma correction formula to calculate the first brightness corresponding to the initial image; and to input the three color channel values ​​corresponding to each pixel in the initial hue-shifted image into a preset gamma correction formula to calculate the second brightness corresponding to the initial hue-shifted image.

[0091] In some embodiments of this application, the calculation module 730 is used to perform edge detection on the initial hue-shifted image to obtain edge regions in the initial hue-shifted image; extract pixel change features of pixels in the edge regions; and if the pixel change features meet preset conditions, calculate the first brightness corresponding to the initial image and the second brightness corresponding to the initial hue-shifted image.

[0092] In some embodiments of this application, the calculation module 730 is used to calculate a first brightness of the initial image based on the pixels corresponding to the edge region in the initial image; and to calculate a second brightness of the initial hue-shifted image based on the pixel values ​​of the pixels in the edge region in the initial hue-shifted image.

[0093] In some embodiments of this application, the calculation module 730 is used to adjust the edge regions in the initial hue-shifted image according to the first brightness and the second brightness to obtain a target hue-shifted image.

[0094] For specific limitations regarding the image processing apparatus, please refer to the limitations on the image processing method above, which will not be repeated here. Each module in the aforementioned image processing apparatus can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in hardware or independently of the processor in the computer device, or stored in software in the memory of the computer device, so that the processor can call and execute the operations corresponding to each module.

[0095] In some embodiments of this application, the image processing apparatus 700 can be implemented as a computer program, which can be implemented in, for example... Figure 8 The image processing apparatus 700 runs on the computer device shown. The computer device's memory can store the various program modules that make up the image processing apparatus 700, for example, Figure 7 The diagram shows an acquisition module 710, a processing module 720, a calculation module 730, and an adjustment module 740. The computer program comprised of these modules causes the processor to execute the steps of the image processing methods described in the various embodiments of this application.

[0096] For example, Figure 8 The computer device shown can be used as follows Figure 7The image processing apparatus 700 shown executes step S210 via the acquisition module 710. The computer device can execute step S220 via the processing module 720. The computer device can execute step S230 via the calculation module 730. The computer device can execute step S240 via the adjustment module 740. The computer device includes a processor, memory, and a network interface connected via a system bus. The processor of the computer device provides computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores an operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage medium. The network interface of the computer device is used for communication with external computer devices via a network connection. When the computer program is executed by the processor, it implements an image processing method.

[0097] Those skilled in the art will understand that Figure 8 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0098] In some embodiments of this application, a computer device is provided, including one or more processors; memory; and one or more application programs, wherein the one or more application programs are stored in the memory and configured to be executed by the processor to perform the following steps:

[0099] Obtain the initial image to be processed;

[0100] The initial image is subjected to hue shift processing using a preset image processing tool to obtain an initial hue shift image;

[0101] Calculate the first brightness corresponding to the initial image and the second brightness corresponding to the initial hue-shifted image;

[0102] The initial hue-shifted image is adjusted based on the first brightness and the second brightness to obtain the target hue-shifted image.

[0103] In some embodiments of this application, when the processor executes the computer program, it further implements the following steps: for each pixel of the initial hue-shifted image, calculates the offset coefficient corresponding to the pixel based on the ratio between the second brightness corresponding to the pixel and the first brightness of the corresponding pixel in the initial image; adjusts the pixel value of the corresponding pixel in the initial hue-shifted image according to the offset coefficients corresponding to each pixel to obtain the target hue-shifted image.

[0104] In some embodiments of this application, when the processor executes the computer program, it further implements the following steps: adjusting the three color channel values ​​of corresponding pixels in the initial hue-shifted image according to the offset coefficients corresponding to each pixel, to obtain the adjusted three color channel values ​​corresponding to each pixel; and generating a target hue-shifted image based on the adjusted three color channel values ​​corresponding to each pixel.

[0105] In some embodiments of this application, when the processor executes the computer program, it further implements the following steps: inputting the three color channel values ​​corresponding to each pixel in the initial image into a preset gamma correction formula to calculate the first brightness corresponding to the initial image; inputting the three color channel values ​​corresponding to each pixel in the initial hue-shifted image into a preset gamma correction formula to calculate the second brightness corresponding to the initial hue-shifted image.

[0106] In some embodiments of this application, when the processor executes the computer program, it further implements the following steps: performing edge detection on the initial hue-shifted image to obtain edge regions in the initial hue-shifted image and extracting pixel change features of pixels in the edge regions; if the pixel change features meet preset conditions, calculating the first brightness corresponding to the initial image and the second brightness corresponding to the initial hue-shifted image.

[0107] In some embodiments of this application, when the processor executes the computer program, it further implements the following steps: calculating a first brightness corresponding to the initial image based on the pixels corresponding to the edge region in the initial image; and calculating a second brightness corresponding to the initial hue-shifted image based on the pixel values ​​of the pixels in the edge region in the initial hue-shifted image.

[0108] In some embodiments of this application, when the processor executes the computer program, it further implements the following steps: adjusting the edge regions in the initial hue-shifted image according to the first brightness and the second brightness to obtain a target hue-shifted image.

[0109] In some embodiments of this application, a computer-readable storage medium is provided, storing a computer program that is loaded by a processor, causing the processor to perform the following steps:

[0110] Obtain the initial image to be processed;

[0111] The initial image is subjected to hue shift processing using a preset image processing tool to obtain an initial hue shift image;

[0112] Calculate the first brightness corresponding to the initial image and the second brightness corresponding to the initial hue-shifted image;

[0113] The initial hue-shifted image is adjusted based on the first brightness and the second brightness to obtain the target hue-shifted image.

[0114] In some embodiments of this application, when the processor executes the computer program, it further implements the following steps: for each pixel of the initial hue-shifted image, calculates the offset coefficient corresponding to the pixel based on the ratio between the second brightness corresponding to the pixel and the first brightness of the corresponding pixel in the initial image; adjusts the pixel value of the corresponding pixel in the initial hue-shifted image according to the offset coefficients corresponding to each pixel to obtain the target hue-shifted image.

[0115] In some embodiments of this application, when the processor executes the computer program, it further implements the following steps: adjusting the three color channel values ​​of corresponding pixels in the initial hue-shifted image according to the offset coefficients corresponding to each pixel, to obtain the adjusted three color channel values ​​corresponding to each pixel; and generating a target hue-shifted image based on the adjusted three color channel values ​​corresponding to each pixel.

[0116] In some embodiments of this application, when the processor executes the computer program, it further implements the following steps: inputting the three color channel values ​​corresponding to each pixel in the initial image into a preset gamma correction formula to calculate the first brightness corresponding to the initial image; inputting the three color channel values ​​corresponding to each pixel in the initial hue-shifted image into a preset gamma correction formula to calculate the second brightness corresponding to the initial hue-shifted image.

[0117] In some embodiments of this application, when the processor executes the computer program, it further implements the following steps: performing edge detection on the initial hue-shifted image to obtain edge regions in the initial hue-shifted image and extracting pixel change features of pixels in the edge regions; if the pixel change features meet preset conditions, calculating the first brightness corresponding to the initial image and the second brightness corresponding to the initial hue-shifted image.

[0118] In some embodiments of this application, when the processor executes the computer program, it further implements the following steps: calculating a first brightness corresponding to the initial image based on the pixels corresponding to the edge region in the initial image; and calculating a second brightness corresponding to the initial hue-shifted image based on the pixel values ​​of the pixels in the edge region in the initial hue-shifted image.

[0119] In some embodiments of this application, when the processor executes the computer program, it further implements the following steps: adjusting the edge regions in the initial hue-shifted image according to the first brightness and the second brightness to obtain a target hue-shifted image.

[0120] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the methods described above. Any references to memory, storage, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, or optical storage, etc. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM), etc.

[0121] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0122] The foregoing has provided a detailed description of an image processing method, apparatus, computer device, and storage medium provided in the embodiments of this application. Specific examples have been used to illustrate the principles and implementation methods of the present invention. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of the present invention. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of the present invention. Therefore, the content of this specification should not be construed as a limitation of the present invention.

Claims

1. An image processing method, characterized in that, include: Obtain the initial image to be processed; The initial image is subjected to hue shift processing using a preset image processing tool to obtain an initial hue shift image; Calculate the first brightness corresponding to the initial image and the second brightness corresponding to the initial hue-shifted image; The initial hue-shifted image is adjusted based on the first brightness and the second brightness to obtain the target hue-shifted image; The step of adjusting the initial hue-shifted image based on the first brightness and the second brightness to obtain the target hue-shifted image includes: For each pixel in the initial hue-shifted image, the offset coefficient corresponding to the pixel is calculated based on the ratio between the second brightness of the pixel and the first brightness of the corresponding pixel in the initial image. The pixel values ​​of the corresponding pixels in the initial hue-shifted image are adjusted according to the offset coefficients of each pixel to obtain the target hue-shifted image; The step of adjusting the pixel values ​​of corresponding pixels in the initial hue-shifted image according to the offset coefficients corresponding to each pixel to obtain the target hue-shifted image includes: The three color channel values ​​of the corresponding pixels in the initial hue offset image are adjusted according to the offset coefficients of each pixel to obtain the adjusted three color channel values ​​of each pixel. A target hue-shifted image is generated based on the adjusted three color channel values ​​corresponding to each pixel.

2. The image processing method according to claim 1, characterized in that, The first brightness corresponding to the initial image is calculated by inputting the three color channel values ​​corresponding to each pixel in the initial image into a preset gamma correction formula, and / or, the second brightness corresponding to the initial hue-shifted image is calculated by inputting the three color channel values ​​corresponding to each pixel in the initial hue-shifted image into a preset gamma correction formula.

3. The image processing method according to claim 2, characterized in that, The formula for the gamma correction is as follows: in, To and Correlation coefficient For the gamma correction parameters related to the display, R is the red color channel value, G is the green color channel value, B is the blue color channel value, and L is the brightness.

4. The image processing method according to claim 1, characterized in that, Before the steps of calculating the first brightness corresponding to the initial image and the second brightness corresponding to the initial hue-shifted image, the method further includes: Edge detection is performed on the initial hue-shifted image to obtain the edge regions in the initial hue-shifted image; Extract the pixel change features of the pixels in the edge region; If the pixel change features meet the preset conditions, then the steps of calculating the first brightness corresponding to the initial image and the second brightness corresponding to the initial hue-shifted image are performed.

5. The image processing method according to claim 4, characterized in that, The calculation of the first brightness corresponding to the initial image and the second brightness corresponding to the initial hue-shifted image includes: Calculate the first brightness of the initial image based on the pixels corresponding to the edge region in the initial image; and The second brightness corresponding to the initial hue-shifted image is calculated based on the pixel values ​​of the pixels in the edge region of the initial hue-shifted image.

6. The image processing method according to claim 4, characterized in that, The step of adjusting the initial hue-shifted image based on the first brightness and the second brightness to obtain the target hue-shifted image includes: The edge regions in the initial hue-shifted image are adjusted based on the first brightness and the second brightness to obtain the target hue-shifted image.

7. The image processing method according to any one of claims 1 to 6, characterized in that, The image processing tool performs hue shift processing on the initial image based on angular rotation to obtain an initial hue-shifted image.

8. An image processing apparatus, characterized in that, include: The acquisition module is used to acquire the initial image to be processed; The processing module is used to perform hue shift processing on the initial image using a preset image processing tool to obtain an initial hue shift image; The calculation module is used to calculate the first brightness corresponding to the initial image and the second brightness corresponding to the initial hue-shifted image; An adjustment module is used to adjust the initial hue-shifted image according to the first brightness and the second brightness to obtain a target hue-shifted image; The step of adjusting the initial hue-shifted image based on the first brightness and the second brightness to obtain the target hue-shifted image includes: For each pixel in the initial hue-shifted image, the offset coefficient corresponding to the pixel is calculated based on the ratio between the second brightness of the pixel and the first brightness of the corresponding pixel in the initial image. The pixel values ​​of the corresponding pixels in the initial hue-shifted image are adjusted according to the offset coefficients of each pixel to obtain the target hue-shifted image; The step of adjusting the pixel values ​​of corresponding pixels in the initial hue-shifted image according to the offset coefficients corresponding to each pixel to obtain the target hue-shifted image includes: The three color channel values ​​of the corresponding pixels in the initial hue offset image are adjusted according to the offset coefficients of each pixel to obtain the adjusted three color channel values ​​of each pixel. A target hue-shifted image is generated based on the adjusted three color channel values ​​corresponding to each pixel.

9. A computer device, characterized in that, The computer device includes: One or more processors; Memory; and One or more applications, wherein the one or more applications are stored in the memory and configured to be executed by the processor to implement the image processing method of any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that, It stores a computer program, which is loaded by a processor to execute the image processing method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Image processing method and device

    CN112907459A

  • Colorization of bitmaps

    US20110043535A1