Picture fuzzy processing method, device and equipment and computer readable storage medium
By selecting the target letter blur model based on the line characteristics and color block characteristics of the picture, determining the pixels to be blurred and the degree of blur, the problem of inflexibility of picture blur processing in the prior art is solved, and a more targeted image blur processing effect is achieved .
Patent Information
- Application Number
- CN202410930385.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-11
- Publication Date
- 2024-11-08
AI Technical Summary
The existing picture blur processing technology lacks flexibility and cannot be processed according to the line characteristics and color block characteristics of different pictures.
By obtaining the line features and color block features of the image to be processed, the matching target letter blur model is determined from multiple preset letter blur models, the pixels to be blurred are determined, and the degree of blur is determined based on the distance of the letter pixel trajectory, and the targeted degree is determined. blurred image.
It improves the flexibility of image blur processing, can more effectively blur different types of images, and enhances the processing effect.
Smart Images

Figure CN118917996A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of image processing technology, and in particular to an image blur processing method, device, equipment and computer-readable storage medium. Background Art
[0002] Image blurring is an important method in image processing, which can protect the privacy content in the image.
[0003] There are many blur processing methods in the prior art, such as the Gaussian blur method that uses normal distribution to determine the blur degree of pixels, and the box blur method that obtains the color value of each pixel in the image equal to the average value of the neighboring pixels of the pixel in the original image.
[0004] However, most of the fuzzy processing methods in the prior art use the same logic to process different images, which lacks certain flexibility. Summary of the invention
[0005] In order to solve the above technical problems, the present disclosure provides a method, device, equipment and computer-readable storage medium for image blur processing to improve the flexibility of the image blur processing method.
[0006] In a first aspect, an embodiment of the present disclosure provides a method for image blur processing, comprising:
[0007] Get the image to be processed;
[0008] Determine at least one target letter fuzzy model corresponding to the image to be processed from a plurality of preset letter fuzzy models according to the line features and / or color block features of the image to be processed, each of the preset letter fuzzy models including a letter pixel trajectory;
[0009] For each of the target letter blur models, determining a plurality of pixels to be blurred corresponding to the letter pixel trajectory in the image to be processed;
[0010] Determining the blur degree of each pixel to be blurred according to the distance between each pixel to be blurred and the letter pixel trajectory;
[0011] Based on the preset blur degree of the letter pixel trajectory and the blur degree of each of the pixels to be blurred, the image to be processed is blurred.
[0012] In some embodiments, determining at least one target letter fuzzy model corresponding to the image to be processed from a plurality of preset letter fuzzy models according to the line features and / or color block features of the image to be processed includes:
[0013] Determine at least one preset letter fuzzy model whose similarity between the letter pixel trajectory and the line distribution in the to-be-processed image is greater than a similarity threshold as the target letter fuzzy model; and / or
[0014] At least one preset letter fuzzy model whose similarity between the letter pixel trajectory and the color block distribution in the to-be-processed picture is greater than a similarity threshold is determined as the target letter fuzzy model.
[0015] In some embodiments, the image to be processed includes a plurality of areas to be processed, and determining at least one target letter fuzzy model corresponding to the image to be processed from a plurality of preset letter fuzzy models according to line features and / or color block features of the image to be processed includes:
[0016] For each of the to-be-processed areas, a target letter fuzzy model corresponding to the to-be-processed area is determined from a plurality of preset letter fuzzy models according to line features and / or color block features of the to-be-processed area.
[0017] In some embodiments, for each of the target letter blur models, determining a plurality of pixels to be blurred in the image to be processed corresponding to the letter pixel trajectory includes:
[0018] Determine a plurality of fixed trajectory points in the target letter fuzzy model that are arranged in an orderly manner, wherein the fixed trajectory points include a starting point and an ending point in the letter pixel trajectory;
[0019] For each of the fixed track points, from the fixed track point to the next fixed track point, a new pixel point is determined along the letter pixel track at every preset pixel distance;
[0020] Taking each of the fixed trajectory points meeting the preset conditions and each of the newly added pixel points as the center, a plurality of letter pixel frames are constructed with a preset pixel frame radius, and the side length of the letter pixel frame is equal to the sum of twice the preset pixel frame radius and the side length of a single pixel;
[0021] The pixels in the to-be-processed picture covered by each of the letter pixel frames are determined as pixels to be blurred.
[0022] In some embodiments, for each of the fixed track points, from the fixed track point to the next fixed track point, a new pixel point is determined along the letter pixel track at every preset pixel distance, including:
[0023] When the preset pixel distance is equal to the preset pixel frame radius, if the distance between the newly added pixel point and the next fixed trajectory point is less than the preset pixel frame radius, it is determined that the next fixed trajectory point does not meet the preset condition, and other newly added pixel points are determined from the next fixed trajectory point; or
[0024] When the preset pixel distance is equal to twice the preset pixel frame radius, if the distance between the newly added pixel point and the next fixed trajectory point is less than the preset pixel distance, it is determined that the next fixed trajectory point does not meet the preset conditions, and other newly added pixel points are determined starting from the next fixed trajectory point.
[0025] In some embodiments, after determining a plurality of ordered fixed trajectory points in the target letter fuzzy model, the method further includes:
[0026] If the user selects the letter pixel frame intersection mode, determining that the preset pixel distance is equal to the preset pixel frame radius; or
[0027] If the user selects the letter pixel frame non-intersection mode, the preset pixel distance is determined to be equal to twice the radius of the preset pixel frame.
[0028] In some embodiments, after determining a plurality of ordered fixed trajectory points in the target letter fuzzy model, the method further includes:
[0029] According to the position of each of the fixed trajectory points in the image to be processed, the tiling state of the target letter fuzzy model in the image to be processed is determined.
[0030] In a second aspect, an embodiment of the present disclosure provides a device for image blur processing, including:
[0031] The acquisition module is used to obtain the image to be processed;
[0032] A first determination module is used to determine at least one target letter fuzzy model corresponding to the image to be processed from a plurality of preset letter fuzzy models according to line features and / or color block features of the image to be processed, each of the preset letter fuzzy models including a letter pixel trajectory;
[0033] A second determination module is used to determine, for each target letter blur model, a plurality of pixels to be blurred corresponding to the letter pixel trajectory in the image to be processed;
[0034] A third determination module, used for determining the blur degree of each pixel to be blurred according to the distance between each pixel to be blurred and the letter pixel track;
[0035] A processing module is used to blur the image to be processed based on a preset blur degree of the letter pixel trajectory and a blur degree of each pixel to be blurred.
[0036] In a third aspect, an embodiment of the present disclosure provides a computer device, including:
[0037] Memory;
[0038] Processor; and
[0039] Computer programs;
[0040] The computer program is stored in the memory and is configured to be executed by the processor to implement the method as described in the first aspect.
[0041] In a fourth aspect, an embodiment of the present disclosure provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program is executed by a processor to implement the method described in the first aspect.
[0042] In a fifth aspect, an embodiment of the present disclosure further provides a computer program product, which includes a computer program or instructions, and when the computer program or instructions are executed by a processor, the image blur processing method as described above is implemented.
[0043] The image blur processing method, device, equipment and computer-readable storage medium provided by the embodiments of the present disclosure can perform more targeted blur processing on different images to be processed by selecting a matching target letter blur model for image blur processing according to the differences in line features and color block features of the image to be processed, thereby improving the flexibility of the image blur processing method. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.
[0045] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0046] Figure 1 A flow chart of a method for image blurring provided in an embodiment of the present disclosure;
[0047] Figure 2 A schematic diagram of a preset letter fuzzy model provided in an embodiment of the present disclosure;
[0048] Figure 3 A flowchart of a method for image blurring provided by another embodiment of the present disclosure;
[0049] Figure 4 A schematic diagram of a preset letter fuzzy model provided in an embodiment of the present disclosure;
[0050] Figure 5 A schematic diagram of a preset letter fuzzy model provided in an embodiment of the present disclosure;
[0051] Figure 6 A schematic diagram of determining pixels to be blurred provided in an embodiment of the present disclosure;
[0052] Figure 7 A schematic diagram of a letter pixel frame provided by an embodiment of the present disclosure;
[0053] Figure 8 A schematic diagram of a letter pixel frame intersection mode provided in an embodiment of the present disclosure;
[0054] Fig. 9 A schematic diagram of a non-intersecting mode of letter pixel frames provided in an embodiment of the present disclosure;
[0055] Fig.10 A schematic diagram of the structure of a device for image blurring processing provided by an embodiment of the present disclosure;
[0056] Fig.11 A schematic diagram of the structure of a computer device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION
[0057] In order to more clearly understand the above-mentioned objectives, features and advantages of the present disclosure, the scheme of the present disclosure will be further described below. It should be noted that the embodiments of the present disclosure and the features in the embodiments can be combined with each other without conflict.
[0058] In the following description, many specific details are set forth to facilitate a full understanding of the present disclosure, but the present disclosure may also be implemented in other ways different from those described herein; it is obvious that the embodiments in the specification are only part of the embodiments of the present disclosure, rather than all of the embodiments.
[0059] The present disclosure provides a method for image blur processing, which is described below in conjunction with a specific embodiment.
[0060] Figure 1 This is a flow chart of the image blur processing method provided in the embodiment of the present disclosure. The method can be applied to a terminal with an image processing function, and can also be applied to a system including a terminal and a server, and is implemented through the interaction between the terminal and the server. It can be understood that the image blur processing method provided in the embodiment of the present disclosure can also be applied in other scenarios.
[0061] Below Figure 1 The method for blurring the picture shown in the figure is introduced, and the specific steps of the method are as follows:
[0062] S102: Obtain the image to be processed.
[0063] The image to be processed is the image that needs to be blurred.
[0064] Optionally, the user may specify an area to be blurred in the image to be processed as required.
[0065] S104. Determine at least one target letter fuzzy model corresponding to the image to be processed from a plurality of preset letter fuzzy models according to line features and / or color block features of the image to be processed, each of the preset letter fuzzy models including a letter pixel trajectory.
[0066] The preset letter fuzzy model is built based on the 26 English letters. Figure 2 A schematic diagram of a preset letter fuzzy model provided in an embodiment of the present disclosure, such as Figure 2 As shown, 26 preset letter fuzzy models are shown, and each of the preset letter fuzzy models corresponds to an uppercase English letter.
[0067] The letter pixel trajectory in each preset letter fuzzy model is the letter corresponding to the preset letter fuzzy model.
[0068] There are lines and color blocks in the image to be processed, and the terminal selects a suitable target letter fuzzy model from multiple preset letter fuzzy models according to the line features and / or color block features in the image to be processed.
[0069] S106. For each target letter blur model, determine a plurality of pixels to be blurred corresponding to the letter pixel trajectory in the image to be processed.
[0070] The terminal tiles the selected target letter fuzzy model on the image with a suitable size, and the letter pixel track in the target letter fuzzy model will cover some pixels in the image to be processed. The pixel covered by the letter pixel track is taken as the center, and the fuzzy processing range is determined according to certain preset rules. The pixels covered by the letter pixel track are further expanded according to the fuzzy processing range, and finally a plurality of pixels to be blurred corresponding to the letter pixel track are determined.
[0071] S108 , determining the blurring degree of each pixel to be blurred according to the distance between each pixel to be blurred and the letter pixel trajectory.
[0072] The terminal uses the letter pixel trajectory as a reference for determining the blur degree of each pixel to be blurred, and the blur degree of the pixel to be blurred increases or decreases in sequence as the distance from the letter pixel trajectory increases.
[0073] Optionally, the distance between the pixel to be blurred and the letter pixel trajectory is inversely proportional to its blur degree, and the blur degree of the pixel to be blurred covered by the letter pixel trajectory is determined as the maximum value. The closer the distance between other pixels to be blurred and the letter pixel trajectory, the higher their blur degree; the farther the distance from the letter pixel trajectory, the lower their blur degree.
[0074] Optionally, the distance between the pixel to be blurred and the letter pixel trajectory is proportional to its blur degree, and the blur degree of the pixel to be blurred covered by the letter pixel trajectory is determined as the minimum value. The closer the distance between other pixels to be blurred and the letter pixel trajectory, the lower their blur degree; the farther the distance from the letter pixel trajectory, the higher their blur degree.
[0075] S110, blurring the image to be processed based on the preset blurring degree of the letter pixel trajectory and the blurring degree of each pixel to be blurred.
[0076] The blur degree of the pixel to be blurred determines the blur effect of the pixel to be blurred. The higher the blur degree, the more blurred the pixel to be blurred after processing.
[0077] Optionally, when the distance between the pixel to be blurred and the letter pixel trajectory is inversely proportional to the blur degree, in the blurred image, the pixels closer to the letter pixel trajectory are more blurred; correspondingly, when the distance between the pixel to be blurred and the letter pixel trajectory is proportional to the blur degree, the pixels closer to the letter pixel trajectory are more blurred.
[0078] The disclosed embodiment obtains a picture to be processed; determines at least one target letter fuzzy model corresponding to the picture to be processed from a plurality of preset letter fuzzy models according to the line features and / or color block features of the picture to be processed, each of the preset letter fuzzy models including a letter pixel trajectory; for each of the target letter fuzzy models, determines a plurality of pixels to be blurred in the picture to be processed corresponding to the letter pixel trajectory; determines the blur degree of each pixel to be blurred according to the distance between each pixel to be blurred and the letter pixel trajectory; blurs the picture to be processed based on the preset blur degree of the letter pixel trajectory and the blur degree of each pixel to be blurred, and by selecting a matching target letter fuzzy model to perform blur processing on the picture according to the difference between the line features and the color block features of the picture to be processed, it is possible to perform more targeted blur processing on different pictures to be processed, thereby improving the flexibility of the picture blur processing method.
[0079] On the basis of the above embodiment, at least one target letter fuzzy model corresponding to the image to be processed is determined from multiple preset letter fuzzy models according to the line features and / or color block features of the image to be processed, including: determining at least one preset letter fuzzy model whose similarity between the letter pixel trajectory and the line distribution in the image to be processed is greater than a similarity threshold as the target letter fuzzy model; and / or determining at least one preset letter fuzzy model whose similarity between the letter pixel trajectory and the color block distribution in the image to be processed is greater than a similarity threshold as the target letter fuzzy model.
[0080] The line features of the image to be processed include the distribution of lines in the image to be processed, and the similarity between the letter pixel trajectory and the line distribution in the image to be processed is the degree of fit between the letter pixel trajectory and the line trend in the image to be processed. For example, for a road image with a perspective effect, the corresponding lines on both sides of the road gradually converge from near to far, and its line distribution is similar to the preset letter fuzzy model corresponding to the letter A; for another example, for a bridge image taken from above, the corresponding lines on both sides of the bridge are parallel to each other, and its line distribution is similar to the preset letter fuzzy model corresponding to the letter I.
[0081] The color block features in the image to be processed include the distribution of the color blocks in the image to be processed. Specifically, the connected pixels with the same or similar colors in the image to be processed are divided into the same color block, and the distribution of the color blocks of the same color reflects the shape of a single object in the image to be processed to a certain extent. The terminal selects at least one preset letter fuzzy model whose letter pixel trajectory has a similarity with the color block distribution in the image to be processed greater than a similarity threshold as the target letter fuzzy model, which can perform targeted fuzzy processing on a single object in the image to be processed.
[0082] In some embodiments, the image to be processed includes multiple areas to be processed, and determining at least one target letter fuzzy model corresponding to the image to be processed from multiple preset letter fuzzy models based on the line features and / or color block features of the image to be processed includes: for each of the areas to be processed, determining the target letter fuzzy model corresponding to the area to be processed from multiple preset letter fuzzy models based on the line features and / or color block features of the area to be processed.
[0083] For a single image to be processed, the terminal can determine a target letter fuzzy model for the image to be processed according to user needs; or divide the image to be processed into multiple areas to be processed, and determine a target letter fuzzy model for each area to be processed, that is, the image to be processed corresponds to multiple target letter fuzzy models, and the areas to be processed correspond to the target letter fuzzy models one by one.
[0084] Optionally, the multiple target letter fuzzy models corresponding to the image to be processed may be the same target letter fuzzy model or different target letter fuzzy models, which is not limited in this embodiment of the present disclosure.
[0085] The disclosed embodiment determines a target letter fuzzy model for each area to be processed, so that the target letter fuzzy model can be more closely aligned with the line features and / or color block features of the image to be processed, thereby processing the area to be processed separately according to each target letter fuzzy model, further improving the flexibility of the image blur processing method.
[0086] Figure 3 A flowchart of a method for image blurring provided by another embodiment of the present disclosure is shown in FIG. Figure 3 As shown, the method includes the following steps:
[0087] S301, obtaining a picture to be processed.
[0088] S302. Determine at least one target letter fuzzy model corresponding to the image to be processed from a plurality of preset letter fuzzy models according to line features and / or color block features of the image to be processed, each of the preset letter fuzzy models including a letter pixel trajectory.
[0089] Specifically, the implementation process and principle of S301-S302 and S102-S104 are consistent and will not be described in detail here.
[0090] S303: Determine a plurality of fixed trajectory points in an orderly arrangement in the fuzzy model of the target letter, wherein the fixed trajectory points include a starting point and an ending point in the pixel trajectory of the letter.
[0091] In each preset letter fuzzy model, a plurality of fixed trajectory points are included. These fixed trajectory points are arranged in a certain order. The letter pixel trajectory is formed by connecting the fixed trajectory points in order.
[0092] It should be noted that since the letter pixel trajectory is composed of several pixels, it can be regarded as a series of vectors. Therefore, unlike written letters, the starting point and the ending point in the letter pixel trajectory are not the starting point and the ending point in the writing order, but the starting point and the ending point of a series of vectors constituting the letter pixel trajectory. That is, when the direction of the letter pixel trajectory changes, there is a fixed trajectory point at the pixel where the direction changes.
[0093] Optionally, in each preset letter blur model, each fixed track point has its own number, which consists of two digits. The first digit is an uppercase letter, which determines whether two fixed track points are connected. If the letters are the same, they are connected; the second digit is a digital number, which confirms the order in which the fixed track points are connected. In some preset letter blur models, there is a fixed track point with two different numbers, such as A1 and A8, which means that the letter pixel trajectory starts from the fixed track point, passes through other fixed track points, and then returns to the fixed track point.
[0094] Figure 4 A schematic diagram of a preset letter fuzzy model provided in an embodiment of the present disclosure, such as Figure 4 As shown, in the preset letter fuzzy model of the letter A, the fixed trajectory points include A1~A14, B1~B2, among which the fixed trajectory points with the first bit as A are connected in sequence according to the order of numbers 1~14, and the fixed trajectory points with the first bit as B are connected in sequence according to the order of numbers 1~2, forming the letter pixel trajectory of the preset letter fuzzy model of the letter A.
[0095] Figure 5 A schematic diagram of a preset letter fuzzy model provided in an embodiment of the present disclosure, such as Figure 5 As shown, in the preset letter fuzzy model of the letter B, the fixed trajectory points include A1~A8, B1~B2, among which A1 overlaps with A8, the fixed trajectory points whose first position is A are connected in sequence according to the order of numbers 1 to 14, starting from A1 and finally returning to A1 (A8), and the fixed trajectory points whose first position is B are connected in sequence according to the order of numbers 1 to 2.
[0096] The settings of fixed trajectory points in other preset letter fuzzy models are similar and will not be repeated here.
[0097] Optionally, the fixed trajectory points can also be used to determine at least one target letter fuzzy model from preset letter fuzzy models. Specifically, at least one preset letter fuzzy model whose similarity between the fixed trajectory point distribution and the color block distribution in the image to be processed is greater than a similarity threshold is determined as the target letter fuzzy model.
[0098] S304: for each of the fixed track points, from the fixed track point to the next fixed track point, determine a new pixel point every preset pixel distance along the letter pixel track.
[0099] The preset pixel distance is determined by the user according to actual needs, and the preset pixel distance is related to the final image blur effect.
[0100] Optionally, the method further includes: determining a tiling state of the target letter fuzzy model in the image to be processed according to a position of each of the fixed trajectory points in the image to be processed.
[0101] The tiling state at least includes the position, direction and size of the target letter fuzzy model in the image to be processed.
[0102] Optionally, the position of the fixed track point in the image to be processed can be represented by four coordinates (a, b, c, d). A vertical line is drawn through the fixed track point to the upper, lower, left, and right edges of the image to be processed, the ratio of the length of the left vertical line to the length of the right vertical line is equal to the ratio of a to b, the ratio of the length of the upper vertical line to the length of the lower vertical line is equal to the ratio of c to d, the sum of a and b is 100%, and the sum of c and d is 100%.
[0103] Figure 6 Schematic diagram of determining pixels to be blurred provided by an embodiment of the present disclosure. Figure 6 As shown, taking the target letter fuzzy model of the letter L as an example, there are fixed trajectory points A1, A2, and A3 in the target letter fuzzy model of the letter L, and their coordinates are A1 (20%, 80%, 10%, 90%), A2 (20%, 80%, 90%, 10%), and A3 (80%, 20%, 10%, 90%) respectively.
[0104] According to the step of determining a new pixel point at every preset pixel distance, from fixed trajectory point A1 to fixed trajectory point A2, new pixel points X1 and X2 are determined in sequence, and from fixed trajectory point A2 to fixed trajectory point A3, new pixel points X3, X4, and X5 are determined in sequence.
[0105] S305. Taking each of the fixed trajectory points meeting the preset conditions and each of the newly added pixel points as the center, construct multiple letter pixel frames with a preset pixel frame radius, and the side length of the letter pixel frame is equal to the sum of twice the preset pixel frame radius and the side length of a single pixel.
[0106] Among them, the preset conditions are used to remove fixed trajectory points that are too close to the newly added pixel points.
[0107] Figure 7 A schematic diagram of a letter pixel frame provided by an embodiment of the present disclosure. Figure 7 As shown, the center point of the letter pixel frame is a fixed trajectory point that meets the preset conditions or a newly added pixel point, and the distance between the center point and the edge of the letter pixel frame is the preset pixel frame radius, that is, the side length of the letter pixel frame is equal to the sum of twice the preset pixel frame radius and the side length of a single pixel.
[0108] In some embodiments, when the preset pixel distance is equal to the preset pixel frame radius, if the distance between the newly added pixel point and the next fixed trajectory point is less than the preset pixel frame radius, it is determined that the next fixed trajectory point does not meet the preset conditions, and other newly added pixel points are determined from the next fixed trajectory point; or, when the preset pixel distance is equal to twice the preset pixel frame radius, if the distance between the newly added pixel point and the next fixed trajectory point is less than the preset pixel distance, it is determined that the next fixed trajectory point does not meet the preset conditions, and other newly added pixel points are determined from the next fixed trajectory point.
[0109] The disclosed embodiment provides two modes for determining newly added pixels, one is a letter pixel frame intersection mode, in which the preset pixel distance is equal to the preset pixel frame radius; the other is a letter pixel frame non-intersection mode, in which the preset pixel distance is equal to twice the preset pixel frame radius.
[0110] That is, if the user selects the letter pixel frame intersection mode, the preset pixel distance is determined to be equal to the preset pixel frame radius; or if the user selects the letter pixel frame non-intersection mode, the preset pixel distance is determined to be equal to twice the preset pixel frame radius.
[0111] Figure 8 A schematic diagram of the intersection mode of letter pixel frames provided in an embodiment of the present disclosure, such as Figure 8 As shown, the center point of the left letter pixel frame is recorded as O1, and the center point of the right letter pixel frame is recorded as O2. The distance between O1 and O2 is the preset pixel distance, which is also the preset pixel frame radius.
[0112] Fig. 9 A schematic diagram of a non-intersecting mode of letter pixel frames provided in an embodiment of the present disclosure, such as Fig. 9 As shown, the center point of the left letter pixel frame is recorded as P1, and the center point of the right letter pixel frame is recorded as P2. The distance between P1 and P2 is the preset pixel distance, which is also twice the preset pixel frame radius.
[0113] In the process of determining the newly added pixel points, since the distance between two adjacent fixed trajectory points is not necessarily an integer multiple of the preset pixel distance, there may be newly added pixel points that are too close to the next fixed trajectory point, and such the next fixed trajectory point is determined as a fixed trajectory point that does not meet the preset conditions.
[0114] Specifically, Figure 6 For example, it can be seen Figure 6The mode for determining the newly added pixel points used in the algorithm is the letter pixel frame non-intersection mode, where the distance between the newly added pixel point X2 and the fixed track point A2 is less than the preset pixel frame radius. At this time, it is determined that the fixed track point A2 is not a fixed track point that meets the preset conditions, and the letter pixel frame is not constructed at the fixed track point A2. The same is true for the newly added pixel point X5 and the fixed track point A3. Therefore, in the case of Figure 6 In the case shown, letter pixel frames are finally constructed with fixed trajectory point A1, newly added pixel point X1, newly added pixel point X2, newly added pixel point X3, newly added pixel point X4, and newly added pixel point X5 as the center respectively. Fixed trajectory point A2 and fixed trajectory point A3 are not fixed trajectory points that meet the preset conditions, and letter pixel frames are not constructed.
[0115] S306: Determine the pixels in the to-be-processed picture covered by each of the letter pixel frames as pixels to be blurred.
[0116] S307 , determining the blurring degree of each pixel to be blurred according to the distance between each pixel to be blurred and the letter pixel trajectory.
[0117] When the preset pixel distance is less than two times the preset pixel frame radius, for example, in the letter pixel frame intersection mode, there is a situation where the pixel to be blurred is covered by multiple letter pixel frames at the same time. At this time, for the same pixel to be blurred, it is necessary to superimpose the blurring degrees under multiple letter pixel frames, and the blurring effect is more obvious than the blurring degree determined under a single letter pixel frame.
[0118] S308: blurring the image to be processed based on the preset blurring degree of the letter pixel trajectory and the blurring degree of each pixel to be blurred.
[0119] In the embodiment of the present disclosure, if the user needs a more obvious blur effect, a larger preset pixel frame radius and letter pixel frame intersection mode can be set; conversely, if the overall rendering effect of the image to be processed needs to be retained, a smaller preset pixel frame radius can be selected.
[0120] The disclosed embodiment can realize image blur processing by combining the preset pixel distance, preset pixel frame radius, and determination mode of newly added pixels determined by the user according to actual blur effect needs, with a predetermined preset letter blur model. The implementation speed is faster, thereby improving the efficiency of the image blur processing method.
[0121] It should be understood that, although the steps in the above-mentioned flowcharts are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps is not strictly limited in order, and these steps can be executed in other orders. Moreover, at least a part of the steps in the above-mentioned flowcharts may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these sub-steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the sub-steps or stages of other steps.
[0122] Fig.10 This is a schematic diagram of the structure of the image blur processing device provided by the embodiment of the present disclosure. Fig.10 As shown, the image blur processing device 100 includes: an acquisition module 101, a first determination module 102, a second determination module 103, a third determination module 104, and a processing module 105; wherein the acquisition module 101 is used to acquire the image to be processed; the first determination module 102 is used to determine at least one target letter blur model corresponding to the image to be processed from multiple preset letter blur models according to the line features and / or color block features of the image to be processed, and each of the preset letter blur models includes a letter pixel trajectory; the second determination module 103 is used to determine, for each of the target letter blur models, a plurality of pixels to be blurred in the image to be processed corresponding to the letter pixel trajectory; the third determination module 104 is used to determine the blur degree of each pixel to be blurred according to the distance between each pixel to be blurred and the letter pixel trajectory; the processing module 105 is used to blur the image to be processed based on the preset blur degree of the letter pixel trajectory and the blur degree of each pixel to be blurred.
[0123] Optionally, the first determination module 102 is specifically used to determine that at least one preset letter fuzzy model whose similarity between the letter pixel trajectory and the line distribution in the image to be processed is greater than a similarity threshold is the target letter fuzzy model; and / or determine that at least one preset letter fuzzy model whose similarity between the letter pixel trajectory and the color block distribution in the image to be processed is greater than a similarity threshold is the target letter fuzzy model.
[0124] Optionally, the image to be processed includes multiple areas to be processed, and the first determination module 102 is specifically used to determine, for each of the areas to be processed, a target letter fuzzy model corresponding to the area to be processed from multiple preset letter fuzzy models according to the line features and / or color block features of the area to be processed.
[0125] Optionally, the second determination module 103 includes a first determination unit 1031, a second determination unit 1032, a construction unit 1033, and a third determination unit 1034; wherein the first determination unit 1031 is used to determine a plurality of orderly arranged fixed trajectory points in the target letter blur model, the fixed trajectory points including a starting point and an ending point in the letter pixel trajectory; the second determination unit 1032 is used to determine, for each of the fixed trajectory points, a newly added pixel point every preset pixel distance along the letter pixel trajectory from the fixed trajectory point to the next fixed trajectory point; the construction unit 1033 is used to construct a plurality of letter pixel frames with a preset pixel frame radius, with each of the fixed trajectory points that meets the preset conditions and each of the newly added pixel points as the center, and the side length of the letter pixel frame is equal to the sum of twice the preset pixel frame radius and the side length of a single pixel; the third determination unit 1034 is used to determine the pixels in the to-be-processed image covered by each of the letter pixel frames as pixels to be blurred.
[0126] Optionally, the second determination unit 1032 is used to, when the preset pixel distance is equal to the preset pixel frame radius, if the distance between the newly added pixel point and the next fixed trajectory point is less than the preset pixel frame radius, determine that the next fixed trajectory point does not meet the preset conditions, and continue to determine other newly added pixel points from the next fixed trajectory point; or, when the preset pixel distance is equal to twice the preset pixel frame radius, if the distance between the newly added pixel point and the next fixed trajectory point is less than the preset pixel distance, determine that the next fixed trajectory point does not meet the preset conditions, and continue to determine other newly added pixel points from the next fixed trajectory point.
[0127] Optionally, the second determination unit 1032 is also used to determine that the preset pixel distance is equal to the preset pixel frame radius if the user selects the letter pixel frame intersection mode; or if the user selects the letter pixel frame non-intersection mode, determine that the preset pixel distance is equal to twice the preset pixel frame radius.
[0128] Optionally, the second determination module 103 further includes a fourth determination unit 1035, which is used to determine the tiling state of the target letter fuzzy model in the image to be processed according to the position of each of the fixed trajectory points in the image to be processed.
[0129] Fig.10 The image blur processing device of the illustrated embodiment can be used to execute the technical solution of the above-mentioned method embodiment. Its implementation principle and technical effect are similar and will not be described in detail here.
[0130] For the specific definition of the image blur processing device, please refer to the definition of the image blur processing method above, which will not be repeated here. Each module in the above-mentioned image blur processing device can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
[0131] In one embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as follows: Fig.11 As shown. The computer device includes a processor, a memory, a communication interface, a display screen and an input device connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be achieved through WIFI, an operator network, near field communication (NFC) or other technologies. When the computer program is executed by the processor, a method for blurring an image is implemented. The display screen of the computer device can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covered on the display screen, or a button, a trackball or a touch pad set on the computer device housing, or an external keyboard, touch pad or mouse, etc.
[0132] Those skilled in the art will understand that Fig.11 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0133] In one embodiment, the image blur processing device provided by the present application can be implemented in the form of a computer program. The computer program can be Fig.11 The memory of the computer device can store various program modules constituting the image blur processing device, for example, Fig.10 The acquisition module 101, the first determination module 102, the second determination module 103, the third determination module 104, and the processing module 105 are shown. The computer program composed of each program module enables the processor to execute the steps of the image blur processing method of each embodiment of the present application described in this specification.
[0134] For example, Fig.11 The computer device shown can be Fig.10 The acquisition module 101 in the image blur processing device shown acquires the image to be processed. The computer device can determine at least one target letter blur model corresponding to the image to be processed from multiple preset letter blur models according to the line features and / or color block features of the image to be processed through the first determination module 102, and each of the preset letter blur models includes a letter pixel trajectory; the computer device can determine multiple pixels to be blurred in the image to be processed corresponding to the letter pixel trajectory for each target letter blur model through the second determination module 103; the computer device can determine the blur degree of each pixel to be blurred according to the distance between each pixel to be blurred and the letter pixel trajectory through the third determination module 104; the computer device can perform blur processing on the image to be processed based on the preset blur degree of the letter pixel trajectory and the blur degree of each pixel to be blurred through the processing module 105.
[0135] In one embodiment, a computer device is provided, including a memory and a processor, the memory storing a computer program, and the processor implementing the following steps when executing the computer program: obtaining a picture to be processed; determining at least one target letter blur model corresponding to the picture to be processed from a plurality of preset letter blur models according to line features and / or color block features of the picture to be processed, each of the preset letter blur models including a letter pixel trajectory; for each of the target letter blur models, determining a plurality of pixels to be blurred in the picture to be processed corresponding to the letter pixel trajectory; determining a blur degree of each pixel to be blurred according to a distance between each pixel to be blurred and the letter pixel trajectory; and blurring the picture to be processed based on the preset blur degree of the letter pixel trajectory and the blur degree of each pixel to be blurred.
[0136] In one embodiment, when the processor executes the computer program, the following steps are also implemented: determining at least one preset letter fuzzy model whose similarity between the letter pixel trajectory and the line distribution in the image to be processed is greater than a similarity threshold as the target letter fuzzy model; and / or determining at least one preset letter fuzzy model whose similarity between the letter pixel trajectory and the color block distribution in the image to be processed is greater than a similarity threshold as the target letter fuzzy model.
[0137] In one embodiment, when the processor executes the computer program, the following steps are also implemented: for each of the areas to be processed, based on the line features and / or color block features of the area to be processed, a target letter fuzzy model corresponding to the area to be processed is determined from a plurality of preset letter fuzzy models.
[0138] In one embodiment, when the processor executes the computer program, the following steps are also implemented: determining a plurality of orderly arranged fixed trajectory points in the target letter blur model, the fixed trajectory points including the starting point and the ending point in the letter pixel trajectory; for each of the fixed trajectory points, from the fixed trajectory point to the next fixed trajectory point, determining a new pixel point every preset pixel distance along the letter pixel trajectory; taking each of the fixed trajectory points that meets the preset conditions and each of the new pixel points as the center, constructing a plurality of letter pixel frames with a preset pixel frame radius, the side length of the letter pixel frame being equal to the sum of twice the preset pixel frame radius and the side length of a single pixel; and determining the pixels in the to-be-processed image covered by each of the letter pixel frames as pixels to be blurred.
[0139] In one embodiment, the processor further implements the following steps when executing the computer program: when the preset pixel distance is equal to the preset pixel frame radius, if the distance between the newly added pixel point and the next fixed trajectory point is less than the preset pixel frame radius, it is determined that the next fixed trajectory point does not meet the preset conditions, and other newly added pixel points are determined from the next fixed trajectory point; or, when the preset pixel distance is equal to twice the preset pixel frame radius, if the distance between the newly added pixel point and the next fixed trajectory point is less than the preset pixel distance, it is determined that the next fixed trajectory point does not meet the preset conditions, and other newly added pixel points are determined from the next fixed trajectory point.
[0140] In one embodiment, when the processor executes the computer program, the following steps are also implemented: if the user selects the letter pixel frame intersection mode, the preset pixel distance is determined to be equal to the preset pixel frame radius; or if the user selects the letter pixel frame non-intersection mode, the preset pixel distance is determined to be equal to twice the preset pixel frame radius.
[0141] In one embodiment, when the processor executes the computer program, the following steps are further implemented: according to the position of each of the fixed trajectory points in the image to be processed, the tiling state of the target letter fuzzy model in the image to be processed is determined.
[0142] The disclosed embodiment selects a matching target letter blur model to perform blur processing on the image according to the differences in line features and color block features of the image to be processed, thereby being able to perform more targeted blur processing on different images to be processed and improving the flexibility of the image blur processing method.
[0143] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented: Step A; obtaining a picture to be processed; determining at least one target letter blur model corresponding to the picture to be processed from a plurality of preset letter blur models according to the line features and / or color block features of the picture to be processed, each of the preset letter blur models including a letter pixel trajectory; for each of the target letter blur models, determining a plurality of pixels to be blurred in the picture to be processed corresponding to the letter pixel trajectory; determining a blur degree of each pixel to be blurred according to a distance between each pixel to be blurred and the letter pixel trajectory; blurring the picture to be processed based on the preset blur degree of the letter pixel trajectory and the blur degree of each pixel to be blurred.
[0144] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: determining at least one preset letter fuzzy model whose similarity between the letter pixel trajectory and the line distribution in the image to be processed is greater than a similarity threshold as the target letter fuzzy model; and / or determining at least one preset letter fuzzy model whose similarity between the letter pixel trajectory and the color block distribution in the image to be processed is greater than a similarity threshold as the target letter fuzzy model.
[0145] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: for each of the areas to be processed, based on the line features and / or color block features of the area to be processed, a target letter fuzzy model corresponding to the area to be processed is determined from a plurality of preset letter fuzzy models.
[0146] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: determining a plurality of orderly arranged fixed trajectory points in the target letter blur model, the fixed trajectory points including the starting point and the ending point in the letter pixel trajectory; for each of the fixed trajectory points, from the fixed trajectory point to the next fixed trajectory point, determining a new pixel point every preset pixel distance along the letter pixel trajectory; taking each of the fixed trajectory points that meet the preset conditions and each of the new pixel points as the center, constructing a plurality of letter pixel frames with a preset pixel frame radius, the side length of the letter pixel frame being equal to the sum of twice the preset pixel frame radius and the side length of a single pixel; and determining the pixels in the to-be-processed image covered by each of the letter pixel frames as pixels to be blurred.
[0147] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: when the preset pixel distance is equal to the preset pixel frame radius, if the distance between the newly added pixel point and the next fixed trajectory point is less than the preset pixel frame radius, it is determined that the next fixed trajectory point does not meet the preset conditions, and other newly added pixel points are determined from the next fixed trajectory point; or, when the preset pixel distance is equal to twice the preset pixel frame radius, if the distance between the newly added pixel point and the next fixed trajectory point is less than the preset pixel distance, it is determined that the next fixed trajectory point does not meet the preset conditions, and other newly added pixel points are determined from the next fixed trajectory point.
[0148] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented: if the user selects the letter pixel frame intersection mode, the preset pixel distance is determined to be equal to the preset pixel frame radius; or if the user selects the letter pixel frame non-intersection mode, the preset pixel distance is determined to be equal to twice the preset pixel frame radius.
[0149] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: according to the position of each of the fixed trajectory points in the image to be processed, the tiling state of the target letter fuzzy model in the image to be processed is determined.
[0150] The disclosed embodiment selects a matching target letter blur model to perform blur processing on the image according to the differences in line features and color block features of the image to be processed, thereby being able to perform more targeted blur processing on different images to be processed and improving the flexibility of the image blur processing method.
[0151] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memory. Non-volatile memory may include read-only memory (ROM), magnetic tape, floppy disk, flash memory or optical memory, etc. Volatile memory may include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in various forms, such as static random access memory (SRAM) and dynamic random access memory (DRAM).
[0152] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0153] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.
Claims
1. A method for image blurring, characterized in that: The method comprises: Get the image to be processed; Determine at least one target letter fuzzy model corresponding to the image to be processed from a plurality of preset letter fuzzy models according to the line features and / or color block features of the image to be processed, each of the preset letter fuzzy models including a letter pixel trajectory; For each of the target letter blur models, determining a plurality of pixels to be blurred corresponding to the letter pixel trajectory in the image to be processed; Determining the blurring degree of each pixel to be blurred according to the distance between each pixel to be blurred and the letter pixel track; Based on the preset blur degree of the letter pixel trajectory and the blur degree of each of the pixels to be blurred, the image to be processed is blurred.
2. The method according to claim 1, characterized in that The step of determining at least one target letter fuzzy model corresponding to the image to be processed from a plurality of preset letter fuzzy models according to the line features and / or color block features of the image to be processed comprises: Determine at least one preset letter fuzzy model whose similarity between the letter pixel trajectory and the line distribution in the to-be-processed image is greater than a similarity threshold as the target letter fuzzy model; and / or At least one preset letter fuzzy model whose similarity between the letter pixel trajectory and the color block distribution in the to-be-processed picture is greater than a similarity threshold is determined as the target letter fuzzy model.
3. The method according to claim 1, characterized in that The image to be processed includes a plurality of areas to be processed, and determining at least one target letter fuzzy model corresponding to the image to be processed from a plurality of preset letter fuzzy models according to line features and / or color block features of the image to be processed includes: For each of the to-be-processed areas, a target letter fuzzy model corresponding to the to-be-processed area is determined from a plurality of preset letter fuzzy models according to line features and / or color block features of the to-be-processed area.
4. The method according to claim 1, characterized in that: The step of determining, for each target letter blur model, a plurality of pixels to be blurred corresponding to the letter pixel trajectory in the image to be processed includes: Determine a plurality of fixed trajectory points in the fuzzy model of the target letter, wherein the fixed trajectory points include a starting point and an ending point in the pixel trajectory of the letter; For each of the fixed track points, from the fixed track point to the next fixed track point, a new pixel point is determined along the letter pixel track at every preset pixel distance; Taking each of the fixed trajectory points meeting the preset conditions and each of the newly added pixel points as the center, a plurality of letter pixel frames are constructed with a preset pixel frame radius, and the side length of the letter pixel frame is equal to the sum of twice the preset pixel frame radius and the side length of a single pixel; The pixels in the to-be-processed picture covered by each of the letter pixel frames are determined as pixels to be blurred.
5. The method according to claim 4, characterized in that For each of the fixed track points, from the fixed track point to the next fixed track point, a new pixel point is determined along the letter pixel track at every preset pixel distance, including: When the preset pixel distance is equal to the preset pixel frame radius, if the distance between the newly added pixel point and the next fixed trajectory point is less than the preset pixel frame radius, it is determined that the next fixed trajectory point does not meet the preset condition, and other newly added pixel points are determined from the next fixed trajectory point; or When the preset pixel distance is equal to twice the preset pixel frame radius, if the distance between the newly added pixel point and the next fixed trajectory point is less than the preset pixel distance, it is determined that the next fixed trajectory point does not meet the preset conditions, and other newly added pixel points are determined starting from the next fixed trajectory point.
6. The method according to claim 5, characterized in that After determining a plurality of ordered fixed track points in the target letter fuzzy model, the method further includes: If the user selects the letter pixel frame intersection mode, determining that the preset pixel distance is equal to the preset pixel frame radius; or If the user selects the letter pixel frame non-intersection mode, the preset pixel distance is determined to be equal to twice the radius of the preset pixel frame.
7. The method according to claim 4, characterized in that After determining a plurality of ordered fixed track points in the target letter fuzzy model, the method further includes: According to the position of each of the fixed trajectory points in the image to be processed, the tiling state of the target letter fuzzy model in the image to be processed is determined.
8. A device for image blur processing, characterized in that: include: The acquisition module is used to obtain the image to be processed; A first determination module is used to determine at least one target letter fuzzy model corresponding to the image to be processed from a plurality of preset letter fuzzy models according to line features and / or color block features of the image to be processed, each of the preset letter fuzzy models including a letter pixel trajectory; A second determination module is used to determine, for each target letter blur model, a plurality of pixels to be blurred corresponding to the letter pixel trajectory in the image to be processed; A third determination module, used for determining the blur degree of each pixel to be blurred according to the distance between each pixel to be blurred and the letter pixel track; A processing module is used to blur the image to be processed based on a preset blur degree of the letter pixel trajectory and a blur degree of each pixel to be blurred.
9. A computer device, characterized in that: include: Memory; processor; as well as Computer programs; The computer program is stored in the memory and is configured to be executed by the processor to implement the method according to any one of claims 1 to 7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.
