Image processing method and device, computer equipment and medium
By performing multi-level blur and brightness processing on the original image, an image with blur and luminous effects is generated, which solves the problem of single image special effects in the prior art and achieves a rich special effects experience.
Patent Information
- Application Number
- CN202410991218.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-23
- Publication Date
- 2024-11-01
AI Technical Summary
The prior art is difficult to enrich the special effects processing of images, and cannot meet users' needs for multi-level blur and luminous effects, resulting in a single image special effects experience.
By performing multi-level blur and fusion processing on the original image, combined with brightness enhancement and adjustment, a target image with blur and luminous effects is generated.
The multi-level blur and luminous effect processing of the image is realized, enriching the image special effect experience, allowing users to obtain a multi-level blurred luminous film viewing experience when browsing images.
Smart Images

Figure CN118887148A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of image processing, and in particular to an image processing method, apparatus, computer equipment and medium. Background Art
[0002] With the rapid development of multimedia technology and image processing technology, special effects processing for images or videos has also been widely used. Usually, special effects processing can also be applied in various scenarios, such as post-synthesis of stock footage, filter effects of live broadcast images, etc. Users are also paying more and more attention to the special effects experience of various images or videos. For example, users are keen to add various special effects to images or videos in order to bring different special effects viewing experiences. Therefore, how to enrich the special effects processing of images has become a current research hotspot. Summary of the invention
[0003] The embodiments of the present application provide an image processing method, apparatus, computer equipment and medium, which can add new special effects to images, enrich the special effects processing of images, and enrich the special effects viewing experience.
[0004] The first aspect of the embodiment of the present application discloses an image processing method, the method comprising:
[0005] The original image is subjected to multi-level blurring processing to obtain blurred images with multiple blurring degrees;
[0006] Fusion processing is performed on the blurred images of the multiple blur levels to obtain a target blurred image for the original image;
[0007] Using the original image to perform brightness enhancement on the target blurred image to obtain a brightness enhanced image;
[0008] The brightness of the brightness enhanced image is adjusted based on the brightness value of each pixel in the brightness enhanced image to obtain a target image.
[0009] A second aspect of an embodiment of the present application discloses an image processing device, the device comprising:
[0010] A blurring unit, used for performing multi-level blurring processing on the original image to obtain blurred images with multiple blurring degrees;
[0011] A fusion unit, configured to fuse the blurred images of the multiple blur levels to obtain a target blurred image for the original image;
[0012] An enhancement unit, configured to perform brightness enhancement on the target blurred image using the original image to obtain a brightness enhanced image;
[0013] The adjustment unit is used to adjust the brightness of the brightness enhanced image based on the brightness value of each pixel in the brightness enhanced image to obtain a target image.
[0014] A third aspect of an embodiment of the present application discloses a computer device, comprising a processor and a memory, wherein the memory is used to store a computer program, the computer program comprises program instructions, and the processor is configured to call the program instructions to execute the method of the first aspect above.
[0015] A fourth aspect of an embodiment of the present application discloses a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, wherein the computer program includes program instructions, and when the program instructions are executed by a processor, the processor executes the method of the first aspect.
[0016] The fifth aspect of the embodiments of the present application discloses a computer program product or a computer program, wherein the computer program product or the computer program comprises program instructions, and when the program instructions are executed by a processor, the method of the first aspect is implemented.
[0017] In the embodiment of the present application, the original image can be subjected to multi-level blur processing to obtain blurred images with multiple blur levels; the blurred images with multiple blur levels can also be fused to obtain a target blurred image for the original image; further, the target blurred image can be brightness enhanced using the original image to obtain a brightness enhanced image; and the brightness of the brightness enhanced image can be adjusted based on the brightness value of each pixel in the brightness enhanced image to obtain a target image. By implementing the above method, the original image can be adjusted to an image with a more blurred effect and a luminous effect after being blurred and brightness adjusted, so that the original image has a new image special effect, enriching the original special effect. The image special effect allows users to have a multi-level blurred luminous film viewing experience when browsing the image, and also brings users more special effect viewing experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0019] Figure 1 It is a flowchart of an image processing system provided by an embodiment of the present application;
[0020] Figure 2 It is a flowchart of an image processing method provided in an embodiment of the present application;
[0021] Figure 3 is a schematic diagram of an original image provided in an embodiment of the present application;
[0022] Figure 4 is a schematic diagram showing five texture-degraded images provided in an embodiment of the present application;
[0023] Figure 5 It is a schematic diagram of a process for determining the existence of image processing requirements provided by an embodiment of the present application;
[0024] Figure 6 is a schematic diagram of an image obtained by mapping an image from a linear space to an sRGB standard space provided in an embodiment of the present application;
[0025] Figure 7 It is a schematic diagram of an image obtained after the LUT image is used as an image provided by an embodiment of the present application;
[0026] Figure 8 is a schematic diagram of an image obtained by superimposing a target vignetting material on an image provided by an embodiment of the present application;
[0027] Fig. 9 It is a schematic diagram of a scenario of adding filter effects to an image using an image processing method provided in an embodiment of the present application;
[0028] Fig.10 is a structural schematic diagram of an image processing device provided in an embodiment of the present application;
[0029] Fig.11 It is a structural diagram of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0030] The technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application.
[0031] The embodiment of the present application proposes an image processing scheme, the principle of which is as follows: the original image can be subjected to multi-level blur processing to obtain a target blurred image containing multiple blur levels, and the target blurred image is an image with a blur effect; after obtaining the target blurred image, the brightness of the target blurred image can also be adjusted to add a luminous effect to the image with the blur effect, so as to obtain a target image with a blur effect and a luminous effect.
[0032] In one embodiment, the specific implementation of performing multi-level blur processing on the original image to obtain a target blurred image containing multiple blur levels can be: firstly performing multi-level blur processing on the original image to obtain blurred images with multiple blur levels; and then fusing the blurred images with multiple blur levels to obtain a target blurred image for the original image.
[0033] In one embodiment, the target blurred image is brightness adjusted to obtain the target image. The specific implementation may be: the target blurred image is brightness enhanced using the original image to obtain a brightness enhanced image; and the brightness enhanced image may be brightness adjusted based on the brightness value of each pixel in the brightness enhanced image to obtain the target image.
[0034] Through the above method, the original image can be adjusted to an image with a more blurred and luminous effect after blurring and adjusting the brightness, so that the original image has a new image special effect and enriches the original special effects. This image special effect allows users to have a multi-level blurred luminous film viewing experience when browsing the image, and also brings users more special effects viewing experience.
[0035] In a specific implementation, the execution subject of the above-mentioned image processing solution can be a computer device, which can be a terminal or a server. The terminal mentioned here can be a smart phone, tablet computer, laptop computer, desktop computer and other devices; the server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDN), and big data and artificial intelligence platforms, etc.
[0036] For example, when the computer device is a server, the embodiment of the present application provides an image processing system, such as Figure 1 As shown, the image processing system may include at least one terminal and at least one server; the terminal may obtain the original image to be processed, and upload the obtained original image to the server (i.e., a computer device) so that the server may obtain the original image, and use an image processing scheme to implement special effects processing on the original image to obtain a target image, which may be an image with a blur effect and a luminous effect.
[0037] Based on the image processing solution provided above, the present application embodiment provides an image processing method, which can be executed by the computer device mentioned above. Figure 2The image processing method includes but is not limited to the following steps:
[0038] S201, performing multi-level blur processing on the original image to obtain blurred images with multiple blur levels.
[0039] The original image may refer to any image, for example, the original image may be any type of image, such as a person image, a landscape image, etc. The original image may be an image in a user's photo album, or an image taken instantly by a camera device. Figure 3 shown.
[0040] In the embodiment of the present application, the original image is made to have the effect of playing with light, which can be specifically reflected in the blur effect and the luminous effect. Therefore, the original image can be blurred here to make the original image have the blur effect. Among them, the effect of playing with light proposed in the embodiment of the present application can be understood as a filter effect added to the image, such as the filter effect can be called a luminous film filter effect, or a filter effect named by other names.
[0041] In one implementation, the original image may be subjected to multiple different levels of degraded texture processing to obtain multiple texture degraded images of the original image. The number of levels corresponding to the multiple different levels may be a target number, that is, the original image needs to be subjected to a target number of different levels of degraded texture processing to obtain a target number of texture degraded images; the target number may be preset, and its specific value is not limited, such as the target number may be 3, 5, and the like. Exemplarily, assuming that the target number is 5, the original image may be subjected to 5 different levels of degraded texture processing to obtain 5 texture degraded images.
[0042] Among them, downgraded texture processing can refer to downgrading a high-resolution texture to a low-resolution texture to meet different rendering requirements or performance limitations; a level of downgraded texture processing here can specifically refer to performing a 2n-power operation on the resolution of the original image, and the resulting image is a texture-degraded image. Wherein, n is a positive integer, such as n is a value such as 2, 3, etc. As mentioned above, the embodiment of the present application needs to perform multiple different levels of downgraded texture processing, then it is necessary to perform a target number of 2n-power operations on the resolution of the original image here to obtain a target number of texture-degraded images, and the n value corresponding to each execution of the 2n-power operation is different to ensure that texture-degraded images of different levels can be obtained. For example, assuming that the target number is 5, the 5 n values can be 2, 3, 4, 5, and 6 respectively. Here, it can be simply understood that in the same image, through a reasonable calculation method, the original image is converted into a multi-level small image to achieve a mipmap (multi-level asymptotic texture) effect.
[0043] For example, assuming that the number of targets is 5, the texture of the original image needs to be degraded into 5 levels, and the values of n corresponding to 2 to the power of n are 2, 3, 4, 5, and 6. This means that the texture resolution of each level will gradually decrease. For example, if the resolution of the original image is 1024×1024, the resolution of the next level (or the first level) may be 512×512, and the image corresponding to this resolution can be called the first texture degraded image; the next level (or the second level) is 256×256, and the image corresponding to this resolution can be called the second texture degraded image; the third level is 128×128, and the image corresponding to this resolution can be called the third texture degraded image; the fourth level is 64×64, and the image corresponding to this resolution can be called the fourth texture degraded image; the fifth level is 32×32, and the image corresponding to this resolution can be called the fifth texture degraded image.
[0044] For example, the original image is Figure 3 For example, the blurred images with 5 blur levels for the original image can be obtained as follows: Figure 4 The 5 images shown in .
[0045] After obtaining multiple texture degraded images of the original image, each of the multiple texture degraded images can be blurred respectively to generate a blurred image corresponding to each texture degraded image, so as to obtain blurred images with multiple blur levels. Among them, a blurred image corresponding to a texture degraded image is a blurred image with a blur level. That is, the small images (texture degraded images) at different levels are blurred so that the blur levels at different levels are different.
[0046] Considering that the principle of blurring any one of the multiple texture-degraded images is consistent, the blurring process is described below by taking any one of the texture-degraded images as an example.
[0047] The blurring process may refer to Gaussian blurring or other blurring processes, which are not limited to this. Here, Gaussian blurring is used as an example for explanation. Based on this, it can be known that the texture degraded image can be subjected to Gaussian blurring to generate a blurred image corresponding to the texture degraded image. When performing Gaussian blurring, it may specifically refer to convolution of the texture degraded image using a Gaussian filter with a kernel size of a specified kernel size. The specified kernel size may be pre-set, and its specific value is not limited. For example, the specified kernel size is 5×5, 3×3, etc.
[0048] It should be understood that the principle of Gaussian blur processing is to assign weights to each pixel in the image based on Gaussian distribution. The closer the pixel is to the center, the greater the weight. In this way, when calculating a new pixel value for a pixel, the neighboring pixels will have a greater impact on the final value of the point, thereby achieving a smoothing effect. Therefore, by using Gaussian blur processing on the texture degraded image here, the texture degraded image can be made smoother, the details will be reduced, and the texture degraded image can achieve the effect of background blur, which also makes the texture degraded image have a blurred effect.
[0049] Based on the above description, it can be known that each texture degraded image can be subjected to Gaussian blur processing to obtain blurred images of each texture degraded image. When each texture degraded image is subjected to Gaussian blur processing, the specified kernel size used can be the same or different, and there is no limitation on this; for example, assuming that there are 5 texture degraded images, the specified kernel size for Gaussian blur processing of these 5 texture degraded images can all be 5×5; or, 3 of the specified kernel sizes for Gaussian blur processing of these 5 texture degraded images are 5×5, and the other 2 are 3×3.
[0050] In one implementation, the computer device may execute step S201 when detecting that there is a need to process the original image.
[0051] In one embodiment, a computer device may obtain an image processing request for an original image, and determine that there is an image processing requirement for the original image. The image processing request may be triggered by any user performing a related operation on a user operation interface. For example, when a user needs to add a luminous film filter effect to a picture, the user operation interface output by the terminal used may be used to perform a related operation to send an image processing request for the image to the computer device. For example, see Figure 5 As shown, a user operation interface may be displayed on the terminal screen of the terminal used by the user, and the user operation interface may include at least an image input area 501 and a special effect control 502. If the user wants to add a filter special effect to an image, the user may first input the relevant information of the image in the image input area 501 (such as the image directly, or the link address corresponding to the image); then, a trigger operation (such as clicking, pressing, etc.) may be performed on the special effect control 502; after the terminal detects that the special effect control 502 is triggered, the original image may be obtained based on the information in the image input area 501, and after the terminal obtains the original image, an image processing request carrying the original image may be sent to the computer device, and the image processing request may carry the original image, so that the original image may be subsequently processed to obtain a target image, which is an image with a luminous film filter special effect added.
[0052] In a possible implementation, the above-mentioned user operation interface can also be understood as an image special effect adding interface, that is, the image special effect adding interface can be output, and the user can input the corresponding original image on the image special effect adding interface, and can initiate a special effect adding instruction, so that the computer device can obtain the original image and the special effect adding instruction inputted in the image special effect adding interface, and can respond to the special effect adding instruction, thereby triggering the execution of multi-level blurring of the original image to obtain a blurred image with multiple blur levels. Among them, as mentioned above, the image special effect adding interface can also include a special effect control, and when the special effect control is triggered, a special effect adding instruction for adding a luminous film filter special effect can be generated. After obtaining the target image through the image processing method proposed in the embodiment of the present application, the original image inputted on the image special effect adding interface can also be updated to the target image.
[0053] In one embodiment, when a timed image processing task (or a timed special effect adding task) is triggered, it can be determined that the image processing requirement for the original image is obtained. For example, a timed image processing task can be set, and when the triggering condition in the timed image processing task is triggered, it can be determined that the image processing requirement is obtained. In one embodiment, a large number of images can be stored in a designated storage area, and the triggering condition can be that the current time reaches the preset processing time, or the remaining storage space of the designated storage area exceeds the preset remaining storage space, etc. Among them, the original image to be processed can be an image in the designated area.
[0054] S202, fusing blurred images of multiple blur levels to obtain a target blurred image for the original image.
[0055] In one implementation, the computer device may perform an average operation on the pixel values of corresponding positions in blurred images of multiple blur levels to obtain a target pixel value corresponding to each pixel; wherein the average operation result of multiple pixel values for a pixel is the target pixel value of the pixel. Then, a target blurred image for the original image may be generated based on the obtained target pixel value corresponding to each pixel; that is, the pixel value of a pixel in the target blurred image is the calculated average operation result.
[0056] Assuming that there are blurred images with five blur levels, the description of determining the target blurred image can be expressed by the following formula (1):
[0057] blurSum=(blur1+blur2+bulr3+blur4+blur5) / 5(1)
[0058] Among them, blurSum represents the target blurred image, blur1, blur2, blur3, blur4, and blur5 represent five blurred images with different blur levels respectively.
[0059] Through the fusion processing operation here, a target blurred image that retains the details of the original image and has an appropriate blur effect can be obtained.
[0060] S203, using the original image to perform brightness enhancement on the target blurred image to obtain a brightness enhanced image.
[0061] In one implementation, the brightness of the original image can be adjusted in a target manner in a direction of increasing the brightness of the original image to obtain an adjusted image; the adjusted image is an image in a linear space. The target manner may refer to a manner that can enhance the brightness of an image, for example, the target manner may be a gamma correction manner. That is, the original image may be gamma corrected, and the original image after gamma correction is the adjusted image. Through gamma correction, the relationship between the brightness and color of the image can be made more consistent with the perception of the human eye.
[0062] The original image was originally an image in the sRGB standard space, which can be simply understood as a nonlinear color space. Here, the color of the original image is converted from the sRGB standard space to a linear space, which is also convenient for subsequent calculation operations. In a linear space, the color value of an image is proportional to the brightness, which makes operations such as color mixing more intuitive and convenient, avoiding complex calculations in a nonlinear color space; at the same time, it can also effectively avoid introducing unnecessary errors in the calculation process and improve the accuracy of image processing.
[0063] The process of performing gamma correction on the original image to obtain the adjusted image can be expressed mathematically as shown in the following formula (2):
[0064] highColor=pow(srcColor,2.2)(2)
[0065] Among them, highColor represents the adjusted image, srcColor represents the original image, and pow(A,B) represents A to the power of B. This formula (2) can be understood as taking the 2.2th power of the color value as the final output color value. Formula (2) is simply an approximate conversion of the color from the sRGB standard space to the linear space, because in the sRGB standard space, there is a roughly linear relationship between the brightness of the color and the square root of the color value.
[0066] Then, the adjusted image and the target blurred image can be fused to obtain an initial enhanced image. In one embodiment, the fusion process can specifically refer to the summation of the pixel values of the corresponding pixels in the two images; based on this, it can be seen that the specific implementation of the fusion process here can be: summing the pixel value of each pixel in the adjusted image with the pixel value of the corresponding pixel in the target blurred image to obtain the summation result of each pixel, and then generating the initial enhanced image based on the summation result of each pixel. Among them, the pixel value of each pixel in the initial enhanced image is the summation result obtained by the above calculation.
[0067] The above description of determining the initial enhanced image can be expressed by the following formula (3):
[0068] resColor=highColor+blurSum(3)
[0069] Among them, resColor represents the initial enhanced image, highColor represents the adjusted image, and blurSum represents the target blurred image.
[0070] Finally, the initial enhanced image can be mapped from the linear space to the standard color space to obtain a brightness enhanced image.
[0071] Among them, the standard color space refers to the sRGB standard space (or called the sRGB color space). It should be understood that the terminal display is usually designed based on the sRGB standard. Therefore, in order to ensure that the image can correctly display the color of the image on the terminal and ensure normal image display and output, the color value of the image needs to be converted from the linear space back to the sRGB standard space. In addition, this design also takes into account the nonlinear perception of light by the human eye. The human eye is more adaptable to the perception under the sRGB standard space. Therefore, converting the color value of the image from the linear space to the standard color space can ensure that the final visual effect meets the user's expectations. In addition, the sRGB standard space is an international standard color space. Converting the color value of the image from the linear space back to the sRGB standard space can also ensure that the image has a consistent display effect on different devices and platforms. On the other hand, the compatibility of the image format is also taken into account. Usually, the image format (such as JPEG, PNG and other image formats) assumes that the color value of the image is in the sRGB standard space. If the linear space to the standard color space conversion is not performed here, the saved image may not be opened or displayed correctly on the terminal. In summary, the operation of mapping the initial enhanced image from a linear space to a standard color space performed in the embodiment of the present application can ensure that the final image can maintain correct color representation when displayed, saved, and transmitted, and is compatible with other devices and platforms, thereby ensuring that the image has color consistency on different devices and platforms.
[0072] As mentioned above, gamma correction is used to map the color values of the original image from the sRGB standard space to the linear space. Here, inverse gamma correction can be used to map the color values of the initial enhanced image from the linear space to the sRGB standard space. The former mapping can be understood as a positive mapping, and the latter mapping can be understood as a negative mapping.
[0073] The process of using inverse gamma correction to map the color value of the initial enhanced image from the linear space to the sRGB standard space to obtain a brightness enhanced image can be expressed mathematically as shown in the following formula (4):
[0074] fResColor=pow(resColor,1.0 / 2.2)(4)
[0075] Wherein, fResColor represents the brightness enhanced image, and resColor represents the initial enhanced image. Contrary to the understanding of the above formula (2), formula (4) can be understood as taking the 2.2th root of the color value (i.e., 1 / 2.2th power) as the final output color value.
[0076] S204, adjusting the brightness of the brightness enhanced image based on the brightness value of each pixel in the brightness enhanced image to obtain a target image.
[0077] It can be understood that, through the image processing method proposed in the embodiment of the present application, the original image can be blurred and the brightness adjusted at multiple levels, so that the original image has a blur effect and a luminous effect, or the original image realizes the effect of light, or the target image is an image with a blur effect and a luminous effect. Making the original image have such an effect can be simply understood as adding a filter effect to the original image, such as the filter effect can be called a luminous film effect.
[0078] For example, see Figure 5 As shown, after the user imports the picture 1 in the image input area 501 in the interface 51 of the terminal, the terminal can send the picture 1 to the computer device (such as a server) so that the computer device can perform image processing on the picture 1 to obtain the picture 1 with the luminous film special effect. After obtaining the picture 1 with the luminous film special effect, the computer device can return the picture 1 with the luminous film special effect to the terminal to display the picture 1 with the luminous film special effect on the interface 52 of the terminal, such as the picture 1 with the luminous film special effect is the picture marked by 503 in the interface 52.
[0079] In one implementation, the pixel value of each pixel in the brightness enhanced image may be normalized to obtain the first image.
[0080] For example, the normalization process here can be expressed using the following formula (5).
[0081] toneMapColor=(fResColor / (1.0+fResColor))(5)
[0082] Among them, toneMapColor represents the first image, and fResColor represents the brightness enhanced image.
[0083] The normalization processing here is to perform color tone mapping on the brightness enhanced image fResColor. Specifically, the pixel values in the brightness enhanced image fResColor are mapped to the range of 0 to 1, so that the color values are more evenly distributed. The brightness of the high-brightness area in the image can also be reduced to obtain a color with a luminous effect.
[0084] The brightness of each pixel in the brightness enhanced image may also be adjusted using the brightness value of each pixel in the brightness enhanced image to obtain a second image.
[0085] In one embodiment, the brightness value of each pixel in the brightness enhanced image can be calculated first. Considering that the calculation principle of calculating the pixel value of any pixel is consistent, the following description is given by taking any pixel in the brightness enhanced image as an example. For any pixel in the brightness enhanced image, the RGB value of the pixel is obtained, and the RGB value is calculated according to the brightness calculation formula to obtain the brightness value of the pixel.
[0086] Among them, the RGB value of a pixel includes R value, G value and B value, and R value, G value and B value represent the red component value, green component value and blue component value respectively; the brightness calculation formula is: Y (brightness) = 0.299R + 0.587G + 0.114B. 0.299, 0.587 and 0.114 represent the weights of the red channel, green channel and blue channel respectively. That is, the brightness value of a pixel can be determined based on the brightness calculation formula. For example, assuming that the RGB value of a pixel is (85, 130, 170), then its brightness value is Y = 0.299*85+0.587*130+0.114*170.
[0087] The brightness adjustment here can be expressed using the following formula (6).
[0088] oneColor=fRecColor / (lightVal+1.0)(6)
[0089] Among them, oneColor represents the second image, and lightVal represents the brightness value of the pixel in the brightness enhanced image fRecColor.
[0090] Finally, the pixel value of each pixel in the first image can be used as an adjustment coefficient to linearly blend the second image and the first image to obtain a target image. Figure 6 shown.
[0091] Among them, linear aliasing can refer to mixing two or more images in a certain proportion to produce a new image effect; for example, here the second image and the first image are mixed to obtain the desired image. During the mixing, the corresponding pixels in different images are weighted averaged to obtain the mixed pixel values. That is, the target image here, its color value at each pixel is the weighted average of the color values of the second image and the first image at that pixel. The weighted processing in the embodiment of the present application is implemented using the pixel value of each pixel in the first image. Through the linear aliasing processing here, it is possible to effectively avoid overexposure of highlight areas, making the image more natural and smooth.
[0092] For example, the linear aliasing here can be expressed using the following formula (7).
[0093] bloomColor=mix(fRecColor / (lightVal+1.0),toneMapColor,toneMapColor)(7)
[0094] Wherein, bloomColor represents the initial target image, mix(x,y,a) is a linear aliasing function, which can be understood as a linear aliasing of x and y, mix(x,y,a)=x*(1-a)+y*a.
[0095] In addition to the above-mentioned direct use of the linear aliasing method to obtain the target image, the image can also be processed on the basis of the image obtained by the linear aliasing method to adjust the actual effect of the final image. For the convenience of description, in this case, the image obtained by the linear aliasing method can be called a reference image, that is, the reference image can be processed later to obtain the target image. The specific implementation can be seen in the following description.
[0096] In one implementation, the color of the reference image may be adjusted using a color lookup table to convert the reference image into a standard image with standard colors, and the standard image is used as the target image.
[0097] Among them, the color lookup table may refer to a LUT (Look-Up Table) diagram. LUT is a color mapping technology that can map each pixel value in an image to a new value through a predefined mapping rule to change the color performance of the image. The processing of the LUT diagram can be used to enhance specific colors of the image, or simulate specific visual effects, such as adding filters to the image to change the style of the image. Through the processing of the LUT diagram, the color style of the image can be transformed, and the LUT can quickly convert the image from one color space to another color space. In short, the LUT diagram is a mapping table that can be used to adjust the hue and / or saturation of the color. LUT can also synchronize color effects between different devices and platforms to ensure color consistency when viewed on different devices to achieve cross-platform synchronization; in general, the embodiment of the present application can use the LUT diagram to process the reference image to efficiently complete the transformation of the color style and generate the target image. Among them, the size of the LUT diagram is not fixed, and LUT diagrams of different sizes can be customized according to project requirements to adapt to different pixel sizes and sampling requirements.
[0098] In one embodiment, the specific implementation of using a color lookup table to adjust the color of a reference image to obtain a target image may be: first, the reference image is converted from an RGB color space to an image in an HSV (Hue, Saturation, Value) color space, considering that saturation is easier to adjust in the HSV color space; then, the LUT image may be applied in the HSV color space to obtain a third image, and this operation is mainly to change the color characteristics of the reference image; after obtaining the third image, the third image may be converted from the HSV color space to an RGB color space to obtain the target image
[0099] For example, see Figure 7 As shown, Figure 7 The image on the right is the LUT image, and the image on the left is the standard image after the reference image is color adjusted using the LUT image.
[0100] In one implementation, a target vignetting material may be obtained and superimposed on a reference image to obtain a target image. The target vignetting material may be pre-set, and when the material is needed, the corresponding target vignetting material may be directly obtained from a related storage space. For example, see Figure 8 As shown, Figure 8 The image on the middle right is the target vignetting material.
[0101] By adding target vignetting material, you can enhance the layering and depth of an image. Adding target vignetting material to an image can make the four corners of the image darker and the central area brighter, that is, you can reduce the brightness of the four corners of the image, highlight the middle area of the image, create a dark corner or bright corner effect, so that the brightness distribution of the image presents a gradient effect, thereby enhancing the layering and depth of the image. In general, you can make the edges of the image blurred, making it easier for the human eye to focus on the center of the image, so as to highlight the main body of the image or create a specific visual style, thereby producing a visual guiding effect. This enhancement of layering and depth can also make the image more vivid, three-dimensional and interesting.
[0102] In one implementation, the color lookup table and the target vignetting material described above can be combined to generate the final desired target image. The specific implementation in this case can be: first use the color lookup table to adjust the color of the reference image to convert the reference image into a standard image with standard colors; then obtain the target vignetting material, and superimpose the target vignetting material on the standard image to obtain the target image. In this processing, the color lookup table can be used to adjust the actual final effect of the image to ensure that the color is not over-exposed or too bright, and the vignetting material can be used to lower the brightness of the four corners of the image, thereby highlighting the effect of the middle area of the image. For example, see Figure 7 as well as Figure 8 Display of relevant images in Figure 7 The image on the right is the LUT image, and the image on the left is the standard image after the reference image is color adjusted using the LUT image; Figure 8 The image on the right is the target vignetting material, and the image on the left is the target vignetting material. Figure 7 The target image is obtained by processing the standard image on the left.
[0103] It should be noted that the above description is to first use the color lookup table for processing and then use the target vignetting material for processing; or, it can also be to first use the target vignetting material for processing and then use the color lookup table for processing; there is no limitation on this, and the implementation of the latter will not be repeated here.
[0104] In an embodiment of the present application, the original image can be subjected to multi-level blur processing to obtain blurred images with multiple blur levels; and the blurred images with multiple blur levels can be fused to obtain a target blurred image for the original image; the target blurred image can also be brightness enhanced using the original image to obtain a brightness enhanced image; the brightness of the brightness enhanced image can be further adjusted based on the brightness value of each pixel in the brightness enhanced image to obtain a target image; the target image is an image with a blur effect and a luminous effect compared to the original image. In the above manner, the original image can be adjusted to an image with a more blur effect and a luminous effect after being blurred and brightness enhanced, so that the original image has a new image special effect, enriching the original special effect. The image special effect allows users to have a multi-level blurred luminous film viewing experience when browsing the image, and also brings users more special effect viewing experience.
[0105] To better understand the image processing method proposed in this application, the following further describes the method, which may involve the following steps:
[0106] S1, performing multiple levels of texture degradation processing on the original image to obtain multiple texture degraded images.
[0107] The original image can be recorded as srcColor. For example, the original image can be recorded as Figure 3 shown.
[0108] For example, the original image may be subjected to five different levels of texture degradation processing to obtain five texture degradation images. For example, the five texture degradation images may be as follows: Figure 4 shown.
[0109] S2, performing Gaussian blur processing on each texture degraded image in step S1 using a convolution kernel with a convolution kernel size of 5 cores to obtain blurred images with multiple blur levels.
[0110] For example, assume that there are five blurred images with different blur levels, and the five blurred images can be respectively recorded as blur1, blur2, blur3, blur4, and blur5.
[0111] S3, fusing the blurred images of multiple blur levels to obtain a target blurred image.
[0112] The fusion processing here may refer to performing a mean operation on the pixel values of corresponding pixel points of blurred images with multiple blur levels, and the mean operation result of each pixel point is the pixel value of the corresponding pixel point in the target blurred image.
[0113] For example, the target blurred image may be recorded as blurSum here.
[0114] S4, performing gama correction on the original image srcColor to obtain an adjusted image.
[0115] Here, the adjusted image is recorded as highColor, and the specific implementation of step S4 can refer to the above formula (2). Gama correction can be understood as a simple approximate conversion of the color value of the image from the sRGB standard space to the linear space.
[0116] S5, fusing the adjusted image highColor and the target blurred image blurSum in step S3 to obtain an initial enhanced image.
[0117] Here, the initial enhanced image is recorded as resColor. The specific implementation of step S5 can refer to the above formula (3).
[0118] S6, mapping the initial enhanced image resColor from the linear space to the sRGB standard space to obtain a brightness enhanced image.
[0119] Among them, the brightness enhanced image is recorded as fResColor here. The mapping here can be the inverse mapping corresponding to the mapping in the above step S4. The specific implementation of step S6 can refer to the above formula (4). This step is to convert the color value of the blurred image (i.e., the target blurred image) and the sum of the original image from the linear space back to the sRGB standard space. In contrast to step S4, step S6 takes the 2.2th root (i.e., 1 / 2.2th power) of each component of the color value as the final output color value. This is because after the rendering is completed, the color value in the linear space needs to be converted back to the sRGB standard space so that it can be finally displayed on the terminal screen.
[0120] S7, tone mapping the colors of the brightness enhanced image fResColor, that is, normalizing fResColor to obtain a first image.
[0121] The specific implementation of step S7 can refer to the above formula (5). By implementing this step, the brightness of the high brightness area in the image can be reduced to obtain the final color with a luminous effect.
[0122] S8, calculating the brightness value lightVal of each pixel in the brightness enhanced image fResColor, and adjusting the brightness of each pixel in the brightness enhanced image using the brightness value of each pixel in the brightness enhanced image to obtain a second image.
[0123] Here, the brightness value is recorded as lightVal. The specific implementation of determining the second image here can refer to the above formula (6).
[0124] S9, using the pixel value of each pixel point in the first image as an adjustment coefficient, linearly blending the second image and the first image to obtain a reference image.
[0125] The reference image is denoted as bloomColor. The specific implementation of step S9 can refer to the above formula (7). By implementing this step, overexposure of the highlight area in the image can be avoided, making the image more natural and smooth. For example, the reference image can be as follows: Figure 6 shown.
[0126] S10, applying the LUT image to the reference image bloomColor in step S7 to adjust the overall saturation of the reference image bloomColor to obtain a standard image with standard colors.
[0127] Here, the standard image is recorded as lutColor. For example, see Figure 7 As shown, Figure 7 The image on the right in the middle is a LUT image, and the image on the left is a standard image with standard colors.
[0128] S11, superimpose the target dark corner material onto the standard image lutColor to reduce the brightness of the four corners and highlight the middle area effect, thereby obtaining the final desired target image.
[0129] For example, see Figure 8 As shown, Figure 8 The image on the right is the target vignetting material image, and the image on the left is the target image.
[0130] In one implementation, the image processing method proposed in the embodiment of the present application can be applied to a community image and text editing tool, in which there can be a variety of image and text template special effects. A type of image and text template special effect can be understood as adding an image special effect to an image, and the image processing method proposed in the embodiment of the present application can be understood as adding a luminous film special effect to an image. For example, the community image and text editing tool can refer to a tool that has the function of adding image special effects in the user's photo album; or, the community image and text editing tool can also be a tool in other clients that has the function of adding image special effects.
[0131] In a specific application scenario, users can perform related operations in the community image editing tool to make an image have a glowing film effect. Fig. 9As shown, the community graphic editing tool may provide an interface 91 (such as the interface 91 may be understood as the interface where the user's photo album is located). The interface 91 may be understood as an image import interface, that is, the user may select the image to which special effects need to be added on the interface 91. The image here may be understood as the photo in the user's photo album, such as the user may select the photo 901.
[0132] After completing the photo selection, the user can perform a trigger operation (such as clicking, pressing, etc.) on the next control 902 on the interface 91; after the terminal detects that the next control 902 is triggered, the terminal can jump from the interface 91 to the interface 92. The interface 92 can be understood as a functional interface for adding various special effects to the photo. For example, the special effects added to the image can include text effects, sticker effects, filter effects, etc. When the user needs to add filter effects to the photo 901, the filter effect control 903 can be triggered. After the terminal detects that the filter effect control 903 is triggered, the terminal can jump from the interface 92 to the interface 93. Various filter effect options can be displayed in the interface 93, such as filter 1, filter 2, filter 3, filter 4, etc., which correspond to the filter effect options respectively. For example, the filter 3 marked by 904 is the luminous film filter effect provided in the embodiment of the present application.
[0133] The user can select the filter effect to be added in the interface 93. For example, when the user wants to process the photo by using the filter 3 in the interface 93, the filter effect option 904 corresponding to the filter 3 can be triggered. After the terminal detects that the filter effect option 904 is triggered, the photo 901 can be obtained, and an image processing request can be sent to the computer device. The image processing request can carry the photo 901 and the filter effect indicated by the filter effect option 904, so that the computer device can respond to the image processing request and perform the image processing proposed in the embodiment of the present application on the photo 901 carried in the image processing request, so as to add the filter 3 to the photo 901. After the computer device obtains the photo 901 with the filter 3 added, the photo 901 with the filter 3 added can be returned to the terminal, so that the terminal can display the photo 901 with the filter 3 added on the interface 94, wherein the photo 901 with the filter 3 added can be shown as the photo 905 in the interface 94.
[0134] In summary, the embodiment of the present application can adjust the original image to an image with a more blurred effect and a luminous effect after blurring and brightness enhancement processing. In the above manner, the original image can have a new image special effect, enriching the original special effects. The image special effect allows the user to have a multi-level blurred luminous film viewing experience when browsing the image, and also brings more special effect viewing experience to the user.
[0135] See also Fig.10 , Fig.10 : is a schematic diagram of the structure of an image processing device provided in an embodiment of the present application. The image processing device described in this embodiment includes:
[0136] The blurring unit 1001 is used to perform multi-level blurring processing on the original image to obtain blurred images with multiple blurring degrees;
[0137] A fusion unit 1002 is used to fuse the blurred images of the multiple blur levels to obtain a target blurred image for the original image;
[0138] The enhancement unit 1003 is used to perform brightness enhancement on the target blurred image using the original image to obtain a brightness enhanced image;
[0139] The adjustment unit 1004 is configured to perform brightness adjustment on the brightness enhanced image based on the brightness value of each pixel in the brightness enhanced image to obtain a target image.
[0140] In one implementation, the blurring unit 1001 is specifically configured to:
[0141] Performing multiple different levels of texture degradation processing on the original image to obtain multiple texture-degraded images of the original image;
[0142] Each texture-degraded image is blurred respectively to generate a blurred image corresponding to each texture-degraded image, so as to obtain blurred images with multiple blurring degrees.
[0143] In one implementation, the fusion unit 1002 is specifically configured to:
[0144] Performing a mean operation on the pixel values of the pixel points at corresponding positions in the blurred images of the multiple blur levels to obtain a target pixel value corresponding to each pixel point;
[0145] A target blurred image for the original image is generated based on the obtained target pixel value corresponding to each pixel point.
[0146] In one implementation, the enhancement unit 1003 is specifically configured to:
[0147] The original image is brightness-adjusted in a targeted manner in a direction of increasing the brightness of the original image to obtain an adjusted image; the adjusted image is an image in a linear space;
[0148] Performing a fusion process on the adjusted image and the target blurred image to obtain an initial enhanced image;
[0149] The initial enhanced image is mapped from a linear space to a standard color space to obtain a brightness enhanced image.
[0150] In one implementation, the adjusting unit 1004 is specifically configured to:
[0151] Normalizing the pixel value of each pixel in the brightness enhanced image to obtain a first image;
[0152] The brightness of each pixel in the brightness enhanced image is adjusted by using the brightness value of each pixel in the brightness enhanced image to obtain a second image;
[0153] The pixel value of each pixel in the first image is used as an adjustment coefficient, and the second image and the first image are linearly blended to obtain a target image.
[0154] In one implementation, the adjusting unit 1004 is specifically configured to:
[0155] Using the pixel value of each pixel point in the first image as an adjustment coefficient, linearly blending the second image and the first image to obtain a reference image;
[0156] Performing color adjustment on the reference image using a color lookup table to convert the reference image into a standard image with standard colors;
[0157] A target vignetting material is acquired, and the target vignetting material is superimposed on the standard image to obtain a target image.
[0158] In one implementation, the blurring unit 1001 is further configured to:
[0159] Output image special effects adding interface;
[0160] Acquire the original image and the special effect adding instruction inputted in the image special effect adding interface, respond to the special effect adding instruction and trigger the step of performing multi-level blurring processing on the original image to obtain blurred images with multiple blurring degrees;
[0161] The adjusting unit 1004 is further configured to:
[0162] The original image input on the image special effect adding interface is updated to the target image.
[0163] It is understood that the division of units in the embodiments of the present application is schematic and is only a logical function division. There may be other division methods in actual implementation. The functional units in the embodiments of the present application may be integrated into a processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated units may be implemented in the form of hardware or in the form of software functional units.
[0164] See also Fig.11 , Fig.11 1 is a schematic diagram of a computer device provided in an embodiment of the present application. The computer device includes: a processor 1101 and a memory 1102. Optionally, the computer device may also include a network interface 1103. The processor 1101, the memory 1102 and the network interface 1103 may exchange data.
[0165] The processor 1101 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or the processor may be any conventional processor, etc.
[0166] The memory 1102 may include a read-only memory and a random access memory, and provide program instructions and data to the processor 1101. A portion of the memory 1102 may also include a non-volatile random access memory. When the processor 1101 calls the program instructions, it is used to execute:
[0167] The original image is subjected to multi-level blurring processing to obtain blurred images with multiple blurring degrees;
[0168] Fusion processing is performed on the blurred images of the multiple blur levels to obtain a target blurred image for the original image;
[0169] Using the original image to perform brightness enhancement on the target blurred image to obtain a brightness enhanced image;
[0170] The brightness of the brightness enhanced image is adjusted based on the brightness value of each pixel in the brightness enhanced image to obtain a target image.
[0171] In one implementation, the processor 1101 is specifically configured to:
[0172] Performing multiple different levels of texture degradation processing on the original image to obtain multiple texture-degraded images of the original image;
[0173] Each texture-degraded image is blurred respectively to generate a blurred image corresponding to each texture-degraded image, so as to obtain blurred images with multiple blurring degrees.
[0174] In one implementation, the processor 1101 is specifically configured to:
[0175] Performing a mean operation on the pixel values of the pixel points at corresponding positions in the blurred images of the multiple blur levels to obtain a target pixel value corresponding to each pixel point;
[0176] A target blurred image for the original image is generated based on the obtained target pixel value corresponding to each pixel point.
[0177] In one implementation, the processor 1101 is specifically configured to:
[0178] The original image is brightness-adjusted in a targeted manner in a direction of increasing the brightness of the original image to obtain an adjusted image; the adjusted image is an image in a linear space;
[0179] Performing a fusion process on the adjusted image and the target blurred image to obtain an initial enhanced image;
[0180] The initial enhanced image is mapped from a linear space to a standard color space to obtain a brightness enhanced image.
[0181] In one implementation, the processor 1101 is specifically configured to:
[0182] Normalizing the pixel value of each pixel in the brightness enhanced image to obtain a first image;
[0183] The brightness of each pixel in the brightness enhanced image is adjusted by using the brightness value of each pixel in the brightness enhanced image to obtain a second image;
[0184] The pixel value of each pixel in the first image is used as an adjustment coefficient, and the second image and the first image are linearly blended to obtain a target image.
[0185] In one implementation, the processor 1101 is specifically configured to:
[0186] Using the pixel value of each pixel point in the first image as an adjustment coefficient, linearly blending the second image and the first image to obtain a reference image;
[0187] Performing color adjustment on the reference image using a color lookup table to convert the reference image into a standard image with standard colors;
[0188] A target vignetting material is acquired, and the target vignetting material is superimposed on the standard image to obtain a target image.
[0189] In one implementation, the processor 1101 is further configured to:
[0190] Output image special effects adding interface;
[0191] Acquire the original image and the special effect adding instruction inputted in the image special effect adding interface, respond to the special effect adding instruction and trigger the step of performing multi-level blurring processing on the original image to obtain blurred images with multiple blurring degrees;
[0192] The original image input on the image special effect adding interface is updated to the target image.
[0193] The present application also provides a computer storage medium in which program instructions are stored. When the program is executed, it may include: Figure 2 Part or all of the steps of the image processing method in the corresponding embodiment.
[0194] It should be noted that, for the above-mentioned various method embodiments, for the sake of simplicity of description, they are all expressed as a series of action combinations, but those skilled in the art should be aware that this application is not limited by the order of the actions described, because according to this application, some steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by this application.
[0195] A person skilled in the art may understand that all or part of the steps in the various methods of the above embodiments may be completed by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, and the storage medium may include: a flash drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.
[0196] The embodiment of the present application also provides a computer program product or computer program, which includes program instructions, and when the program instructions are executed by a processor, some or all of the steps in the above method can be implemented. For example, the program instructions are stored in a computer-readable storage medium. The processor of the computer device reads the program instructions from the computer-readable storage medium, and the processor executes the program instructions, so that the computer device executes the steps performed in the embodiments of the above methods.
[0197] The above is a detailed introduction to an image processing method, device, computer equipment and medium provided in the embodiments of the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea; at the same time, for general technical personnel in this field, according to the ideas of the present application, there will be changes in the specific implementation methods and application scopes. In summary, the content of this specification should not be understood as a limitation on the present application.
Claims
1. An image processing method, characterized in that: The method comprises: The original image is subjected to multi-level blur processing to obtain blurred images with multiple blur levels; Fusion processing is performed on the blurred images of the multiple blur levels to obtain a target blurred image for the original image; Using the original image to perform brightness enhancement on the target blurred image to obtain a brightness enhanced image; The brightness of the brightness enhanced image is adjusted based on the brightness value of each pixel in the brightness enhanced image to obtain a target image.
2. The method according to claim 1, characterized in that The original image is subjected to multi-level blurring processing to obtain blurred images with multiple blurring degrees, including: Performing multiple different levels of texture degradation processing on the original image to obtain multiple texture-degraded images of the original image; Each texture-degraded image is blurred respectively to generate a blurred image corresponding to each texture-degraded image, so as to obtain blurred images with multiple blurring degrees.
3. The method according to claim 1, characterized in that The step of fusing the blurred images of the multiple blur levels to obtain a target blurred image for the original image includes: Performing a mean operation on the pixel values of the pixel points at corresponding positions in the blurred images of the multiple blur levels to obtain a target pixel value corresponding to each pixel point; A target blurred image for the original image is generated based on the obtained target pixel value corresponding to each pixel point.
4. The method according to claim 1, characterized in that: The step of using the original image to perform brightness enhancement on the target blurred image to obtain a brightness enhanced image includes: The original image is brightness-adjusted in a targeted manner in a direction of increasing the brightness of the original image to obtain an adjusted image; the adjusted image is an image in a linear space; Performing a fusion process on the adjusted image and the target blurred image to obtain an initial enhanced image; The initial enhanced image is mapped from a linear space to a standard color space to obtain a brightness enhanced image.
5. The method according to claim 1, characterized in that The step of adjusting the brightness of the brightness enhanced image based on the brightness value of each pixel in the brightness enhanced image to obtain a target image includes: Normalizing the pixel value of each pixel in the brightness enhanced image to obtain a first image; The brightness of each pixel in the brightness enhanced image is adjusted by using the brightness value of each pixel in the brightness enhanced image to obtain a second image; The pixel value of each pixel in the first image is used as an adjustment coefficient, and the second image and the first image are linearly blended to obtain a target image.
6. The method according to claim 5, characterized in that The step of using the pixel value of each pixel point in the first image as an adjustment coefficient and performing linear aliasing on the second image and the first image to obtain a target image includes: Using the pixel value of each pixel point in the first image as an adjustment coefficient, linearly blending the second image and the first image to obtain a reference image; Performing color adjustment on the reference image using a color lookup table to convert the reference image into a standard image with standard colors; A target vignetting material is acquired, and the target vignetting material is superimposed on the standard image to obtain a target image.
7. The method according to claim 1, characterized in that Also includes: Output image special effects adding interface; Acquire the original image and the special effect adding instruction inputted in the image special effect adding interface, respond to the special effect adding instruction and trigger the step of performing multi-level blurring processing on the original image to obtain blurred images with multiple blurring degrees; After the brightness of the brightness enhanced image is adjusted based on the brightness value of each pixel in the brightness enhanced image to obtain the target image, the method further includes: The original image input on the image special effect adding interface is updated to the target image.
8. An image processing device, characterized in that: include: A blurring unit, used for performing multi-level blurring processing on the original image to obtain blurred images with multiple blurring degrees; A fusion unit, configured to fuse the blurred images of the multiple blur levels to obtain a target blurred image for the original image; An enhancement unit, configured to perform brightness enhancement on the target blurred image using the original image to obtain a brightness enhanced image; The adjustment unit is used to adjust the brightness of the brightness enhanced image based on the brightness value of each pixel in the brightness enhanced image to obtain a target image.
9. A computer device, characterized in that: The method comprises a processor and a memory, wherein the memory is used to store a computer program, the computer program comprises program instructions, and the processor is configured to call the program instructions to execute the method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein the computer program includes program instructions, and when the program instructions are executed by a processor, the processor is caused to perform the method according to any one of claims 1 to 7.
