CN114820374A - Fuzzy processing method and device - Google Patents

Fuzzy processing method and device Download PDF

Info

Publication number
CN114820374A
CN114820374A CN202210462624.XA CN202210462624A CN114820374A CN 114820374 A CN114820374 A CN 114820374A CN 202210462624 A CN202210462624 A CN 202210462624A CN 114820374 A CN114820374 A CN 114820374A
Authority
CN
China
Prior art keywords
image
information
pixel
sampling
target
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210462624.XA
Other languages
Chinese (zh)
Inventor
伍俊霖
刘小军
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhuhai Kingsoft Digital Network Technology Co Ltd
Original Assignee
Zhuhai Kingsoft Digital Network Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Zhuhai Kingsoft Digital Network Technology Co Ltd filed Critical Zhuhai Kingsoft Digital Network Technology Co Ltd
Priority to CN202210462624.XA priority Critical patent/CN114820374A/en
Publication of CN114820374A publication Critical patent/CN114820374A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/70Denoising; Smoothing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T3/00Geometric image transformations in the plane of the image
    • G06T3/40Scaling of whole images or parts thereof, e.g. expanding or contracting
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/90Dynamic range modification of images or parts thereof
    • G06T5/94Dynamic range modification of images or parts thereof based on local image properties, e.g. for local contrast enhancement

Landscapes

  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Image Processing (AREA)

Abstract

The application provides a fuzzy processing method and a fuzzy processing device, wherein the fuzzy processing method comprises the following steps: acquiring an initial image; creating a reduced image corresponding to a blur level based on the initial image; determining a target image in the reduced image and determining sampling offset of the target image in a pixel dimension according to preset fuzzy information and pixel information of the initial image data; and carrying out fuzzy processing on the target image based on the sampling offset to generate a fuzzy image corresponding to the initial image.

Description

Fuzzy processing method and device
Technical Field
The present application relates to the field of image processing technologies, and in particular, to a blur processing method and apparatus, a computing device, and a computer-readable storage medium.
Background
In practical applications, a gaussian blurring technique is usually adopted to blur an image. When blurring an image by the gaussian blurring technique, in order to achieve a higher degree of blurring, the number of gaussian kernels needs to be increased to fill in the space that is not covered. And therefore the image to be sampled is sampled a greater number of times. In this case, the blurring process is high in calculation cost and low in efficiency. Therefore, it is desirable to provide a solution to the above-mentioned problems.
Disclosure of Invention
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, so as to solve technical defects in the prior art.
According to a first aspect of embodiments of the present application, there is provided a blur processing method, including:
acquiring an initial image;
creating a reduced image corresponding to a blur level based on the initial image;
determining a target image in the reduced image and determining sampling offset of the target image in a pixel dimension according to preset fuzzy information and pixel information of the initial image data;
and carrying out fuzzy processing on the target image based on the sampling offset to generate a fuzzy image corresponding to the initial image.
Optionally, the determining a 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:
calculating a target fuzzy grade according to preset fuzzy information and pixel information of the initial image;
screening a target image in the reduced image according to the target fuzzy grade;
and determining the sampling offset of the target image in the pixel dimension according to the preset fuzzy information.
Optionally, the calculating a target blur level according to preset blur information and pixel information of the initial image includes:
and inputting the pixel information of the initial image, the fuzzy parameters in the preset fuzzy information and the number of Gaussian kernels into a fuzzy grade algorithm in the preset fuzzy information for calculation to obtain a target fuzzy grade.
Optionally, the determining, according to the preset blur information, a sampling offset of the target image in a pixel dimension includes:
determining sampling pixel points and central pixel points in the target image based on the number of Gaussian kernels in the preset fuzzy information and the position information of the pixel points in the target image;
and inputting the number of Gaussian kernels into a sampling offset algorithm in the preset fuzzy information for calculation to obtain the sampling offset of the sampling pixel point from the central pixel point.
Optionally, the blurring the target image based on the sampling offset to generate a blurred image corresponding to the initial image includes;
determining the sampling weight of a sampling pixel point in the target image according to the sampling offset;
and generating a blurred image corresponding to the initial image based on the sampling weight, the sampling offset, and the position information and pixel values of sampling pixel points in the target image.
Optionally, the generating a blurred image corresponding to the initial image based on the sampling weight, the sampling offset, and the position information and the pixel value of the sampling pixel point in the target image includes:
carrying out weighted average processing on the basis of the sampling weight, the sampling offset, the position information of the sampling pixel points in the target image and the pixel values to obtain target pixel values of a plurality of target pixel points;
and generating a blurred image corresponding to the initial image by combining the target pixel values.
Optionally, the acquiring an initial image includes:
acquiring preset rendering stage information;
and acquiring an initial image corresponding to the rendering stage information through a rendering component.
Optionally, the determining a 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:
determining the grid information of the material in the initial image;
writing the preset fuzzy information into vertex information in the mesh information to obtain updated vertex information;
and determining a target image in the reduced image and determining the sampling offset of the target image in the pixel dimension by transmitting the updated vertex information into a shader for calculation processing.
Optionally, the creating a reduced image corresponding to a blur level based on the initial image includes:
determining at least one fuzzy grade according to preset reduction information and size information of the initial image;
and carrying out reduction processing on the initial image according to the preset reduction information to obtain a reduced image corresponding to the fuzzy grade.
According to a second aspect of embodiments of the present application, there is provided a blur processing apparatus including:
an acquisition module configured to acquire an initial image;
a creation module configured to create a reduced image corresponding to a blur level based on the initial image;
a determining module configured to determine a target image in the reduced image and determine a sampling offset of the target image in a pixel dimension according to preset blur information and pixel information of the initial image data;
and the generating module is configured to perform blurring processing on the target image based on the sampling offset to generate a blurred image corresponding to the initial image.
According to a third aspect of embodiments of the present application, there is provided a computing device comprising a memory, a processor and computer instructions stored on the memory and executable on the processor, the processor implementing the steps of the blur processing method when executing the computer instructions.
According to a fourth aspect of embodiments of the present application, there is provided a computer-readable storage medium storing computer instructions which, when executed by a processor, implement the steps of the blur processing method.
In the embodiment of the application, an initial image is obtained, and a reduced image corresponding to a fuzzy grade is created based on the initial image; determining a target image in the reduced image and determining sampling offset of the target image in a pixel dimension according to preset fuzzy information and pixel information of the initial image data; and carrying out fuzzy processing on the target image based on the sampling offset to generate a fuzzy image corresponding to the initial image. The method and the device realize the fuzzy processing of the reduced image as the image to be sampled, thereby avoiding increasing the sampling times and ensuring the efficiency of the fuzzy processing.
Drawings
FIG. 1 is a block diagram of a computing device provided by an embodiment of the present application;
FIG. 2 is a flow chart of a fuzzy processing method according to an embodiment of the present application;
FIG. 3 is a flowchart illustrating a fuzzy processing method applied to a UI according to an embodiment of the present application;
fig. 4 is a schematic structural diagram of a blur processing apparatus according to an embodiment of the present application.
Detailed Description
In the following description, numerous specific details are set forth in order to provide a thorough understanding of the present application. This application is capable of implementation in many different ways than those herein set forth and of similar import by those skilled in the art without departing from the spirit of this application and is therefore not limited to the specific implementations disclosed below.
The terminology used in the one or more embodiments of the present application is for the purpose of describing particular embodiments only and is not intended to be limiting of the one or more embodiments of the present application. As used in one or more embodiments of the present application and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It should also be understood that the term "and/or" as used in one or more embodiments of the present application refers to and encompasses any and all possible combinations of one or more of the associated listed items.
It will be understood that, although the terms first, second, etc. may be used herein in one or more embodiments of the present application to describe various information, these information should not be limited by these terms. These terms are only used to distinguish one type of information from another. For example, a first aspect may be termed a second aspect, and, similarly, a second aspect may be termed a first aspect, without departing from the scope of one or more embodiments of the present application. The word "if" as used herein may be interpreted as "at … …" or "when … …" or "in response to a determination", depending on the context.
In the present 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.
FIG. 1 shows a block diagram of a computing device 100 according to an embodiment of the present application. The components of the computing device 100 include, but are not limited to, memory 110 and processor 120. The processor 120 is coupled to the memory 110 via a bus 130 and a database 150 is used to store data.
Computing device 100 also includes access device 140, access device 140 enabling computing device 100 to communicate via one or more networks 160. Examples of such networks include the 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. 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 IEEE802.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 so forth.
In one embodiment of the present application, the above-mentioned components of the computing device 100 and other components not shown in fig. 1 may also be connected to each other, for example, by a bus. It should be understood that the block diagram of the computing device architecture shown in FIG. 1 is for purposes of example 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 desired.
Computing device 100 may be any type of stationary or mobile computing device, including a mobile computer or mobile computing device (e.g., tablet, personal digital assistant, laptop, notebook, netbook, etc.), a mobile phone (e.g., smartphone), a wearable computing device (e.g., smartwatch, smartglasses, etc.), or other type of mobile device, or a stationary computing device such as a desktop computer or PC. Computing device 100 may also be a mobile or stationary server.
Wherein the processor 120 may perform the steps of the blurring processing method shown in fig. 2. Fig. 2 shows a flowchart of a blurring processing method according to an embodiment of the present application, which specifically includes the following steps:
step 202: an initial image is acquired.
Specifically, the initial image is an image that needs to be blurred. The initial image may be an image of any type, format (e.g., jpg, bmp, png, etc.) or content. For example, the initial image may be an image of a User Interface (UI) type, a game image type, a background image type, an abstract type, or an image of any content such as a landscape image, a character image, a moving image, and an animal image, which is not limited herein.
The fuzzy processing method can perform sampling on the basis of reducing the image, thereby reducing the sampling times and improving the fuzzy processing efficiency.
In specific implementation, the initial image is obtained in various ways, such as obtaining an initial image uploaded by a user, downloading the initial image through a network, or obtaining the initial image through screen capture. However, the initial image in this case is usually an already rendered image, and in order to increase the application range of the blurring process of the present application, in the embodiment of the present application, the initial image is obtained specifically by:
acquiring preset rendering stage information;
and acquiring an initial image corresponding to the rendering stage information through a rendering component.
The preset rendering stage information refers to information that can identify one rendering stage. The rendering stage information may be a number, a specific stage name, or the like, and is not limited herein. In practical applications, the rendering stage may include "before transparency", "after post-processing", and the like. The required images can be intercepted in different rendering phases by the rendering component.
The rendering component is a component that performs real-time rendering. The function of the rendering component is to generate or render a 2D image given scene elements such as virtual cameras, 3D scene objects, and light sources. In particular implementations, the rendering component can be a custom rendering pipeline.
For example, if the preset rendering stage information submitted by the user is acquired as 6, the image corresponding to the 6 in the rendering queue is acquired as the initial image through the custom pipeline.
In conclusion, the image of a certain rendering stage is obtained by the rendering component to be used as the initial image, so that the image data in the rendering process can be subjected to fuzzy processing, and the applicability of the fuzzy processing is improved.
Step 204: based on the initial image, a reduced image corresponding to a blur level is created.
Specifically, on the basis of the above-mentioned initial image acquisition, it may be necessary to consume a large amount of calculation cost in consideration of directly performing the blurring processing on the initial image. In order to reduce the consumption of the calculation cost, the blurring process may be performed on the basis of the reduced image by creating a reduced image corresponding to the blurring level.
The fuzzy grade refers to grade information for identifying a fuzzy degree, and the grade may be a positive integer. In particular, the greater the blur level, the higher the blur degree and the smaller the reduced image corresponding to the blur level. Further, the smaller the blur level, the lower the blur degree and the relatively larger the reduced image corresponding to the blur level may be indicated.
Accordingly, the reduced image is an image obtained by reducing the original image. In practice, each blur level may correspond to a reduced image. For example, the resolution of the original image is 1024 × 1024, the original image corresponds to the blur level 0, and the resolution of the reduced image corresponding to the blur level 1 is 512 × 512.
Further, the creating of the reduced image corresponding to the blur level based on the initial image is specifically implemented by:
determining at least one fuzzy grade according to preset reduction information and size information of the initial image;
and carrying out reduction processing on the initial image according to the preset reduction information to obtain a reduced image corresponding to the fuzzy grade.
The preset zooming-out information is information which is preset and used for describing zooming-out conditions. Specifically, the preset reduction information may be a reduction rule, such as reducing the initial image by a multiple of 2 (e.g., 2 times, 4 times, 8 times, etc.), or reducing the initial image by a multiple of 3, etc. The size information is information describing the size of the initial image, and the size information may be resolution information, or information such as length and width, and is not limited herein.
In practical application, the iterative reduction times based on the initial image can be determined according to the preset reduction information and the size information of the initial image. For example, the resolution of the initial image is 1024, and the preset reduction information is reduction by a multiple of 2, and then according to the reduction information, the initial image can be reduced 10 times, and then 10 blur levels are obtained.
Based on this, the original image may be further subjected to reduction processing according to preset reduction information so that at least one reduced image is obtained, the size of the reduced image being one-half, one-quarter, etc. of the size of the original image.
Taking the initial image as the UI, the resolution of the UI is 1024 × 1024. In the case where the preset reduction information is to reduce the UI by a multiple of 2 (e.g., 2 times, 4 times, 8 times, etc.), it is determined that there are 1 to 10, 10 blur levels, and the UI is reduced by a multiple of 2, resulting in 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. Among them, the reduced image with the resolution of 512 × 512 corresponds to the blur level 1, the reduced image with the resolution of 128 × 128 corresponds to the blur level 2, and so on, the reduced image with the resolution of 1 × 51 corresponds to the blur level 10.
In practical 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.
In summary, at least one blur level is determined according to the preset reduction information and the size information of the initial image, and the reduction processing is performed on the initial image according to the preset reduction information to obtain a reduced image corresponding to each blur level.
Step 206: and determining a target image in the reduced image and determining the sampling offset of the target image in the pixel dimension according to preset fuzzy information and the pixel information of the initial image data.
Specifically, on the basis of creating a reduced image corresponding to a blur level, in consideration of the need to accurately implement processing of a specific blur degree and to reduce the number of sampling times, it is necessary to determine a target image to be sampled in the reduced image and a sampling offset to the target image.
The preset blur information refers to preset blur information for determining a target image and a sampling offset, and specifically, the preset blur information may be a blur parameter, a correspondence between a preset blur parameter and a blur level, a correspondence between a preset blur parameter and a sampling offset, and the like, which is not limited herein.
The blur parameter is a parameter indicating a degree of blur. The blurring parameter may take any value or integer between 0 and 1, the larger the blurring parameter is, the higher the degree of blurring required is. And sampling offset refers to the interval between a pixel point to be sampled and a central point.
In the embodiment of the present application, the determining the target image in the reduced image and the 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 are specifically implemented by the following steps 2062 to 2066:
step 2062: calculating a target fuzzy grade according to preset fuzzy information and pixel information of the initial image;
the target blur level refers to a blur level corresponding to a reduced image to be sampled.
In specific implementation, in the embodiment of the present application, the calculating the target blur level according to the preset blur information and the pixel information of the initial image is implemented by the following method:
and inputting the pixel information of the initial image, the fuzzy parameters in the preset fuzzy information and the number of Gaussian kernels into a fuzzy grade algorithm in the preset fuzzy information for calculation to obtain a target fuzzy grade.
The pixel information of the initial image may be a pixel width or a pixel length of the initial image. The number of gaussian kernels is the size of the convolution kernel for gaussian blurring, i.e., the number of gaussian kernels. For example, 3 × 3 gaussian kernels, 7 × 7 gaussian kernels, and 7 gaussian kernels. The fuzzy grade algorithm is an algorithm for calculating a target fuzzy grade.
In specific implementation, the fuzzy grade algorithm may be: target blur level ceil (max (0.0, log2 (mapping coefficient blur parameter screen pixel number in vertical direction float (gaussian kernel number)))).
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.
Step 2064: and screening a target image in the reduced image according to the target fuzzy grade.
The target image refers to a reduced image corresponding to the target blur level, that is, a reduced image to be sampled.
Following the above example, 16 × 16 target images with a target blur level of 6 are selected from the reduced images according to the target blur level of 6.
Step 2066: and determining the sampling offset of the target image in the pixel dimension according to the preset fuzzy information.
In specific implementation, the sampling offset of the target image in the pixel dimension is determined according to the preset blur information, and the method is specifically implemented as follows:
determining sampling pixel points and central pixel points in the target image based on the number of Gaussian kernels in the preset fuzzy information and the position information of the pixel points in the target image;
and inputting the number of Gaussian kernels into a sampling offset algorithm in the preset fuzzy information for calculation to obtain the sampling offset of the sampling pixel point from the central pixel point.
The position information of the pixel point may be pixel position information, UV position information, or the like, which is not limited herein. And sampling pixel points, wherein the pixel points can be understood as pixel points mapped by Gaussian kernels corresponding to the number of the Gaussian kernels in the target image. Correspondingly, a central pixel point refers to a central point of a group of sampling pixel points. In practical application, the gaussian kernel is continuously moved in the process of performing convolution operation on the target image through the gaussian kernel. After each movement, the Gaussian kernel corresponds to a new group of sampling pixel points and a central pixel point.
The sampling offset algorithm refers to an algorithm for calculating a sampling offset.
Specifically, for any group of sampling pixel points and sampling center points, the sampling offset algorithm may be: sample offset ═ float2 (k% number of gaussian kernels, k/number of gaussian kernels)/(float (number of gaussian kernels-1)/2) -float (1.0 ), where k is a positive integer, 0 ═ k < square of number of gaussian kernels, k + +.
Along with the above example, under the condition that the number of Gaussian kernels is 7, the value range of k is 0-48; when k is equal to 0, the sampling offsets float2 (0% 7, 0/7)/3-float (1.0 ) float2(0, 0)/3-float2(1.0 ) float2(0, 0) -float2(1.0 ) float2(-1, -1), and so on, and 48 sampling offsets with k values of 1 to 48 are calculated, respectively.
In summary, the sampling offset of the distance between the sampling pixel point and the central pixel point is calculated through the number of Gaussian kernels, so that the sampling offset of the target image is determined under the condition that the number of Gaussian kernels is not changed, namely the sampling times are not changed, the problem that the higher the fuzzy degree is, the higher the sampling times is in the traditional Gaussian blur is effectively solved, and the blur efficiency is greatly improved.
In practice, it is considered that since in one application, multiple images may be involved, and some of the images may sample the same material, but require that the material exhibit different degrees of blurring. In order to avoid generating separate materials for different blurring degrees, according to the 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 according to preset blurring information and pixel information of the initial image data, and the method specifically includes:
determining the grid information of the material in the initial image;
writing the preset fuzzy information into vertex information in the mesh information to obtain updated vertex information;
and determining a target image in the reduced image and determining the sampling offset of the target image in the pixel dimension by transmitting the updated vertex information into a shader for calculation processing.
Specifically, the texture refers to a data set for representing interaction of an object with light to be read by a renderer, and includes a map, a texture, an illumination algorithm, and the like. According to the embodiment of the application, the preset fuzzy information is written into the vertex information, the target image and the sampling offset are determined through the shader, fuzzy processing of multiple degrees on one material can be achieved, and generation of multiple materials is avoided. Thereby saving storage space.
Step 208: and carrying out fuzzy processing on the target image based on the sampling offset to generate a fuzzy image corresponding to the initial image.
Specifically, on the basis of the determination of the target image and the sampling offset, the target image may be blurred based on the sampling offset, so as to generate a blurred image.
The blurred image is a blurred image generated after the blurring process.
In specific implementation, the target image is blurred based on the sampling offset, and a blurred image corresponding to the initial image is generated, which is specifically implemented through steps 2082 to 2084;
step 2082: determining the sampling weight of a sampling pixel point in the target image according to the sampling offset;
step 2084: and generating a blurred image corresponding to the initial image based on the sampling weight, the sampling offset, and the position information and pixel values of sampling pixel points in the target image.
Further, the generating a blurred image corresponding to the initial image based on the sampling weight, the sampling offset, and the position information and the pixel value of the sampling pixel point in the target image includes:
carrying out weighted average processing on the basis of the sampling weight, the sampling offset, the position information of the sampling pixel points in the target image and the pixel values to obtain target pixel values of a plurality of target pixel points;
and generating a blurred image corresponding to the initial image by combining the target pixel values.
In practical application, the weight of the sampling pixel point can be calculated according to a weight calculation formula. Specifically, the weight calculation formula may be: w-exp 2(-2.0 dot).
When the sampling offset is (-1, -1), the weight w0 of the sampling pixel corresponding to the sampling offset is exp2 dot (float (-1, -1), float (-1, -1)) -exp 2(-2.0 x 2) — 1/16-0.0625, and so on, and the weight of the sampling pixel corresponding to the other 48 sampling offsets is calculated as w1 … … w 48.
And according to the R values of 49 sampling pixel points mapped by the Gaussian kernel in the 16 × 16 target image and the weights of the 49 sampling pixel points, calculating the R value of a pixel point p0 in the blurred image, wherein R is (R0 × 0.0625+ R1 × w1+ … … + R48 × w48)/(w0+ w1+ … … + w48), and calculating the G value and the B value of the pixel point p0 based on the same principle.
Further, the Gaussian kernel is moved, the pixel value of the pixel point p1 in the blurred image is calculated through the pixel value of another group of 49 sampling pixel points corresponding to the moved Gaussian kernel and the weight of the 49 sampling pixel points, and by analogy, the pixel values of all the pixel points in the blurred image are calculated.
According to the fuzzy processing method provided by the embodiment of the application, an initial image is obtained, and a reduced image corresponding to a fuzzy grade is created based on the initial image; determining a target image in the reduced image and determining sampling offset of the target image in a pixel dimension according to preset fuzzy information and pixel information of the initial image data; and carrying out fuzzy processing on the target image based on the sampling offset to generate a fuzzy image corresponding to the initial image. The method and the device realize the fuzzy processing of the reduced image as the image to be sampled, thereby avoiding increasing the sampling times and ensuring the efficiency of the fuzzy processing.
The following will further describe the blurring processing method by taking the application of the blurring processing method provided by the present application in a UI image as an example, with reference to fig. 3. Fig. 3 shows a processing flow chart of a blurring processing method applied to a UI image according to an embodiment of the present application, which specifically includes the following steps:
step 302: and acquiring preset rendering stage information.
Step 304: and acquiring a UI image corresponding to the rendering stage information through the rendering component.
Step 306: determining at least one blur level according to preset reduction information and size information of the UI image.
Step 308: and carrying out reduction processing on the UI image according to preset reduction information to obtain a reduced image corresponding to the fuzzy grade.
Step 310: and inputting the pixel information of the UI image, the fuzzy parameters in the preset fuzzy information and the number of Gaussian kernels into a fuzzy grade algorithm in the preset fuzzy information for calculation to obtain a target fuzzy grade.
Step 312: and screening the target image from the reduced image according to the target fuzzy grade.
Step 314: and determining sampling pixel points and central pixel points in the target image based on the number of Gaussian kernels in the preset fuzzy information and the position information of the pixel points in the target image.
Step 316: and inputting the number of Gaussian kernels into a sampling offset algorithm in preset fuzzy information for calculation to obtain the sampling offset of the sampling pixel point from the central pixel point.
Step 318: and determining the sampling weight of the sampling pixel point in the target image according to the sampling offset.
Step 320: and carrying out weighted average processing based on the sampling weight, the sampling offset, the position information of the sampling pixel points in the target image and the pixel values to obtain the target pixel values of a plurality of target pixel points.
Step 322: and generating a blurred image corresponding to the UI image by combining the target pixel values.
According to the fuzzy processing method provided by the embodiment of the application, an initial image is obtained, and a reduced image corresponding to a fuzzy grade is created based on the initial image; determining a target image in the reduced image and determining sampling offset of the target image in a pixel dimension according to preset fuzzy information and pixel information of the initial image data; and carrying out fuzzy processing on the target image based on the sampling offset to generate a fuzzy image corresponding to the initial image. The method and the device realize the fuzzy processing of the reduced image as the image to be sampled, thereby avoiding increasing the sampling times and ensuring the efficiency of the fuzzy processing.
Corresponding to the above method embodiment, the present application further provides an embodiment of a blur processing apparatus, and fig. 4 shows a schematic structural diagram of the blur processing apparatus provided in an embodiment of the present application. As shown in fig. 4, the apparatus includes:
an acquisition module 402 configured to acquire an initial image;
a creation module 404 configured to create a reduced image corresponding to a blur level based on the initial image;
a determining module 406 configured to determine a target image in the reduced image and determine a sampling offset of the target image in a pixel dimension according to preset blur information and pixel information of the initial image data;
a generating module 408 configured to blur the target image based on the sampling offset, and generate a blurred image corresponding to the initial image.
Optionally, the determining module 406 includes:
a calculation submodule configured to calculate a target blur level according to preset blur information and pixel information of the initial image;
a filtering sub-module configured to filter a target image in the reduced image according to the target blur level;
a determination sub-module configured to determine a sampling offset of the target image in a pixel dimension according to the preset blur information.
Optionally, the calculation sub-module is further configured to:
and inputting the pixel information of the initial image, the fuzzy parameters in the preset fuzzy information and the number of Gaussian kernels into a fuzzy grade algorithm in the preset fuzzy information for calculation to obtain a target fuzzy grade.
Optionally, the determining sub-module is further configured to:
determining sampling pixel points and central pixel points in the target image based on the number of Gaussian kernels in the preset fuzzy information and the position information of the pixel points in the target image;
and inputting the number of Gaussian kernels into a sampling offset algorithm in the preset fuzzy information for calculation to obtain the sampling offset of the sampling pixel point from the central pixel point.
Optionally, the generating module 408 includes:
a weight determination submodule configured to determine a sampling weight of a sampling pixel point in the target image according to the sampling offset;
and 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 point in the target image and the pixel value.
Optionally, the generation submodule is further configured to:
performing weighted average processing based on the sampling weight, the sampling offset, the position information of the sampling pixel points in the target image and the pixel values to obtain target pixel values of a plurality of target pixel points;
and generating a blurred image corresponding to the initial image by combining the target pixel values.
Optionally, the obtaining module 402 is further configured to:
acquiring preset rendering stage information;
and acquiring an initial image corresponding to the rendering stage information through a rendering component.
Optionally, the determining a 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:
determining the grid information of the material in the initial image;
writing the preset fuzzy information into vertex information in the mesh information to obtain updated vertex information;
and determining a target image in the reduced image and determining the sampling offset of the target image in the pixel dimension by transmitting the updated vertex information into a shader for calculation processing.
Optionally, the creating a reduced image corresponding to a blur level based on the initial image includes:
determining at least one fuzzy grade according to preset reduction information and size information of the initial image;
and carrying out reduction processing on the initial image according to the preset reduction information to obtain a reduced image corresponding to the fuzzy grade.
The fuzzy processing device provided by the embodiment of the application establishes a reduced image corresponding to a fuzzy grade by acquiring an initial image and based on the initial image; determining a target image in the reduced image and determining sampling offset of the target image in a pixel dimension according to preset fuzzy information and pixel information of the initial image data; and carrying out fuzzy processing on the target image based on the sampling offset to generate a fuzzy image corresponding to the initial image. The method and the device realize the fuzzy processing of the reduced image as the image to be sampled, thereby avoiding increasing the sampling times and ensuring the efficiency of the fuzzy processing.
The above is a schematic scheme of a blur processing apparatus of the present embodiment. It should be noted that the technical solution of the blurring processing device and the technical solution of the blurring processing method belong to the same concept, and details that are not described in detail in the technical solution of the blurring processing device can be referred to the description of the technical solution of the blurring processing method.
An embodiment of the present application further provides a computing device, which includes a memory, a processor, and computer instructions stored in the memory and executable on the processor, wherein the processor implements the steps of the blur processing method when executing the computer instructions.
The above is an illustrative scheme of a computing device of the present embodiment. It should be noted that the technical solution of the computing device and the technical solution of the above-mentioned blur processing method belong to the same concept, and details that are not described in detail in the technical solution of the computing device can be referred to the description of the technical solution of the above-mentioned blur processing method.
An embodiment of the present application further provides a computer readable storage medium, which stores computer instructions, and the computer instructions, when executed by a processor, implement the steps of the blur processing method as described above.
The above is an illustrative scheme of a computer-readable storage medium of the present embodiment. It should be noted that the technical solution of the storage medium belongs to the same concept as the technical solution of the above-mentioned blurring processing method, and details that are not described in detail in the technical solution of the storage medium can be referred to the description of the technical solution of the above-mentioned blurring processing method.
The foregoing description of specific embodiments of the present application has been presented. Other embodiments are within the scope of the following claims. In some cases, the actions or steps recited in the claims can be performed in a different order than in the embodiments and still achieve desirable results. In addition, the processes depicted in the accompanying figures do not necessarily require the particular order shown, or sequential order, to achieve desirable results. In some embodiments, multitasking and parallel processing may also be possible or may be advantageous.
The computer instructions comprise computer program code which may be in source code form, object code form, an executable file or some intermediate form, or the like. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, usb disk, removable hard disk, magnetic disk, optical disk, computer Memory, Read-Only Memory (ROM), Random Access Memory (RAM), electrical carrier wave signals, telecommunications signals, software distribution medium, and the like.
It should be noted that, for the sake of simplicity, the above-mentioned method embodiments are described as a series of acts or combinations, but those skilled in the art should understand that the present application is not limited by the described order of acts, as some steps may be performed in other orders or simultaneously according to the present application. Further, those skilled in the art should also appreciate that the embodiments described in the specification are preferred embodiments and that the acts and modules referred to are not necessarily required in this application.
In the above embodiments, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.
The preferred embodiments of the present application disclosed above are intended only to aid in the explanation of the application. Alternative embodiments are not exhaustive and do not limit the invention to the precise embodiments described. Obviously, many modifications and variations are possible in light of the above teaching. The embodiments were chosen and described in order to best explain the principles of the application and its practical applications, to thereby enable others skilled in the art to best understand and utilize the application. The application is limited only by the claims and their full scope and equivalents.

Claims (12)

1. A blur processing method, characterized by comprising:
acquiring an initial image;
creating a reduced image corresponding to a blur level based on the initial image;
determining a target image in the reduced image and determining sampling offset of the target image in a pixel dimension according to preset fuzzy information and pixel information of the initial image data;
and carrying out fuzzy processing on the target image based on the sampling offset to generate a fuzzy image corresponding to the initial image.
2. The blur processing method according to claim 1, wherein the determining a 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 comprises:
calculating a target fuzzy grade according to preset fuzzy information and pixel information of the initial image;
screening a target image in the reduced image according to the target fuzzy grade;
and determining the sampling offset of the target image in the pixel dimension according to the preset fuzzy information.
3. The blur processing method according to claim 1, wherein the calculating a target blur level according to preset blur information and pixel information of the initial image comprises:
and inputting the pixel information of the initial image, the fuzzy parameters in the preset fuzzy information and the number of Gaussian kernels into a fuzzy grade algorithm in the preset fuzzy information for calculation to obtain a target fuzzy grade.
4. The blur processing method according to claim 1, wherein the determining a sampling offset of the target image in a pixel dimension according to the preset blur information comprises:
determining sampling pixel points and central pixel points in the target image based on the number of Gaussian kernels in the preset fuzzy information and the position information of the pixel points in the target image;
and inputting the number of Gaussian kernels into a sampling offset algorithm in the preset fuzzy information for calculation to obtain the sampling offset of the sampling pixel point from the central pixel point.
5. The blurring processing method according to claim 1, wherein the blurring processing on the target image based on the sampling offset generates a blurred image corresponding to the initial image, including;
determining the sampling weight of a sampling pixel point in the target image according to the sampling offset;
and generating a blurred image corresponding to the initial image based on the sampling weight, the sampling offset, and the position information and pixel values of sampling pixel points in the target image.
6. The blurring processing method according to claim 1, wherein the generating a blurred image corresponding to the initial image based on the sampling weight, the sampling offset, position information of a sampling pixel point in the target image, and a pixel value comprises:
carrying out weighted average processing on the basis of the sampling weight, the sampling offset, the position information of the sampling pixel points in the target image and the pixel values to obtain target pixel values of a plurality of target pixel points;
and generating a blurred image corresponding to the initial image by combining the target pixel values.
7. The blur processing method according to claim 1, wherein the acquiring an initial image comprises:
acquiring preset rendering stage information;
and acquiring an initial image corresponding to the rendering stage information through a rendering component.
8. The blur processing method according to claim 1, wherein the determining a 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 comprises:
determining the grid information of the material in the initial image;
writing the preset fuzzy information into vertex information in the mesh information to obtain updated vertex information;
and determining a target image in the reduced image and determining the sampling offset of the target image in the pixel dimension by transmitting the updated vertex information into a shader for calculation processing.
9. The blur processing method according to claim 1, wherein the creating of the reduced image corresponding to the blur level based on the initial image comprises:
determining at least one fuzzy grade according to preset reduction information and size information of the initial image;
and carrying out reduction processing on the initial image according to the preset reduction information to obtain a reduced image corresponding to the fuzzy grade.
10. A blur processing apparatus, characterized by comprising:
an acquisition module configured to acquire an initial image;
a creation module configured to create a reduced image corresponding to a blur level based on the initial image;
a determining module configured to determine a target image in the reduced image and determine a sampling offset of the target image in a pixel dimension according to preset blur information and pixel information of the initial image data;
and the generating module is configured to perform blurring processing on the target image based on the sampling offset to generate a blurred image corresponding to the initial image.
11. A computing device comprising a memory, a processor, and computer instructions stored on the memory and executable on the processor, wherein the processor implements the steps of the method of any one of claims 1-9 when executing the computer instructions.
12. A computer-readable storage medium storing computer instructions, wherein the computer instructions, when executed by a processor, implement the steps of the method of any one of claims 1-9.
CN202210462624.XA 2022-04-28 2022-04-28 Fuzzy processing method and device Pending CN114820374A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210462624.XA CN114820374A (en) 2022-04-28 2022-04-28 Fuzzy processing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210462624.XA CN114820374A (en) 2022-04-28 2022-04-28 Fuzzy processing method and device

Publications (1)

Publication Number Publication Date
CN114820374A true CN114820374A (en) 2022-07-29

Family

ID=82509763

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210462624.XA Pending CN114820374A (en) 2022-04-28 2022-04-28 Fuzzy processing method and device

Country Status (1)

Country Link
CN (1) CN114820374A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117593211A (en) * 2023-12-15 2024-02-23 书行科技(北京)有限公司 Video processing method, device, electronic equipment and storage medium

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117593211A (en) * 2023-12-15 2024-02-23 书行科技(北京)有限公司 Video processing method, device, electronic equipment and storage medium

Similar Documents

Publication Publication Date Title
Wang et al. Real-esrgan: Training real-world blind super-resolution with pure synthetic data
US8655109B2 (en) Regression-based learning model for image upscaling
JP3915563B2 (en) Image processing apparatus and image processing program
US9202258B2 (en) Video retargeting using content-dependent scaling vectors
Islam et al. Super-resolution enhancement technique for low resolution video
CN108876716B (en) Super-resolution reconstruction method and device
CN110570506B (en) Map resource management method, device, computing equipment and storage medium
CN111161181A (en) Image data enhancement method, model training method, device and storage medium
WO2015038307A1 (en) Guided image upsampling using bitmap tracing
CN112529776A (en) Training method of image processing model, image processing method and device
CN114049420A (en) Model training method, image rendering method, device and electronic equipment
Ji et al. Geometry-aware single-image full-body human relighting
CN114820374A (en) Fuzzy processing method and device
CN110363733B (en) Mixed image generation method and device
US10417789B2 (en) Motion blur using cached texture space blur
CN116071279A (en) Image processing method, device, computer equipment and storage medium
Peng et al. PDRF: progressively deblurring radiance field for fast scene reconstruction from blurry images
Li et al. Resolution enhancement from document images for text extraction
CN114219885A (en) Real-time shadow rendering method and device for mobile terminal
Liu et al. An improved monte carlo denoising algorithm based on kernel-predicting convolutional network
CN116310959B (en) Method and system for identifying low-quality camera picture in complex scene
Kao et al. Improved edge-directed super resolution
CN114241097A (en) Inner trace rendering method and device based on directed distance field
CN114359466A (en) Rendering method and device for realizing local Bloom effect
Kingboo et al. Super-Resolution Image Generation from Enlarged Image Based on Interpolation Technique

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination