Image blur processing method, device, electronic device and storage medium
By upsampling and Gaussian blur processing on the to-process blur area in the image, the problem of complex image blur processing and consuming a large amount of computing resources in the prior art is solved, and an efficient and low resource consumption image blur processing effect is achieved.
Patent Information
- Application Number
- CN202410704367.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-03
- Publication Date
- 2025-03-25
- Estimated Expiration
- 2044-06-03
AI Technical Summary
The existing image blur processing methods are complex and consume a lot of computing resources, resulting in equipment performance degradation, lag or delay, which seriously affects the user experience.
By upsampling and blurring the to-process blur areas in the image, the texture map is obtained, and combined with Gaussian blurring, the target image is generated to reduce computing resource consumption.
It realizes efficient image blur processing, meets the needs of blurring to varying degrees, reduces computing resource consumption, ensures device performance, and improves user experience.
Smart Images

Figure CN118429181B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of vehicle technology, and specifically to an image blur processing method, device, electronic device and storage medium. Background Art
[0002] Image blur processing can be applied to scenarios such as interface background blur processing, blurring of ground reflective objects, and blur-based advanced bloom effects (full-screen floodlight effects). Some image blur processing methods are complex and consume a lot of computing resources, resulting in decreased performance of image blur processing equipment, and even freezes or delays, which seriously affect the user experience. Summary of the invention
[0003] In view of the above problems, embodiments of the present application provide an image blur processing method, device, electronic device and storage medium for reducing computing resources.
[0004] According to one aspect of an embodiment of the present application, a method for image blur processing is provided, comprising: performing upsampling blur processing on a blurred area to be blurred in an image to obtain a texture mapping image; performing Gaussian blur processing on the texture mapping image to obtain a Gaussian blur image; and generating a target image based on the Gaussian blur image and the image.
[0005] In an optional method, the upsampling and blurring of the blurred area to be blurred in the image to obtain a texture mapping map further includes: sampling the blurred area at different sizes to obtain multiple initial texture mapping maps corresponding to multiple levels, and the blurring strengths of the initial texture mapping maps at different levels are different; based on the multiple initial texture mapping maps corresponding to the multiple levels, determining the texture mapping map of the target level.
[0006] In an optional manner, determining the texture mapping map of the target level based on the multiple initial texture mapping maps corresponding to the multiple levels further includes: determining at least one level corresponding to the target level, the target level indicating one level among the multiple levels or indicating two adjacent levels among the multiple levels, and the multiple levels are arranged in sequence according to the size of the blur intensity; performing interpolation and mixing processing on the initial texture mapping map corresponding to the at least one level to obtain the texture mapping map of the target level.
[0007] In an optional manner, performing Gaussian blur processing on the texture map to obtain a Gaussian blurred image further includes: offsetting each pixel in the texture map by a preset offset toward a target direction after the first direction and the second direction are fused, to obtain the Gaussian blurred image.
[0008] In an optional manner, the Gaussian blur map corresponds to a preset offset of Gaussian blur processing, and the texture mapping map corresponds to a target level of upsampling blur processing; generating a target image based on the Gaussian blur map, the texture mapping map and the image further includes: fitting the preset offset and the target level based on a preset function, so as to fit the texture mapping map and the Gaussian blur map based on the preset function to obtain a target blur map; rendering and fusing the target blur map with the image to obtain the target image.
[0009] In an optional manner, before upsampling and blurring the blurred area to be blurred in the image to obtain a texture map, the method also includes: acquiring an initial image, and determining a reflected image corresponding to the initial image based on the initial image; using the reflected image and the initial image as the image, and using the reflected image as the blurred area of the image.
[0010] In an optional manner, determining the reflected image corresponding to the initial image based on the initial image further includes: taking a reflection plane as a symmetry center; determining the reflected image corresponding to the initial image based on the symmetry center, the initial image and the reflected image being symmetrical about the symmetry center.
[0011] According to another aspect of an embodiment of the present application, an image blur processing device is provided, including: a texture blur module, used to perform upsampling blur processing on a blurred area to be blurred in an image to obtain a texture mapping image; a Gaussian blur module, used to perform Gaussian blur processing on the blurred area to obtain a Gaussian blur image; an image blur module, used to generate a target image based on the Gaussian blur image, the texture mapping image and the image.
[0012] According to one aspect of an embodiment of the present application, an electronic device is provided, including: a controller; and a memory for storing one or more programs, which, when the one or more programs are executed by the controller, perform the above-mentioned image blur processing method.
[0013] According to one aspect of an embodiment of the present application, a computer-readable storage medium is further provided, on which computer-readable instructions are stored. When the computer-readable instructions are executed by a processor of a computer, the computer executes the above-mentioned image blurring processing method.
[0014] According to one aspect of the embodiments of the present application, a computer program product or a computer program is also provided, the computer program product or the computer program includes computer instructions, and the computer instructions are stored in a computer-readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device performs the above-mentioned image blurring processing method.
[0015] This application obtains a texture map through upsampling blur processing, supplemented by Gaussian blur, and uses two blur processing methods to blur the blurred area. This can meet the different degrees of blur requirements of the blurred area in the image, can efficiently perform image blur processing, and can reduce computing resources, ensure the performance of image blur processing equipment, and improve user experience.
[0016] The above description is only an overview of the technical solution of the present application. In order to more clearly understand the technical means of the present application, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present application more obvious and easy to understand, the specific implementation methods of the present application are listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] The drawings herein are incorporated into the specification and constitute a part of the specification, illustrate embodiments consistent with the present application, and are used together with the specification to explain the principles of the present application. Obviously, the drawings described below are only some embodiments of the present application, and for ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0018] Figure 1 It is an implementation scenario diagram shown in an exemplary embodiment of the present application.
[0019] Figure 2 It is a flowchart of an image blur processing method shown in an exemplary embodiment of the present application.
[0020] Figure 3 is a schematic diagram of an initial image shown in an exemplary embodiment of the present application.
[0021] Figure 4 It is a schematic diagram of an image shown in an exemplary embodiment of the present application.
[0022] Figure 5 It is a schematic diagram of processing the reflection effect of an initial image shown in an exemplary embodiment of the present application.
[0023] Figure 6 It is a schematic diagram of initial texture mapping images at different levels shown in an exemplary embodiment of the present application.
[0024] Figure 7It is a texture mapping diagram corresponding to different target levels shown in an exemplary embodiment of the present application.
[0025] Figure 8 It is a flowchart of Gaussian blur processing shown in an exemplary embodiment of the present application.
[0026] Fig. 9 It is a schematic diagram of a convolution kernel shown in an exemplary embodiment of the present application.
[0027] Fig.10 It is a schematic diagram of Gaussian blurred images obtained by different preset offsets shown in an exemplary embodiment of the present application.
[0028] Fig.11 It is a schematic diagram of a target blur map obtained with different blurs according to an exemplary embodiment of the present application.
[0029] Fig.12 is a schematic diagram of a target image shown in an exemplary embodiment of the present application.
[0030] Fig.13 is a schematic diagram of a target image shown in another exemplary embodiment of the present application.
[0031] Fig.14 It is a structural schematic diagram of an image blur processing device shown in an exemplary embodiment of the present application.
[0032] Fig.15 It is a structural diagram of a computer system of an electronic device shown in an exemplary embodiment of the present application. DETAILED DESCRIPTION
[0033] Here, exemplary embodiments will be described in detail, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are only examples of devices and methods consistent with some aspects of the present application as detailed in the attached claims.
[0034] The block diagrams shown in the accompanying drawings are merely functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities may be implemented in software form, or in one or more hardware modules or integrated circuits, or in different networks and / or processor devices and / or microcontroller devices.
[0035] The flowcharts shown in the accompanying drawings are only exemplary and do not necessarily include all the contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps can be decomposed, and some operations / steps can be combined or partially combined, so the actual execution order may change according to actual conditions.
[0036] The term "multiple" as used in this application refers to two or more than two. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the related objects are in an "or" relationship.
[0037] As a basic screen effect, blur effect can be applied to scenes such as UI (interface) background blur, blurring of ground reflective objects, and advanced bloom effects (full-screen floodlight effects) based on blur. However, image blur processing is often complicated and consumes a lot of computing resources, resulting in reduced server performance and even freezes or delays, especially in scenes where car computers perform image blur processing, such as the reflection effect of a 3D car model on the ground, which requires image blur processing. Another example is the intermediate state of the switching process between 3D car models, sandboxes, and wallpapers in the smart desktop. The previous interface uses a blur effect as the background, and the interface to be switched is reduced and centered as the foreground. Image blur processing also needs to be applied in the process. When freezes or delays occur, it will seriously affect the user experience.
[0038] For example, the Gaussian blur in image blur processing, its convolution-based algorithm requires a large number of sampling times, and sampling in the shader is a relatively time-consuming operation. Even if linear simplification is done, multiple iterations are required to obtain a good blur effect, and the number of sampling times will increase exponentially, increasing the load on the GPU (graphics processor). In addition, one blur iteration of the Gaussian blur requires two passes (channels), which is doubled by the number of iterations, directly leading to a large increase in the number of DrawCalls (CPU calls the image application programming interface), increasing CPU (central processing unit) consumption; resulting in the server being overwhelmed when only one blur effect is achieved. In addition, from the production point of view, since the image blur processing involves image capture in the terminal display interface, multiple image iterations and multi-pass calculations, the implementation of the blur effect is relatively complicated. If you want to apply the final blur effect to an object, you need an additional pass to mix it with the original rendering effect of the object, which is very inconvenient.
[0039] Please refer to Figure 1 , Figure 1This is an implementation scenario diagram shown in an exemplary embodiment of the present application, which includes a device and a server; wherein the terminal includes a display, which can be used for image display.
[0040] In some embodiments, the device is connected to the server in communication, and the image blurring processing device is disposed in the server. It can be understood that Figure 1 The number of terminals in the example is for reference only and in other embodiments, other numbers may be used.
[0041] In this embodiment, the terminal receives an image and sends the image to the server. After receiving the image from the terminal, the server performs upsampling and blurring on the blurred area to be blurred in the image to obtain a texture mapping image; performs Gaussian blurring on the texture mapping image to obtain a Gaussian blur image; and generates a target image based on the Gaussian blur image and the image.
[0042] In this embodiment, the terminal can be a computer, a mobile device, a vehicle-mounted terminal and other devices, and no specific restrictions are made here; the server can be an independent physical server, or it can be a server cluster or a distributed system composed of multiple physical servers, where multiple servers can form a blockchain, and the server is a node on the blockchain. The server can also be 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, CDN (Content Delivery Network) and big data and artificial intelligence platforms, and there is no restriction on this here.
[0043] Understandably, Figure 1 Although an implementation scenario diagram is shown, it is for illustrative purposes only. In other embodiments, there may be other implementation scenarios, which are not specifically limited here.
[0044] One aspect of the present application provides an image blur processing method. Figure 2 , Figure 2 is a flowchart of an image blur processing method shown in an exemplary embodiment of the present application. The image blur processing method can be applied to Figure 1 The server in the embodiment includes at least S210 to S230, which are described in detail as follows:
[0045] S210: Perform upsampling blur processing on the blurred area to be blurred in the image to obtain a texture map.
[0046] The texture mapping image in this embodiment is a multi-level progressively distant texture (Mipmap) image. Mipmap can be used to solve objects such as the ground or walls. When the distance between the far camera end and the near camera end is far, sampling the same map will cause distortion of the effect, and problems such as aliasing or even moiré will occur.
[0047] Mipmap is simply a series of texture images, which can be regarded as multiple levels of texture images. The latter texture image is half of the previous one. When we are far away from an object, we can sample textures of different sizes according to the distance to avoid distortion caused by sampling large textures with few display pixels.
[0048] In this embodiment, the blurred area in the image is blurred by upsampling through Mipmap setting.
[0049] It can be understood that the image in this embodiment can be an initial image, which is an image that has not been processed by the content in the image, such as an image obtained after shooting, and the blurred area can be a certain area in the initial image. The image can also be an image after the initial image is processed, and the blurred area is a certain area of the processed initial image. Processing the initial image may include performing reflection effect processing on the initial image, and the obtained image, such as Figure 3 : is a schematic diagram of an initial image shown. After the initial image is processed for reflection effect, the following image can be obtained: Figure 4 As shown in the image, the reflected image obtained by the reflection effect processing is symmetrical about the reflection plane in the image, and accordingly, the blurred area may be the reflection content of the initial image.
[0050] Of course, the above is exemplary only, and in actual use, the blurred area of any image can be blurred.
[0051] In some embodiments, taking an image as an example of an image after performing reflection effect processing on an initial image, at this time, the initial image is obtained, and a reflected image corresponding to the initial image is determined based on the initial image, the reflected image and the initial image are used as an image, and the reflected image is used as the blurred area of the image, and subsequently upsampling blur processing and Gaussian blur processing are performed on the reflected image.
[0052] In this embodiment, the reflection plane of the initial image is determined, and the reflection plane is used as the symmetry center. The reflection image corresponding to the initial image is determined based on the symmetry center. The initial image and the reflection image are symmetric about the symmetry center.
[0053] like Figure 5 , Figure 5The portion above the reflection plane in is the initial image, which can be regarded as an observation camera. By shooting, the initial image can be obtained, and the reflection plane, a reflection camera is set at a position corresponding to the observation camera. The reflection camera can capture the mirror image of the initial image, thereby obtaining a reflected image. The reflection camera and the observation camera are symmetrical based on the reflection plane. Figure 5 In the figure, the dotted arrows are the fields of view of the observation camera and the reflection camera, respectively.
[0054] It can be understood that the blurred area can be obtained by extracting the corresponding content in the image. For example, for an image, its size remains unchanged, and only the content of the blurred area is extracted. The content of the non-blurred area in the image can be filled with black, and then the image of the extracted blurred area is upsampled and blurred.
[0055] In some embodiments, the upsampling blurring process may include:
[0056] S10: Sampling the blurred area in different sizes to obtain a plurality of initial texture maps corresponding to a plurality of levels, wherein the initial texture maps at different levels have different blurring intensities.
[0057] S11: Determine a texture map of a target level based on a plurality of initial texture maps corresponding to a plurality of levels.
[0058] When browsing images on the screen, if the images are opened in the same size on the screen (such as full screen), the smaller the size of the image itself, the blurrier it will be on the screen. Therefore, through Mipmap, images of different sizes are sampled to obtain initial texture mapping maps corresponding to multiple levels. In these multiple levels, the blur intensity corresponding to different levels is different. For example, the higher the level, the greater the corresponding blur intensity. Figure 6 The initial texture map shown in Figure 6 In the figure, the first image is the blurred area that has not been upsampled, Mip1 corresponds to the first level, and correspondingly, Figure 6 9 levels are shown in FIG. 1 , where the ninth level corresponds to Mip9. The larger the level, the greater the blur intensity, and different blur intensities are obtained. Of course, the Figure 6 The figure can also be viewed as showing 10 levels, with the first figure being the zeroth level and the blur strength being zero.
[0059] Understandably, Figure 6Under each level of the initial texture map, there is a reflection of the parameters of the initial texture map, such as 154.7KB (kilobytes) is the size of the initial texture map of each level, 512×512 is the pixel size of the initial texture map, RGBA Compressed ASTC6×6 is a texture compression format, RGBA is a color model, and sRGB is a universal standard color gamut.
[0060] In some embodiments, when generating a RenderTexture for an image, the following code may be used to turn on the Mipmap of the image: textureName.useMipMap = true.
[0061] In one embodiment, after obtaining a plurality of initial texture maps corresponding to a plurality of levels, the texture map may be determined by setting a target level.
[0062] In some embodiments, determining the texture map may include:
[0063] S20: Determine at least one level corresponding to the target level, the target level indicates one level among multiple levels or indicates two adjacent levels among multiple levels, and the multiple levels are arranged in sequence according to the size of the blur intensity.
[0064] S21: performing interpolation and mixing processing on an initial texture map corresponding to at least one level to obtain a texture map of a target level.
[0065] In this embodiment, the target level lod is used to indicate the degree of detail of the displayed object at different distances or scales. Different target levels result in different texture mapping images. For example, if the target level is 2, it corresponds to the second level, and the initial texture mapping image corresponding to the second level Mip2 is used as the texture mapping image.
[0066] In some embodiments, the value of the target level actually used may be a decimal, that is, it does not directly correspond to a precise Mipmap level. Then, two adjacent levels may be determined according to the value of the target level. The multiple levels are arranged in sequence according to the blur intensity, such as from small to large, the sequence number corresponding to Mip1 is 1, the sequence number corresponding to Mip2 is 2, etc., which will not be elaborated here. Generally speaking, the two adjacent levels are the values closest to the value of the target level, that is, the value of the target level is between the sequence numbers corresponding to the two adjacent levels. For example, when the value of the target level is 2.5, Mip2 and Mip3 will be interpolated and mixed. At this point, the upsampling blurring process is completed using Mipmap. However, simply enlarging a small picture will have an obvious sense of blockiness, so other blur operators can also be used, such as the Gaussian blurring process proposed later, and then blurring again to reduce the sense of blockiness.
[0067] In this embodiment, the multiple levels are arranged in order from small to large according to the blur intensity. The higher the value of the target level, the higher the blur intensity. Figure 7 1 is a texture mapping diagram corresponding to different target levels shown in an exemplary embodiment of the present application, where the target levels from left to right are 1.25, 2.5 and 3.75 respectively.
[0068] In some embodiments, the initial texture maps of two adjacent levels can be interpolated and rendered by the following code: SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod), where lod is the target level.
[0069] S220: Perform Gaussian blur processing on the texture map to obtain a Gaussian blurred image.
[0070] The solution to blurring an image is to use the surrounding pixels to affect the current pixel to calculate a new color value. If the color value of the current pixel comes more from the surrounding pixels, it will be more blurred. Gaussian blur uses a square array that conforms to the normal distribution to correspond to the pixels in the square area around a pixel, and calculates the weighted average as the new color value.
[0071] like Figure 8 As shown, for a pixel with coordinates (1,1), it refers to surrounding pixels, the positions of which are as follows: Figure 8 , such as (0,1), (0,0), etc., through a Gaussian kernel, which is used as the contribution coefficient of the surrounding pixels of the pixel with coordinates (1,1), so that the value of the pixel with coordinates (1,1) after processing can be obtained.
[0072] Figure 8 The Gaussian sum shown in the figure corresponds to a pixel with coordinates (1,1) and the surrounding pixels of the pixel with coordinates (1,1). Figure 8 In the word a to i, refer to Fig. 9 , Fig. 9 is a schematic diagram of a convolution kernel shown in an exemplary embodiment of the present application, such as 0.0947416 corresponds to Figure 8 a in the equation is the contribution coefficient of the coordinate (2,2).
[0073] Therefore, in some embodiments, obtaining the Gaussian blur map may include:
[0074] S30: offset each pixel in the texture map by a preset offset amount toward a target direction after the first direction and the second direction are fused, to obtain a Gaussian blurred image.
[0075] In this embodiment, a preset Gaussian kernel is used to process the data of each pixel in the texture map to obtain a Gaussian blurred image. The preset Gaussian kernel can be Figure 8 The Gaussian kernel shown in may also be other Gaussian kernels without specific limitation. For each pixel point, the preset Gaussian kernel used is the same.
[0076] In this embodiment, the data processing process using the preset Gaussian kernel is to offset each pixel by a preset offset toward the target direction after the fusion of the first direction and the second direction, that is, the weighted average of the adjacent pixels of the pixel in the first direction and the second direction becomes the new value of the pixel, thereby obtaining a Gaussian blurred image.
[0077] Generally speaking, the larger the preset offset, the greater the blur.
[0078] The first direction may be regarded as a horizontal direction on the plane where the offset region is located, and the second direction may be regarded as a vertical direction on the plane where the offset region is located, and the first direction and the second direction are orthogonal to each other.
[0079] In this embodiment, compared with some Gaussian blur solutions that use one Pass for horizontal sampling offset and another Pass for vertical sampling offset, and then iterate multiple times, in this embodiment, the horizontal and vertical directions are integrated and the cross direction, that is, the target direction, is used for offset, so a single Pass completes the operation, reducing the CPU consumption caused by the blur.
[0080] S230: Generate a target image based on the Gaussian blur map, the texture map and the image.
[0081] In this embodiment, only a single blur is performed using a Gaussian kernel. When the offset distance is too large, ghosting will occur and high-intensity blurring cannot be achieved. Fig.10 Schematic diagram of Gaussian blurred images obtained by different preset offsets. Fig.10 In the example, only a single blur is performed using the Gaussian kernel. Fig.10 From left to right, the preset offsets are 0.004, 0.008, and 0.012. Fig.10 It can be seen that when the Gaussian kernel performs single blurring, ghosting will occur when the offset is larger, and high-intensity blurring cannot be achieved.
[0082] In this embodiment, the Gaussian blur map and the texture map can be fitted through a fitting relationship, so that the blurred area can be blurred smoothly and those combinations with jagged edges and ghosting can be avoided.
[0083] In some embodiments, generating the target image includes:
[0084] S40: Fitting a preset offset and a target level based on a preset function, so as to perform fitting processing on the texture mapping image and the Gaussian blur image based on the preset function to obtain a target blur image.
[0085] S50: Rendering and fusing the target blur map with the image to obtain a target image.
[0086] In this embodiment, the Gaussian blur map corresponds to a preset offset for Gaussian blur processing, and the texture mapping map corresponds to a target level for upsampling blur processing. A function is used to fit the relationship between the target level and the preset offset. When the target level and / or the preset offset are adjusted, the blurred area is also blurred by the preset function. The blurred area can be blurred smoothly to avoid combinations with jagged edges and ghosting. At the same time, the parameters can be made clear and can be encapsulated later. When using this method, the blurred area can be blurred by setting the value of the fitting target level and / or the preset offset, thereby improving the efficiency of image blur processing.
[0087] In this embodiment, through the preset function, the Gaussian blur map corresponding to the preset offset and the Gaussian blur map of the target level can be fitted to obtain the target blur map.
[0088] It can be understood that the preset function fitting can change the input of Gaussian blur processing and upsampling blur processing. Through the function fitting, the ghosting caused by a single Gaussian blur can be reduced. The preset function is a functional relationship between the target level and the preset offset, such as a relationship obtained by taking the target level as the dependent variable and the preset offset as the independent variable. The preset function can cause the texture map obtained by the upsampling blur processing to change, thereby changing the input of the Gaussian blur processing, and can also cause the output of the Gaussian blur to change, that is, the change of the Gaussian blur map. It can be understood that the change of the Gaussian blur map can be caused by the change of the texture map, or it can be caused by the preset function relationship. The changed Gaussian blur map can be regarded as the target blur map.
[0089] In one embodiment, the preset function may be a linear function or a nonlinear function, which is not specifically limited here.
[0090] In one embodiment, the preset function is:
[0091] float offset=_BlurIntensity*0.025;
[0092] float lod=1342773.5*(_Offset-0.016)*(_Offset-0.016)*(_Offset-0.016)+5.5.
[0093] Among them, _Offset is the target level, float is a floating point number, _BlurIntensity is the blurriness, and _BlurIntensity is a variable ranging from 0 to 1. When the value is 0, it is not blurred, and when the value is 1, it is the most blurred. Fig.11 is a schematic diagram of a target fuzzy map obtained by different fuzzinesses shown in an exemplary embodiment of the present application. Fig.11 In is the target fuzzy graph obtained based on the preset function. Fig.11 In the figure, other parameters remain unchanged, only _BlurIntensity is changed. From left to right, the blurriness is 0.1, 0.5 and 1 respectively. It can be seen that this method can cover different blur requirements and has good results.
[0094] It can be understood that the above-mentioned parameters such as 1342773.5 and 0.016 are for illustration only, and may be other parameters or preset functions in other ways in other embodiments, and no specific limitation is made here.
[0095] In this embodiment, the target blur map is rendered and fused with the image to obtain a target image. Under a preset function, different target levels and preset offsets result in different target images, and thus the target images after rendering and fusion are also different.
[0096] Taking the blurring of the reflection image obtained by the reflection effect as an example, Fig.12 and Fig.13 is a schematic diagram of a target image shown in an exemplary embodiment of the present application, Fig.12 The blur level of the medium blur area (reflected image) is less than Fig.13 The blur level of the medium blur area (reflected image).
[0097] In this embodiment, Gaussian blur processing only requires one Pass, and the rendering fusion between the target blurred image and the image obtained after the Gaussian blur processing usually also requires one Pass, and the output of the Gaussian blur processing is used as an output of the rendering fusion between the target blurred image and the image, so there is no conflict between the Pass of the Gaussian blur processing and the Pass operation of the rendering fusion between the target blurred image and the image, that is, the Gaussian blur processing and the rendering fusion between the target blurred image and the image can be completed in one Pass, which can reduce the occupancy of the Pass and reduce the CPU consumption. At the same time, the target blurred image and the area in the image where the rendering fusion is performed are not output by the blur operation, so the target blurred image can be fused with the original rendering of the image. For example, in a scene where the reflection image of the reflection effect is blurred, the target blurred image can be fused with the original rendering in the area where the reflection image is located, which can further reduce the CPU consumption caused by changing the rendering instructions, and the image blur processing process is more convenient, and there is no need to switch between multiple modules to complete the image blur processing.
[0098] In this embodiment, a method for image blurring is proposed. A texture map is obtained by upsampling blurring, and Gaussian blurring is used to blur the blurred area. The two blurring methods can meet the different blurring requirements of the blurred area in the image, and the performance is better and the use is more convenient. Specifically, the texture map is obtained by upsampling, which greatly reduces the number of map sampling times and reduces the performance consumption of the CPU and GPU. At the same time, Gaussian processing is performed on the texture map to control the blur operation in a single pass, thereby improving the efficiency of image blurring. The parameters in the upsampling blurring and Gaussian blurring are further fitted using a preset function to simplify the variables. Only the parameters can be changed later to complete the processing of different blur intensities in the blurred area, which is more convenient to operate.
[0099] Another aspect of the present application also provides an image blur processing device, such as Fig.14 As shown, Fig.14 FIG. 1 is a schematic diagram of a structure of an image blur processing device shown in an exemplary embodiment of the present application. The image blur processing device 1400 includes:
[0100] The texture blur module 1410 is used to perform up-sampling blur processing on the blurred area to be blurred in the image to obtain a texture map.
[0101] The Gaussian blur module 1430 is used to perform Gaussian blur processing on the texture map to obtain a Gaussian blurred image.
[0102] The image blur module 1450 is used to generate a target image based on the Gaussian blur map and the image.
[0103] In an optional manner, the texture blur module further includes:
[0104] The initial texture blurring unit is used to perform sampling processing of different sizes on the blurring area to obtain a plurality of initial texture maps corresponding to a plurality of levels, and the blurring strengths of the initial texture maps at different levels are different.
[0105] The texture map acquisition unit is used to determine the texture map of the target level based on the multiple initial texture maps corresponding to the multiple levels.
[0106] In an optional manner, the texture map acquisition unit further includes:
[0107] The level determination section is used to determine at least one level corresponding to the target level. The target level indicates one level among multiple levels or indicates two adjacent levels among multiple levels. The multiple levels are arranged in sequence according to the size of the fuzzy intensity.
[0108] The interpolation and mixing section is used to perform interpolation and mixing processing on the initial texture map corresponding to at least one level to obtain the texture map of the target level.
[0109] In an optional manner, the Gaussian blur module further includes:
[0110] The offset unit is used to offset each pixel in the texture map by a preset offset amount toward a target direction after the first direction and the second direction are fused, so as to obtain a Gaussian blurred image.
[0111] In an optional manner, the Gaussian blur map corresponds to a preset offset of the Gaussian blur processing, and the texture map corresponds to a target level of the upsampling blur processing; generating a target image based on the Gaussian blur map, the texture map and the image further includes:
[0112] The fitting unit is used to fit the preset offset and the target level based on a preset function, so as to fit the texture mapping image and the Gaussian blur image based on the preset function to obtain a target blur image.
[0113] The rendering unit is used to render and fuse the target fuzzy map with the image to obtain the target image.
[0114] In an optional manner, the image blur processing device further includes:
[0115] The reflection image acquisition module is used to acquire an initial image and determine a reflection image corresponding to the initial image based on the initial image.
[0116] The fuzzy area acquisition module is used to take the reflected image and the initial image as an image, and take the reflected image as the fuzzy area of the image.
[0117] In an optional manner, the reflection image acquisition module further includes:
[0118] The symmetry center acquisition unit is used to take the reflection plane as the symmetry center.
[0119] The reflected image acquisition unit is used to determine the reflected image corresponding to the initial image based on the symmetry center, and the initial image and the reflected image are symmetric about the symmetry center.
[0120] This embodiment obtains a texture map through upsampling blur processing, supplemented by Gaussian blur, and uses two blur processing methods to blur the blurred area, thereby meeting different degrees of blur requirements of the blurred area in the image, and has better performance and is more convenient to use.
[0121] It should be noted that the image blur processing device provided in the above embodiment and the image blur processing method provided in the above embodiment belong to the same concept, wherein the specific manner in which each module and unit performs operations has been described in detail in the method embodiment and will not be repeated here.
[0122] Another aspect of the present application provides an electronic device, including: a controller; a memory for storing one or more programs, when the one or more programs are executed by the controller, the above-mentioned image blur processing method is executed.
[0123] See also Fig.15 , Fig.15 1 is a schematic diagram of the structure of a computer system of an electronic device shown in an exemplary embodiment of the present application, which shows a schematic diagram of the structure of a computer system of an electronic device suitable for implementing an embodiment of the present application.
[0124] It should be noted that Fig.15 The computer system 1500 of the electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0125] like Fig.15As shown, the computer system 1500 includes a central processing unit (CPU) 1501, which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) 1502 or the program loaded from the storage part 1508 to the random access memory (RAM) 1503, such as executing the method in the above embodiment. In RAM 1503, various programs and data required for system operation are also stored. CPU 1501, ROM 1502 and RAM 1503 are connected to each other through bus 1504. Input / output (I / O) interface 1505 is also connected to bus 1504.
[0126] The following components are connected to the I / O interface 1505: an input section 1506 including a keyboard, a mouse, etc.; an output section 1507 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 1508 including a hard disk, etc.; and a communication section 1509 including a network interface card such as a LAN (Local Area Network) card, a modem, etc. The communication section 1509 performs communication processing via a network such as the Internet. A drive 1510 is also connected to the I / O interface 1505 as needed. A removable medium 1511, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 1510 as needed so that a computer program read therefrom is installed into the storage section 1508 as needed.
[0127] In particular, according to an embodiment of the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present application includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a computer program for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication section 1509, and / or installed from a removable medium 1511. When the computer program is executed by a central processing unit (CPU) 1501, various functions defined in the system of the present application are executed.
[0128] It should be noted that the computer-readable medium shown in the embodiment of the present application can be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium can be, for example, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media can include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a flash memory, an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, a computer-readable storage medium can be any tangible medium containing or storing a program, which can be used by an instruction execution system, device or device or used in combination with it. In the present application, a computer-readable signal medium can include a data signal propagated in a baseband or as a part of a carrier wave, wherein a computer-readable computer program is carried. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate, or transmit programs for use by or in conjunction with an instruction execution system, apparatus, or device. The computer program contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wired, etc., or any suitable combination of the above.
[0129] The flowchart and block diagram in the accompanying drawings illustrate the possible architecture, functions and operations of the system, method and computer program product according to various embodiments of the present application. Wherein, each box in the flowchart or block diagram can represent a module, a program segment, or a part of the code, and the above-mentioned module, program segment, or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order than the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flowchart, and the combination of boxes in the block diagram or flowchart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0130] The units involved in the embodiments described in this application may be implemented by software or hardware, and the units described may also be set in a processor. The names of these units do not, in some cases, constitute limitations on the units themselves.
[0131] Another aspect of the present application further provides a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, the vehicle light control method as described above is implemented. The computer-readable storage medium may be included in the electronic device described in the above embodiment, or may exist independently without being assembled into the electronic device.
[0132] Another aspect of the present application also provides a computer program product or a computer program, which 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 the processor executes the computer instructions, so that the computer device executes the vehicle light control method provided in each of the above embodiments.
[0133] According to one aspect of an embodiment of the present application, a computer system is also provided, including a central processing unit (CPU), which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) or a program loaded from a storage portion into a random access memory (RAM), such as executing the method in the above embodiment. In RAM, various programs and data required for system operation are also stored. CPU, ROM and RAM are connected to each other via a bus. An input / output (I / O) interface is also connected to the bus.
[0134] The following components are connected to the I / O interface: an input part including a keyboard, a mouse, etc.; an output part including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker; a storage part including a hard disk, etc.; and a communication part including a network interface card such as a LAN (Local Area Network) card, a modem, etc. The communication part performs communication processing via a network such as the Internet. A drive is also connected to the I / O interface as needed. Removable media, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., are installed on the drive as needed so that the computer program read therefrom is installed into the storage part as needed.
[0135] The above content is only a preferred exemplary embodiment of the present application and is not intended to limit the implementation scheme of the present application. A person skilled in the art can easily make corresponding changes or modifications based on the main concept and spirit of the present application. Therefore, the scope of protection of the present application shall be based on the scope of protection required by the claims.
Claims
1. A method for image blurring, characterized in that: include: Performing upsampling blur processing on the blurred area to be blurred in the image to obtain a texture map; Performing Gaussian blur processing on the texture map to obtain a Gaussian blurred image; Generating a target image based on the Gaussian blur image and the image; performing Gaussian blur processing on the texture map to obtain the Gaussian blur image further includes: offsetting each pixel in the texture map by a preset offset amount toward a target direction after the first direction and the second direction are fused, to obtain the Gaussian blur map, wherein the first direction and the second direction are orthogonal; The Gaussian blur map corresponds to a preset offset of Gaussian blur processing, and the texture map corresponds to a target level of upsampling blur processing; and generating a target image based on the Gaussian blur map and the image further includes: Fitting the preset offset and the target level based on a preset function, so as to perform fitting processing on the texture mapping image and the Gaussian blur image based on the preset function to obtain a target blur image; The target blur map is rendered and fused with the image to obtain the target image.
2. The method according to claim 1, characterized in that: The step of performing upsampling blur processing on the blurred area to be blurred in the image to obtain a texture map further comprises: Sampling the blurred area in different sizes to obtain a plurality of initial texture maps corresponding to a plurality of levels, wherein the initial texture maps at different levels have different blur strengths; A texture map of a target level is determined based on a plurality of initial texture maps corresponding to the plurality of levels.
3. The method according to claim 2, characterized in that The step of determining a texture map of a target level based on a plurality of initial texture maps corresponding to the plurality of levels further comprises: Determine at least one level corresponding to the target level, the target level indicates one level among the multiple levels or indicates two adjacent levels among the multiple levels, and the multiple levels are arranged in sequence according to the magnitude of blur strength; An interpolation and mixing process is performed on the initial texture map corresponding to the at least one level to obtain the texture map of the target level.
4. The method according to any one of claims 1 to 3, characterized in that Before performing upsampling blur processing on the blurred area to be blurred in the image to obtain the texture map, the method further includes: Acquire an initial image, and determine a reflected image corresponding to the initial image based on the initial image; The reflected image and the initial image are used as the image, and the reflected image is used as a blurred area of the image.
5. The method according to claim 4, characterized in that The determining, based on the initial image, a reflected image corresponding to the initial image, further comprises: The reflection plane is taken as the center of symmetry; A reflected image corresponding to the initial image is determined based on the symmetry center, and the initial image and the reflected image are symmetrical about the symmetry center.
6. An image blur processing device, characterized in that: include: A texture blur module is used to perform upsampling blur processing on the blurred area to be blurred in the image to obtain a texture map; A Gaussian blur module, used for performing Gaussian blur processing on the texture map to obtain a Gaussian blurred image; An image blur module, used for generating a target image based on the Gaussian blur map and the image; the Gaussian blur map corresponds to a preset offset of Gaussian blur processing, and the texture map corresponds to a target level of upsampling blur processing; Gaussian blur module, further comprising: An offset unit, configured to offset each pixel in the texture map by a preset offset amount toward a target direction after the first direction and the second direction are fused, so as to obtain the Gaussian blur map, wherein the first direction and the second direction are orthogonal; The image blur module further comprises: A fitting unit, used for fitting a preset offset and a target level based on a preset function, so as to perform fitting processing on the texture mapping image and the Gaussian blur image based on the preset function to obtain a target blur image; The rendering unit is used to render and fuse the target fuzzy map with the image to obtain the target image.
7. An electronic device, characterized in that: include: Controller; A memory for storing one or more programs, which, when executed by a controller, enables the controller to implement the method according to any one of claims 1 to 5.
8. A computer-readable storage medium, characterized in that: Computer-readable instructions are stored thereon, and when the computer-readable instructions are executed by a processor of a computer, the computer is caused to execute the method according to any one of claims 1 to 5.
Citation Information
Patent Citations
Image processing method and device, electronic equipment and storage medium
CN114140568A
Fuzzy processing method and device
CN114820374A