Fuzzy processing method and device
By creating a reduced image during Gaussian blur processing and determining the sampling offset of the target image, the problems of high computational cost and low efficiency of Gaussian blur processing are solved, and more efficient blurred image generation is achieved.
Patent Information
- Application Number
- CN202210462624.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-28
- Publication Date
- 2025-09-05
- Estimated Expiration
- 2042-04-28
AI Technical Summary
In the existing technology, Gaussian blur processing requires increasing the number of Gaussian kernels to fill the space, resulting in high computational cost and low efficiency.
By acquiring the initial image, creating a reduced image of the corresponding blur level, and determining the target image and its sampling offset according to the preset blur information and pixel information, blurring the target image based on the sampling offset to generate a blurred image.
The number of sampling times is reduced, the efficiency of fuzzy processing is improved, and the calculation cost is reduced.
Smart Images

Figure CN114820374B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of image processing technology, and in particular to a fuzzy processing method and apparatus, a computing device, and a computer-readable storage medium. Background Art
[0002] In practical applications, Gaussian blurring is often used to blur images. To achieve a higher degree of blur, increasing the number of Gaussian kernels is necessary to fill the uncovered space. This results in a higher number of sampling cycles for the image being sampled. This leads to high computational costs and low efficiency for blurring. Therefore, a technical solution to this problem is urgently needed. Summary of the Invention
[0003] In view of this, embodiments of the present application provide a fuzzy processing method and apparatus, a computing device, and a computer-readable storage medium to address the technical deficiencies in the prior art.
[0004] According to a first aspect of an embodiment of the present application, a fuzzy processing method is provided, comprising:
[0005] Get the initial image;
[0006] Based on the initial image, creating a reduced image corresponding to the blur level;
[0007] Determining a target image in the reduced image and a sampling offset of the target image in a pixel dimension according to preset blur information and pixel information of the initial image data;
[0008] The target image is blurred based on the sampling offset to generate a blurred image corresponding to the initial image.
[0009] Optionally, determining the target image in the reduced image and determining a sampling offset of the target image in a pixel dimension according to preset blur information and pixel information of the initial image data includes:
[0010] Calculating a target blur level according to preset blur information and pixel information of the initial image;
[0011] screening a target image from the reduced image according to the target blur level;
[0012] A sampling offset of the target image in a pixel dimension is determined according to the preset blur information.
[0013] Optionally, the calculating the target blur level according to the preset blur information and the pixel information of the initial image includes:
[0014] The pixel information of the initial image, the blur parameters in the preset blur information, and the number of Gaussian kernels are input into the blur level algorithm in the preset blur information for calculation to obtain a target blur level.
[0015] Optionally, determining a sampling offset of the target image in a pixel dimension according to the preset blur information includes:
[0016] Determining sampling pixels and a central pixel in the target image based on the number of Gaussian kernels in the preset blur information and position information of pixels in the target image;
[0017] The number of Gaussian kernels is input into the sampling offset algorithm in the preset blur information for calculation to obtain the sampling offset of the sampling pixel point from the central pixel point.
[0018] Optionally, the blurring the target image based on the sampling offset to generate a blurred image corresponding to the initial image includes:
[0019] Determining sampling weights of sampling pixels in the target image according to the sampling offset;
[0020] A blurred image corresponding to the initial image is generated based on the sampling weight, the sampling offset, position information of sampling pixels in the target image, and pixel values.
[0021] Optionally, generating the blurred image corresponding to the initial image based on the sampling weight, the sampling offset, position information of sampling pixels in the target image, and pixel values includes:
[0022] Performing weighted averaging based on the sampling weights, the sampling offsets, the position information of the sampling pixels in the target image, and the pixel values to obtain target pixel values of the plurality of target pixels;
[0023] By combining the target pixel values, a blurred image corresponding to the initial image is generated.
[0024] Optionally, obtaining the initial image includes:
[0025] Get preset rendering stage information;
[0026] The initial image corresponding to the rendering stage information is obtained through the rendering component.
[0027] Optionally, determining the target image in the reduced image and determining a sampling offset of the target image in a pixel dimension according to preset blur information and pixel information of the initial image data includes:
[0028] Determining mesh information of the material in the initial image;
[0029] Writing the preset fuzzy information into the vertex information in the mesh information to obtain updated vertex information;
[0030] The updated vertex information is passed into a shader for calculation and processing, thereby determining a target image in the reduced image and determining a sampling offset of the target image in a pixel dimension.
[0031] Optionally, creating a reduced image corresponding to a blur level based on the initial image includes:
[0032] determining at least one blur level according to preset reduction information and size information of the initial image;
[0033] The initial image is reduced according to the preset reduction information to obtain a reduced image corresponding to the blur level.
[0034] According to a second aspect of an embodiment of the present application, a fuzzy processing device is provided, comprising:
[0035] an acquisition module, configured to acquire an initial image;
[0036] a creating module configured to create a reduced image corresponding to a blur level based on the initial image;
[0037] a determination module configured to determine a target image in the reduced image and determine a sampling offset of the target image in a pixel dimension based on preset blur information and pixel information of the initial image data;
[0038] The generating module is configured to perform blur processing on the target image based on the sampling offset to generate a blurred image corresponding to the initial image.
[0039] According to a third aspect of an embodiment of the present application, a computing device is provided, comprising a memory, a processor, and computer instructions stored in the memory and executable on the processor, wherein the processor implements the steps of the fuzzy processing method when executing the computer instructions.
[0040] According to a fourth aspect of an embodiment of the present application, a computer-readable storage medium is provided, which stores computer instructions. When the computer instructions are executed by a processor, the steps of the fuzzy processing method are implemented.
[0041] In this embodiment of the present application, an initial image is obtained and, based on the initial image, a reduced image of a corresponding blur level is created. A target image within the reduced image and a sampling offset for the target image in the pixel dimension are determined based on preset blur information and pixel information of the initial image data. The target image is blurred based on the sampling offset to generate a blurred image corresponding to the initial image. This allows the reduced image to be used as the image to be sampled for blurring, thereby avoiding an increase in the number of sampling times and ensuring efficient blurring. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] Figure 1 is a structural block diagram of a computing device provided in one embodiment of the present application;
[0043] Figure 2 This is a flowchart of a fuzzy processing method provided by an embodiment of the present application;
[0044] Figure 3 This is a processing flow chart of a fuzzy processing method applied to a UI provided by an embodiment of the present application;
[0045] Figure 4 It is a structural diagram of a fuzzy processing device provided in one embodiment of the present application. DETAILED DESCRIPTION
[0046] The following description sets forth many specific details to facilitate a thorough understanding of the present application. However, the present application can be implemented in many other ways than those described herein, and those skilled in the art can make similar generalizations without violating the scope of the present application. Therefore, the present application is not limited to the specific implementations disclosed below.
[0047] The terms used in one or more embodiments of the present application are for the purpose of describing specific embodiments only and are not intended to limit one or more embodiments of the present application. The singular forms "a", "the" and "the" used in one or more embodiments of the present application and the appended claims are also intended to include plural forms, unless the context clearly indicates otherwise. It should also be understood that the term "and / or" used in one or more embodiments of the present application refers to and includes any or all possible combinations of one or more associated listed items.
[0048] It should be understood that although the terms first, second, etc. may be used to describe various information in one or more embodiments of the present application, such information should not be limited to these terms. These terms are only used to distinguish information of the same type from each other. For example, without departing from the scope of one or more embodiments of the present application, the first may also be referred to as the second, and similarly, the second may also be referred to as the first. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".
[0049] In this application, a fuzzy processing method and apparatus, a computing device, and a computer-readable storage medium are provided, which are described in detail one by one in the following embodiments.
[0050] Figure 1 1 shows a block diagram of a computing device 100 according to an embodiment of the present application. Components of the computing device 100 include, but are not limited to, a memory 110 and a processor 120. The processor 120 is connected to the memory 110 via a bus 130, and a database 150 is used to store data.
[0051] The computing device 100 also includes an access device 140 that enables the computing device 100 to communicate via one or more networks 160. Examples of these networks include a public switched telephone network (PSTN), a local area network (LAN), a wide area network (WAN), a personal area network (PAN), or a combination of communication networks such as the Internet. The access device 140 may include one or more of any type of network interface (e.g., a network interface card (NIC)), whether wired or wireless, such as an IEEE 802.11 wireless local area network (WLAN) wireless interface, a Worldwide Interoperability for Microwave Access (Wi-MAX) interface, an Ethernet interface, a universal serial bus (USB) interface, a cellular network interface, a Bluetooth interface, a near field communication (NFC) interface, and the like.
[0052] In one embodiment of the present application, the above components of the computing device 100 and Figure 1 Other components not shown in the figure may also be connected to each other, for example, via a bus. Figure 1 The computing device structure block diagram shown is for illustrative purposes only and is not intended to limit the scope of the present application. Those skilled in the art may add or replace other components as needed.
[0053] The computing device 100 may be any type of stationary or mobile computing device, including a mobile computer or mobile computing device (e.g., a tablet computer, a personal digital assistant, a laptop computer, a notebook computer, a netbook computer, etc.), a mobile phone (e.g., a smartphone), a wearable computing device (e.g., a smartwatch, smart glasses, etc.), or other types of mobile devices, or a stationary computing device such as a desktop computer or PC. The computing device 100 may also be a mobile or stationary server.
[0054] The processor 120 may execute Figure 2 The steps in the obfuscation method shown. Figure 2 A flowchart of a fuzzy processing method according to an embodiment of the present application is shown, which specifically includes the following steps:
[0055] Step 202: Acquire an initial image.
[0056] Specifically, the initial image refers to the image to be blurred. The initial image can be of any type, format (e.g., jpg, bmp, png, etc.), or content. For example, the initial image can be a user interface (UI), game image, background image, abstract image, or any other type of image. It can also be a landscape image, a person image, an animated image, an animal image, or any other content, without limitation.
[0057] The blur processing method provided in this application can perform sampling on the basis of reducing the image, thereby reducing the number of sampling times and improving the efficiency of blur processing.
[0058] In specific implementation, there are various ways to obtain the initial image, such as obtaining an initial image uploaded by a user, downloading an initial image from the network, or obtaining it through screen capture. However, in this case, the initial image is usually a rendered image. In order to expand the scope of application of the blur processing of this application, in the embodiment of this application, obtaining the initial image is specifically achieved by the following method:
[0059] Get preset rendering stage information;
[0060] The initial image corresponding to the rendering stage information is obtained through the rendering component.
[0061] The preset rendering stage information refers to information that identifies a rendering stage. This rendering stage information can be a number or a specific stage name, without limitation. In practical applications, rendering stages can include "before transparency" and "after post-processing." The rendering component can capture the desired image at different rendering stages.
[0062] The rendering component performs real-time rendering. Its function is to generate or render a 2D image given scene elements such as a virtual camera, 3D scene objects, and light sources. In practice, this rendering component can be a custom rendering pipeline.
[0063] For example, if the preset rendering stage information submitted by the user is 6, the image corresponding to 6 in the rendering queue is obtained through the custom pipeline as the initial image.
[0064] In summary, by obtaining an image at a certain rendering stage as an initial image through a rendering component, the image data in the rendering process can be blurred, thereby increasing the applicability of the blurring process.
[0065] Step 204: Based on the initial image, create a reduced image corresponding to the blur level.
[0066] Specifically, based on the initial image obtained above, considering that directly blurring the initial image may require a high computational cost, in order to reduce the computational cost, a reduced image with a corresponding blur level can be created and the blurring can be performed on the reduced image.
[0067] The blur level refers to information indicating the degree of blur, and can be a positive integer. In a specific implementation, a larger blur level indicates a higher degree of blur and a smaller corresponding reduced image size. Furthermore, a smaller blur level indicates a lower degree of blur and a larger corresponding reduced image size.
[0068] Correspondingly, a reduced image refers to an image obtained by reducing the original image. In practical applications, each blur level can correspond to a reduced image. For example, if the resolution of the original image is 1024*1024 and the original image corresponds to blur level 0, then the reduced image resolution corresponding to blur level 1 is 512*512.
[0069] Furthermore, the creation of a reduced image corresponding to the blur level based on the initial image is specifically achieved by:
[0070] determining at least one blur level according to preset reduction information and size information of the initial image;
[0071] The initial image is reduced according to the preset reduction information to obtain a reduced image corresponding to the blur level.
[0072] The preset reduction information refers to information pre-set to describe the reduction situation. Specifically, the preset reduction information can be a reduction rule, such as reducing the initial image by a multiple of 2 (e.g., 2x, 4x, 8x, etc.), or reducing the initial image by a multiple of 3. Size information refers to information describing the size of the initial image. This size information can be resolution information, length, width, etc., without limitation.
[0073] In practical applications, the number of iterative reductions based on the initial image can be determined based on the preset reduction information and the size of the initial image. For example, if the initial image resolution is 1024 and the preset reduction information is to reduce the image by a factor of 2, then the initial image can be reduced 10 times according to this reduction information, resulting in 10 blur levels.
[0074] Based on this, the initial image can be further reduced according to the preset reduction information to obtain at least one reduced image, the size of which is half, one quarter, etc. of the size of the initial image.
[0075] For example, the initial image is a UI with a resolution of 1024*1024. If the preset reduction information is to reduce the UI by a multiple of 2 (e.g., 2x, 4x, 8x, etc.), it is determined that there are 10 blur levels (1-10), and the UI is reduced by a multiple of 2, obtaining reduced images with resolutions of 512*512, 256*256, 128*128, 64*64, 32*32, 16*16, 8*8, 4*4, 2*2, and 1*1, respectively. A reduced image with a resolution of 512*512 corresponds to blur level 1, a reduced image with a resolution of 128*128 corresponds to blur level 2, and so on, a reduced image with a resolution of 1*51 corresponds to blur level 10.
[0076] It should be noted that, in actual applications, there may also be a blur level corresponding to the initial image, for example, the blur level corresponding to the initial image is set to 0.
[0077] In summary, at least one blur level is determined based on the preset reduction information and the size information of the initial image, and the initial image is reduced according to the preset reduction information to obtain a reduced image corresponding to each blur level. This achieves the goal of obtaining reduced images corresponding to various blur levels by reducing the initial image, so that the most suitable reduced image for sampling can be selected according to the degree of blur.
[0078] Step 206: Determine a target image in the reduced image and a sampling offset of the target image in a pixel dimension according to the preset blur information and the pixel information of the initial image data.
[0079] Specifically, based on creating a reduced image of a corresponding blur level, considering the need to accurately implement processing of a specific blur level and reduce the number of sampling times, it is necessary to determine the target image to be sampled in the reduced image and the sampling offset of the target image.
[0080] Among them, the preset blur information refers to the blur information pre-set to determine the target image and sampling offset. Specifically, the preset blur information can be blur parameters, the correspondence between preset blur parameters and blur levels, the correspondence between preset blur parameters and sampling offsets, and other information, which is not limited here.
[0081] The blur parameter is a parameter used to indicate the degree of blur. It can take any value or integer between 0 and 1. A larger blur parameter indicates a greater degree of blur. The sampling offset is the distance between the pixel to be sampled and the center point.
[0082] In the embodiment of the present application, determining the target image in the reduced image and determining the sampling offset of the target image in the pixel dimension based on the preset blur information and the pixel information of the initial image data are specifically implemented through the following steps 2062 to 2066:
[0083] Step 2062: Calculating a target blur level according to the preset blur information and the pixel information of the initial image;
[0084] The target blur level refers to the blur level corresponding to the reduced image to be sampled.
[0085] In a specific implementation, in an embodiment of the present application, the target blur level is calculated based on the preset blur information and the pixel information of the initial image, which is achieved by:
[0086] The pixel information of the initial image, the blur parameters in the preset blur information, and the number of Gaussian kernels are input into the blur level algorithm in the preset blur information for calculation to obtain a target blur level.
[0087] The pixel information of the initial image can be the pixel width or pixel length of the initial image. The number of Gaussian kernels refers to the size of the convolution kernel used for Gaussian blurring, i.e., the number of Gaussian kernels. For example, for a 3*3 Gaussian kernel, the number of Gaussian kernels is 3, and for a 7*7 Gaussian kernel, the number of Gaussian kernels is 7. The blur level algorithm refers to the algorithm used to calculate the target blur level.
[0088] In specific implementation, the blur level algorithm may be: target blur level = ceil(max(0.0, log2(mapping coefficient*blur parameter*number of screen pixels in vertical direction*float(number of Gaussian kernels)))).
[0089] For example, when the blur parameter is 0.6 and the number of Gaussian kernels is 7, the target blur level = ceil(max(0.0, log2(0.01*0.6*1024*7)) = ceil(max(0.0, log2(43.008)) = 6.
[0090] Step 2064: Filter a target image in the reduced image according to the target blur level.
[0091] The target image refers to the reduced image corresponding to the target blur level, that is, the reduced image to be sampled.
[0092] Continuing with the above example, based on the target blur level of 6, a 16*16 target image with a target blur level of 6 is selected from the reduced image.
[0093] Step 2066: Determine the sampling offset of the target image in the pixel dimension according to the preset blur information.
[0094] In a specific implementation, the determining of the sampling offset of the target image in the pixel dimension according to the preset blur information is specifically achieved by the following method:
[0095] Determining sampling pixels and a central pixel in the target image based on the number of Gaussian kernels in the preset blur information and position information of pixels in the target image;
[0096] The number of Gaussian kernels is input into the sampling offset algorithm in the preset blur information for calculation to obtain the sampling offset of the sampling pixel point from the central pixel point.
[0097] The pixel position information can be pixel position information or UV position information, etc., and is not limited here. The sampling pixels can be understood as the pixels mapped by the Gaussian kernel corresponding to the number of Gaussian kernels in the target image. Correspondingly, the center pixel refers to the center point of a group of sampling pixels. In practical applications, since the Gaussian kernel is constantly moving during the convolution operation on the target image, after each movement, the Gaussian kernel corresponds to a new set of sampling pixels and center pixels.
[0098] The sampling offset algorithm refers to an algorithm used to calculate the sampling offset.
[0099] Specifically, for any set of sampling pixel points and sampling center point, the sampling offset algorithm can be: sampling offset = float2(k% number of Gaussian kernels, k / number of Gaussian kernels) / (float(number of Gaussian kernels-1) / 2)-float(1.0, 1.0), where k is a positive integer, 0<=k<the square of the number of Gaussian kernels, k++.
[0100] Continuing with the above example, when the number of Gaussian kernels is 7, the value range of k is 0-48; when k=0, sampling offset=float2(0%7, 0 / 7) / 3-float(1.0, 1.0)=float2(0, 0) / 3-float2(1.0, 1.0)=float2(0, 0)-float2(1.0, 1.0)=float2(-1, -1), and so on, 48 sampling offsets with k values of 1-48 are calculated respectively.
[0101] In summary, the sampling offset of the sampling pixel point from the center pixel point is calculated by the number of Gaussian kernels, which ensures that the sampling offset of the target image is determined when the number of Gaussian kernels remains unchanged, that is, the number of sampling times remains unchanged. This effectively avoids the problem of higher sampling times as the degree of blur increases in traditional Gaussian blur, and greatly improves the blurring efficiency.
[0102] In practical applications, considering that an application may involve multiple images, some of which may sample the same material but require these materials to exhibit different blur levels. In order to avoid generating separate materials for different blur levels, in an embodiment of the present application, the target image in the reduced image and the sampling offset of the target image in the pixel dimension are determined based on the preset blur information and the pixel information of the initial image data, which are specifically achieved as follows:
[0103] Determining mesh information of the material in the initial image;
[0104] Writing the preset fuzzy information into the vertex information in the mesh information to obtain updated vertex information;
[0105] The updated vertex information is passed into a shader for calculation and processing, thereby determining a target image in the reduced image and determining a sampling offset of the target image in a pixel dimension.
[0106] Specifically, a material refers to a data set that represents an object's interaction with light and is read by the renderer. This data includes maps, textures, and lighting algorithms. In this embodiment, by writing preset blur information into vertex information and using a shader to determine the target image and sampling offset, it is possible to achieve multiple degrees of blur processing for a single material, avoiding the need to generate multiple materials. This saves storage space.
[0107] Step 208: Blurring the target image based on the sampling offset to generate a blurred image corresponding to the initial image.
[0108] Specifically, based on the above determination of the target image and the sampling offset, the target image may be blurred based on the sampling offset, thereby generating a blurred image.
[0109] Here, the blurred image refers to a blurred image generated after blurring.
[0110] In a specific implementation, blurring the target image based on the sampling offset to generate a blurred image corresponding to the initial image is specifically implemented through the following steps 2082 to 2084;
[0111] Step 2082: Determine the sampling weights of the sampled pixels in the target image according to the sampling offset;
[0112] Step 2084: Generate a blurred image corresponding to the initial image based on the sampling weight, the sampling offset, the position information of the sampling pixel points in the target image, and the pixel values.
[0113] Furthermore, generating a blurred image corresponding to the initial image based on the sampling weight, the sampling offset, the position information of the sampling pixel points in the target image, and the pixel values includes:
[0114] Performing weighted averaging based on the sampling weights, the sampling offsets, the position information of the sampling pixels in the target image, and the pixel values to obtain target pixel values of the plurality of target pixels;
[0115] By combining the target pixel values, a blurred image corresponding to the initial image is generated.
[0116] In practical applications, the weight of the sampling pixel point can be calculated according to a weight calculation formula. Specifically, the weight calculation formula can be: w = exp2 (-2.0*dot (sampling offset, sampling offset)).
[0117] When the sampling offset is (-1, -1), the weight w0 of the sampling pixel point corresponding to the sampling offset is = exp2*dot(float(-1, -1), float(-1, -1)) = exp2*(-2.0*2) = 1 / 16 = 0.0625. Similarly, the weights of the sampling pixel points corresponding to the other 48 sampling offsets are calculated as w1...w48.
[0118] Based on the r values of the 49 sampling pixels mapped by the Gaussian kernel in the 16*16 target image and the weights of these 49 sampling pixels, the R value of the pixel point p0 in the blurred image is calculated, R = (r0*0.0625+r1*w1+……+r48*w48) / (w0+w1+……+w48). The G value and B value of the pixel point p0 are calculated based on the same principle.
[0119] Furthermore, by moving the Gaussian kernel, the pixel value of pixel point p1 in the blurred image is calculated using the pixel values of another group of 49 sampling pixels corresponding to the moved Gaussian kernel and the weights of these 49 sampling pixels. Similarly, the pixel values of all pixels in the blurred image are calculated.
[0120] The blur processing method provided in the embodiments of the present application obtains an initial image and, based on the initial image, creates a reduced image with a corresponding blur level. The method then determines a target image within the reduced image and a sampling offset for the target image in the pixel dimension based on preset blur information and pixel information of the initial image data. The target image is then blurred based on the sampling offset to generate a blurred image corresponding to the initial image. This method uses the reduced image as the image to be sampled for blur processing, thereby avoiding an increase in the number of sampling times and ensuring the efficiency of the blur processing.
[0121] The following combined Figure 3 , taking the application of the blur processing method provided by this application in UI images as an example, the blur processing method is further explained. Figure 3 A flowchart of a blur processing method applied to a UI image provided by an embodiment of the present application is shown, which specifically includes the following steps:
[0122] Step 302: Obtain preset rendering stage information.
[0123] Step 304: Obtain the UI image corresponding to the rendering stage information through the rendering component.
[0124] Step 306: Determine at least one blur level according to the preset reduction information and the size information of the UI image.
[0125] Step 308: performing reduction processing on the UI image according to the preset reduction information to obtain a reduced image corresponding to the blur level.
[0126] Step 310: Input pixel information of the UI image, blur parameters in the preset blur information, and the number of Gaussian kernels into the blur level algorithm in the preset blur information for calculation to obtain a target blur level.
[0127] Step 312: Filter the target image in the reduced image according to the target blur level.
[0128] Step 314: Based on the number of Gaussian kernels in the preset blur information and the position information of the pixels in the target image, determine the sampling pixels and the center pixel in the target image.
[0129] Step 316: Input the number of Gaussian kernels into the sampling offset algorithm in the preset blur information for calculation to obtain the sampling offset of the sampling pixel point from the center pixel point.
[0130] Step 318: Determine the sampling weights of the sampled pixels in the target image according to the sampling offset.
[0131] Step 320: performing weighted averaging based on the sampling weight, the sampling offset, the position information of the sampling pixels in the target image, and the pixel values to obtain target pixel values of the multiple target pixels.
[0132] Step 322: Generate a blurred image corresponding to the UI image by combining the target pixel values.
[0133] The blur processing method provided in the embodiments of the present application obtains an initial image and, based on the initial image, creates a reduced image with a corresponding blur level. The method then determines a target image within the reduced image and a sampling offset for the target image in the pixel dimension based on preset blur information and pixel information of the initial image data. The target image is then blurred based on the sampling offset to generate a blurred image corresponding to the initial image. This method uses the reduced image as the image to be sampled for blur processing, thereby avoiding an increase in the number of sampling times and ensuring the efficiency of the blur processing.
[0134] Corresponding to the above method embodiment, the present application also provides a fuzzy processing device embodiment, Figure 4 FIG. 1 shows a schematic diagram of the structure of a fuzzy processing device provided by an embodiment of the present application. Figure 4 As shown, the device includes:
[0135] An acquisition module 402 is configured to acquire an initial image;
[0136] A creation module 404 is configured to create a reduced image corresponding to a blur level based on the initial image;
[0137] A determination module 406 is configured to determine a target image in the reduced image and determine a sampling offset of the target image in a pixel dimension based on preset blur information and pixel information of the initial image data;
[0138] The generating module 408 is configured to perform blur processing on the target image based on the sampling offset to generate a blurred image corresponding to the initial image.
[0139] Optionally, the determining module 406 includes:
[0140] a calculation submodule, configured to calculate a target blur level according to preset blur information and pixel information of the initial image;
[0141] a screening submodule, configured to screen a target image from the reduced image according to the target blur level;
[0142] The determination submodule is configured to determine a sampling offset of the target image in a pixel dimension according to the preset blur information.
[0143] Optionally, the calculation submodule is further configured to:
[0144] The pixel information of the initial image, the blur parameters in the preset blur information, and the number of Gaussian kernels are input into the blur level algorithm in the preset blur information for calculation to obtain a target blur level.
[0145] Optionally, the determining submodule is further configured to:
[0146] Determining sampling pixels and a central pixel in the target image based on the number of Gaussian kernels in the preset blur information and position information of pixels in the target image;
[0147] The number of Gaussian kernels is input into the sampling offset algorithm in the preset blur information for calculation to obtain the sampling offset of the sampling pixel point from the central pixel point.
[0148] Optionally, the generating module 408 includes:
[0149] a weight determination submodule, configured to determine a sampling weight of a sampling pixel point in the target image according to the sampling offset;
[0150] The generating submodule is configured to generate a blurred image corresponding to the initial image based on the sampling weight, the sampling offset, the position information of the sampling pixel points in the target image, and the pixel values.
[0151] Optionally, the generating submodule is further configured to:
[0152] Performing weighted averaging based on the sampling weights, the sampling offsets, the position information of the sampling pixels in the target image, and the pixel values to obtain target pixel values of the plurality of target pixels;
[0153] By combining the target pixel values, a blurred image corresponding to the initial image is generated.
[0154] Optionally, the acquisition module 402 is further configured to:
[0155] Get preset rendering stage information;
[0156] The initial image corresponding to the rendering stage information is obtained through the rendering component.
[0157] Optionally, determining the target image in the reduced image and determining a sampling offset of the target image in a pixel dimension according to preset blur information and pixel information of the initial image data includes:
[0158] Determining mesh information of the material in the initial image;
[0159] Writing the preset fuzzy information into the vertex information in the mesh information to obtain updated vertex information;
[0160] The updated vertex information is passed into a shader for calculation and processing, thereby determining a target image in the reduced image and determining a sampling offset of the target image in a pixel dimension.
[0161] Optionally, creating a reduced image corresponding to a blur level based on the initial image includes:
[0162] determining at least one blur level according to preset reduction information and size information of the initial image;
[0163] The initial image is reduced according to the preset reduction information to obtain a reduced image corresponding to the blur level.
[0164] The blur processing device provided in the embodiments of the present application obtains an initial image and, based on the initial image, creates a reduced image with a corresponding blur level. The device then determines a target image within the reduced image and a sampling offset for the target image in the pixel dimension based on preset blur information and pixel information of the initial image data. The device then blurs the target image based on the sampling offset to generate a blurred image corresponding to the initial image. This allows blurring using the reduced image as the image to be sampled, thereby avoiding an increase in the number of sampling times and ensuring efficient blurring.
[0165] The above is a schematic scheme of a fuzzy processing device of this embodiment. It should be noted that the technical scheme of the fuzzy processing device and the technical scheme of the fuzzy processing method described above are of the same concept. For details not described in detail in the technical scheme of the fuzzy processing device, please refer to the description of the technical scheme of the fuzzy processing method described above.
[0166] In one embodiment of the present application, a computing device is further provided, comprising a memory, a processor, and computer instructions stored in the memory and executable on the processor, wherein the processor implements the steps of the fuzzy processing method when executing the computer instructions.
[0167] The above is a schematic solution of a computing device of this embodiment. It should be noted that the technical solution of the computing device and the technical solution of the above-mentioned fuzzy processing method are of the same concept. For details not described in detail in the technical solution of the computing device, please refer to the description of the technical solution of the above-mentioned fuzzy processing method.
[0168] An embodiment of the present application further provides a computer-readable storage medium storing computer instructions, which implement the steps of the aforementioned fuzzy processing method when executed by a processor.
[0169] The above is a schematic scheme of a computer-readable storage medium of this embodiment. It should be noted that the technical scheme of this storage medium and the technical scheme of the above-mentioned obfuscation processing method are based on the same concept. For details not described in detail in the technical scheme of the storage medium, please refer to the description of the technical scheme of the above-mentioned obfuscation processing method.
[0170] The foregoing description describes specific embodiments of the present application. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims can be performed in an order different from that described in the embodiments and still achieve the desired results. Furthermore, the processes depicted in the accompanying drawings do not necessarily require the specific order shown or the sequential order to achieve the desired results. In certain embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0171] The computer instructions include computer program code, which may be in source code form, object code form, executable file, or some intermediate form. The computer-readable medium may include any entity or device capable of carrying the computer program code, a recording medium, a USB flash drive, a mobile hard drive, a magnetic disk, an optical disk, a computer memory, a read-only memory (ROM), a random access memory (RAM), an electrical carrier signal, a telecommunications signal, and a software distribution medium.
[0172] It should be noted that for the aforementioned method embodiments, for ease 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, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in this specification are all preferred embodiments, and the actions and modules involved are not necessarily required by this application.
[0173] In the above embodiments, the description of each embodiment has its own focus. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant description of other embodiments.
[0174] The preferred embodiments of the present application disclosed above are intended only to help illustrate the present application. The optional embodiments do not describe all details in detail, nor do they limit the invention to the specific embodiments described. Obviously, many modifications and variations can be made based on the content of this application. This application selects and describes these embodiments in detail in order to better explain the principles and practical applications of this application, so that those skilled in the art can better understand and utilize this application. This application is limited only by the claims and their full scope and equivalents.
Claims
1. A fuzzy processing method, characterized in that: include: Get the initial image; Based on the initial image, creating a reduced image corresponding to the blur level; According to the preset blur information and the pixel information of the initial image data, the target image in the reduced image and the sampling offset of the target image in the pixel dimension are determined, wherein the determination of the target image in the reduced image and the sampling offset of the target image in the pixel dimension according to the preset blur information and the pixel information of the initial image data includes: determining the mesh information of the material in the initial image; writing the preset blur information into the vertex information in the mesh information to obtain updated vertex information; determining the target image in the reduced image and determining the sampling offset of the target image in the pixel dimension by passing the updated vertex information into the shader for calculation processing. Sampling offset, wherein the determining of the target image in the reduced image and the determining of the sampling offset of the target image in the pixel dimension include: calculating a target blur level according to preset blur information and pixel information of the initial image; screening the target image in the reduced image according to the target blur level; determining the sampling offset of the target image in the pixel dimension according to the preset blur information; the calculation method of the sampling offset of the target image in the pixel dimension determined according to the preset blur information is to determine the target image in the reduced image according to the blur parameter and the number of Gaussian kernels in the preset blur information and the pixel information of the initial image, and calculate the sampling offset of the target image in the pixel dimension; The target image is blurred based on the sampling offset to generate a blurred image corresponding to the initial image.
2. The fuzzy processing method according to claim 1, characterized in that: The calculating the target blur level according to the preset blur information and the pixel information of the initial image includes: The pixel information of the initial image, the blur parameters in the preset blur information, and the number of Gaussian kernels are input into the blur level algorithm in the preset blur information for calculation to obtain a target blur level.
3. The fuzzy processing method according to claim 1, characterized in that: The determining the sampling offset of the target image in the pixel dimension according to the preset blur information includes: Determining sampling pixels and a central pixel in the target image based on the number of Gaussian kernels in the preset blur information and position information of pixels in the target image; The number of Gaussian kernels is input into the sampling offset algorithm in the preset blur information for calculation to obtain the sampling offset of the sampling pixel point from the central pixel point.
4. The fuzzy processing method according to claim 1, characterized in that: The blurring of the target image based on the sampling offset to generate a blurred image corresponding to the initial image includes: Determining sampling weights of sampling pixels in the target image according to the sampling offset; A blurred image corresponding to the initial image is generated based on the sampling weight, the sampling offset, position information of sampling pixels in the target image, and pixel values.
5. The fuzzy processing method according to claim 4, characterized in that: The generating, based on the sampling weight, the sampling offset, the position information of the sampling pixel points in the target image, and the pixel values, of the blurred image corresponding to the initial image includes: Performing weighted averaging based on the sampling weights, the sampling offsets, the position information of the sampling pixels in the target image, and the pixel values to obtain target pixel values of the plurality of target pixels; By combining the target pixel values, a blurred image corresponding to the initial image is generated. The fuzzy processing method according to claim 1 , wherein: The obtaining of the initial image comprises: Get preset rendering stage information; The initial image corresponding to the rendering stage information is obtained through the rendering component.
7. The fuzzy processing method according to claim 1, characterized in that: The step of creating a reduced image corresponding to a blur level based on the initial image includes: determining at least one blur level according to preset reduction information and size information of the initial image; The initial image is reduced according to the preset reduction information to obtain a reduced image corresponding to the blur level.
8. A fuzzy processing device, characterized in that: include: an acquisition module, configured to acquire an initial image; a creating module configured to create a reduced image corresponding to a blur level based on the initial image; The determination module is configured to determine the target image in the reduced image and determine the sampling offset of the target image in the pixel dimension according to the preset blur information and the pixel information of the initial image data, wherein the determination of the target image in the reduced image and determining the sampling offset of the target image in the pixel dimension according to the preset blur information and the pixel information of the initial image data includes determining the mesh information of the material in the initial image; writing the preset blur information into the vertex information in the mesh information to obtain updated vertex information; determining the target image in the reduced image and determining the sampling offset of the target image in the image by passing the updated vertex information into the shader for calculation processing. The method of determining the target image in the reduced image and determining the sampling offset of the target image in the pixel dimension comprises: calculating a target blur level according to preset blur information and pixel information of the initial image; screening the target image in the reduced image according to the target blur level; determining the sampling offset of the target image in the pixel dimension according to the preset blur information; the method of calculating the sampling offset of the target image in the pixel dimension according to the preset blur information is to determine the target image in the reduced image according to the blur parameter and the number of Gaussian kernels in the preset blur information and the pixel information of the initial image, and calculating the sampling offset of the target image in the pixel dimension; The generating module is configured to perform blur processing on the target image based on the sampling offset to generate a blurred image corresponding to the initial image.
9. A computing device comprising a memory, a processor, and computer instructions stored in the memory and executable on the processor, wherein: When the processor executes the computer instructions, the steps of the method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium storing computer instructions, characterized in that: When the computer instructions are executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
Method of displaying image in game interface and device
CN105243684A
Image processing method and device
CN108765271A
Bloom effect processing method and system, electronic device and storage medium
CN112426711A