Image processing method and apparatus, device, and medium

By obtaining the target line area and the target area in the image, and the gradient deficiency treatment of it, it solves the aliasing problem in the image, enhances the user's perception experience, and reduces the operation cost.

WO2025016331A1PCT designated stage expired Publication Date: 2025-01-23BEIJING ZITIAO NETWORK TECH CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2024/105295
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2023-07-14
Filing Date
2024-07-12
Publication Date
2025-01-23

AI Technical Summary

Technical Problem

Common jagged problems in images affect users' perception, especially when the size or magnification of the canvas changes.

Method used

By obtaining the target line area in the image to be processed, the target area in the target line area is determined, and gradient deficiency treatment of the target sub -area is processed. The transparency of the pixel point near the target line area near the target line area is greater than the transparency of the pixel dot at the target side of the target line area.

Benefits of technology

It effectively alleviates the aliasing problem and improves the user's visual experience. The computing cost is not high and the performance consumption is small.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2024105295_23012025_PF_FP_ABST
    Figure CN2024105295_23012025_PF_FP_ABST
Patent Text Reader

Abstract

Embodiments of the present disclosure relate to an image processing method and apparatus, a device, and a medium. The method comprises: obtaining a target line region in an image to be processed; determining a target sub-region in the target line region; and performing gradient blurring processing on the target sub-region, the transparency of a pixel point of a target edge in the target sub-region which is close to the target line region being greater than the transparency of a pixel point of a target edge in the target sub-region which is away from the target line region, and the target edges each being an edge at which the target sub-region and the target line region coincide.
Need to check novelty before this filing date? Find Prior Art

Description

Image processing method, device, equipment and medium

[0001] CROSS-REFERENCE TO RELATED APPLICATIONS

[0002] This application claims priority to Chinese invention patent application number 202310869000.4, entitled “Image processing methods, devices, equipment and media” and filed on July 14, 2023, and the entirety of that application is incorporated herein by reference. Technical Field

[0003] The present disclosure relates to the field of image processing technology, and in particular to an image processing method, apparatus, device, and medium. Background Art

[0004] The aliasing problem is a common problem in the image field. Factors such as canvas size or magnification level will affect the obviousness of aliasing in the image, thereby affecting the user's perception.

[0005] Summary of the Invention

[0006] In order to solve the above technical problems or at least partially solve the above technical problems, the present disclosure provides an image processing method, apparatus, device and medium.

[0007] An embodiment of the present disclosure provides an image processing method, the method comprising: obtaining a target line region in an image to be processed; determining a target subregion in the target line region; and performing a gradient blurring process on the target subregion, wherein the transparency of pixel points of a target edge in the target subregion close to the target line region is greater than the transparency of pixel points of a target edge in the target subregion far from the target line region, and the target edge is an edge where the target subregion overlaps with the target line region.

[0008] Optionally, determining the target sub-area in the target line area includes: determining a target edge from all edges of the target line area without cropping the target line area, and obtaining a first adjustable parameter corresponding to the target edge; determining the target sub-area based on the target edge and the first adjustable parameter; wherein the first adjustable parameter is used to determine an edge in the target sub-area that does not overlap with the target edge.

[0009] Optionally, determining the target sub-area in the target line area includes: in the case of cropping the target line area, obtaining a cropping edge corresponding to the target line area; determining the cropped target line area based on the cropping edge, determining a target edge from all edges of the cropped target line area, and obtaining a second adjustable parameter corresponding to the target edge; determining the target sub-area based on the target edge and the second adjustable parameter; wherein the second adjustable parameter is used to determine an edge in the cropped target line area that does not overlap with the target edge.

[0010] Optionally, the target line area has multiple target edges; each target edge corresponds to a target sub-area, and the target edge is the long side of the corresponding target sub-area.

[0011] Optionally, the gradient blurring processing of the target sub-area includes: obtaining the original pixel values ​​and position coordinates corresponding to the pixel points in the target sub-area; determining the transparency corresponding to the pixel points in the target sub-area based on the position coordinates corresponding to the pixel points in the target sub-area; and determining the actual pixel values ​​of the pixel points in the target sub-area based on the original pixel values ​​and transparency corresponding to the pixel points in the target sub-area.

[0012] Optionally, the determining the transparency corresponding to the pixel points in the target sub-region based on the position coordinates corresponding to the pixel points in the target sub-region includes: determining the transparency of the edge pixel points on the adjacent edge having an intersection with the target edge in the target sub-region based on the position coordinates of the top pixel point of the target edge of the target sub-region and the position coordinates of the edge pixel points on the adjacent edge in the target sub-region; wherein the transparency of the edge pixel points close to the top pixel point is greater than the transparency of the edge pixel points far from the top pixel point; determining that the transparency of the associated pixel points corresponding to the edge pixel points in the target sub-region is equal to the transparency of the edge pixel points; wherein the distance between the associated pixel points and the target edge is equal to the distance between the edge pixel points and the target edge.

[0013] Optionally, the top pixel point on the target edge is completely transparent, and the top pixel point on the adjacent edge that is farthest from the top pixel point is completely opaque.

[0014] Optionally, obtaining the target line area in the image to be processed includes: in response to receiving a user's request to add graphics to the image to be processed, drawing a line corresponding to the graphics adding request, and determining the target line area in the image to be processed based on the line.

[0015] An embodiment of the present disclosure also provides an image processing device, including: a line area acquisition module, used to acquire a target line area in an image to be processed; a sub-area determination module, used to determine a target sub-area in the target line area; and a blur processing module, used to perform a gradual blur processing on the target sub-area, wherein the transparency of the pixel points of the target edge in the target sub-area close to the target line area is greater than the transparency of the pixel points of the target edge in the target sub-area far from the target line area, and the target edge is the edge where the target sub-area overlaps with the target line area.

[0016] An embodiment of the present disclosure also provides an electronic device, which includes: a processor; a memory for storing executable instructions of the processor; the processor is used to read the executable instructions from the memory and execute the instructions to implement the image processing method provided by the embodiment of the present disclosure.

[0017] An embodiment of the present disclosure further provides a computer-readable storage medium, wherein the storage medium stores a computer program, and the computer program is used to execute the image processing method provided by the embodiment of the present disclosure.

[0018] The embodiments of the present disclosure further provide a computer program product, which includes instructions. When the instructions are executed by a processor, the image processing method provided by the embodiments of the present disclosure is implemented.

[0019] The technical solution provided by the embodiments of the present disclosure can obtain a target line region in a processed image and further determine a target subregion within the target line region, thereby performing a gradual blurring process on the target subregion. The transparency of pixels in the target subregion that are closer to the target edge of the target line region (i.e., the edge where the target subregion and the target line region overlap) is greater than the transparency of pixels in the target subregion that are farther from the target edge. Because the target subregion and the target line region have overlapping edges, the target subregion can be considered the edge region corresponding to the target line region.

[0020] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present disclosure, nor are they intended to limit the scope of the present disclosure. Other features of the present disclosure will become readily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] 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.

[0022] In order to more clearly illustrate the embodiments of the present disclosure or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.

[0023] FIG1 is a schematic diagram of an edge sawtooth provided by an embodiment of the present disclosure;

[0024] FIG2 is a schematic flow chart of an image processing method provided by an embodiment of the present disclosure;

[0025] FIG3 is a schematic diagram of a target line area provided by an embodiment of the present disclosure;

[0026] FIG4a is a schematic diagram of determining a target sub-region according to an embodiment of the present disclosure;

[0027] FIG4b is a schematic diagram of determining a target sub-region according to an embodiment of the present disclosure;

[0028] FIG4c is a schematic diagram of determining a target sub-region according to an embodiment of the present disclosure;

[0029] FIG4d is a schematic diagram of determining a target sub-region according to an embodiment of the present disclosure;

[0030] FIG5 is a schematic diagram of a target line area provided by an embodiment of the present disclosure;

[0031] FIG6 is a schematic diagram of processing a target line area according to an embodiment of the present disclosure;

[0032] FIG7 is a schematic diagram of processing a target line area according to an embodiment of the present disclosure;

[0033] FIG8 is a schematic diagram of processing a target line area according to an embodiment of the present disclosure;

[0034] FIG9 is a schematic diagram of processing a target line area according to an embodiment of the present disclosure;

[0035] FIG10 is a schematic flow chart of an image processing method provided by an embodiment of the present disclosure;

[0036] FIG11 is a schematic structural diagram of an image processing device provided by an embodiment of the present disclosure;

[0037] FIG12 is a schematic structural diagram of an electronic device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION

[0038] 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 therein can be combined with each other in the absence of conflict.

[0039] 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.

[0040] In practical applications, image aliasing is quite common. For example, the smaller the canvas and the greater the degree of magnification, the more obvious the aliasing is. For ease of understanding, please refer to the schematic diagram of edge aliasing shown in Figure 1. The left figure in Figure 1 is a rectangle, and the right figure in Figure 1 is the clearly visible stepped aliasing after the rectangle is magnified. The main reason for the aliasing is that the rasterization stage needs to determine the fragments covered by the shape. Taking a triangle as an example, if the center point of a pixel is within the triangle, then the pixel is determined to be within the triangle, and a square fragment will be generated at the pixel position. Otherwise, the pixel is determined not to be within the triangle, and no fragment will be generated at the pixel position. In other words, the pixels in the image are all displayed in the form of square fragments, so the stepped aliasing is clearly displayed when magnified. In particular, the stepped aliasing in the oblique line shown in Figure 1 will be more obvious. This phenomenon can be called edge aliasing. The primary processing method used in related technologies for full-screen anti-aliasing is to perform a weighted calculation on every pixel in the entire image. This results in significant performance overhead, resulting in additional memory and CPU consumption, particularly in high-frequency rendering. Furthermore, this method is difficult to control and inflexible. To address at least one of the above issues, the presently disclosed embodiments provide an image processing method, apparatus, device, and medium, which are described in detail below.

[0041] FIG2 is a flow chart of an image processing method provided by an embodiment of the present disclosure. The method can be performed by an image processing device, wherein the device can be implemented using software and / or hardware and can generally be integrated into an electronic device. As shown in FIG2 , the method mainly includes the following steps S202 to S206:

[0042] Step S202: Acquire a target line area in the image to be processed.

[0043] In practical applications, any line actually has a certain width. The difference is that the widths of lines of different thicknesses are different, so each line is actually a strip-shaped area. In some implementation examples, the lines in the image to be processed that need to be repaired for aliasing can themselves be regarded as target line areas. For ease of understanding, please refer to a schematic diagram of a target line area shown in Figure 3. The lines have a certain width (or thickness). In Figure 3, the four vertices of the thick line are represented by ABCD. In practical applications, at least two triangles can be constructed when rendering the thick line, such as rendering triangle ABC and triangle BCD in sequence, so that a rectangular line can be rendered. The above is only an example. In practical applications, rectangular lines can also be directly rendered, and there is no limitation here.

[0044] The disclosed embodiment provides an example of a method for obtaining a target line area, such as, in response to receiving a user's request to add graphics to an image to be processed, drawing lines corresponding to the graphic addition request, and determining a target line area in the image to be processed based on the lines. For example, a user adds the required graphics according to demand to an existing image (i.e., the image to be processed) through image editing software. The graphics can be graphics of various shapes such as straight lines, triangles, and polygons. It can be understood that lines are the basic elements of graphic composition. In order to avoid jagged edges in the graphics added by the user and affect the visual experience, the lines corresponding to the graphic addition request can be used as the target line area for jagged edge repair. The above is only an example. In actual applications, all lines or specified lines involved in the image rendering and drawing process can also be directly used as the target line area for jagged edge repair, which is not limited here.

[0045] Step S204: determining a target sub-region in the target line region.

[0046] To ensure the effectiveness of anti-aliasing, enhance the user experience, and further reduce the required computational costs, in the disclosed embodiment, rather than directly processing every pixel in the entire target line area, a target sub-area to be processed can be pre-determined so that processing can be performed on that target sub-area later. For example, the target sub-area can be an edge sub-area of ​​the target line area itself, or an edge sub-area of ​​the target line area in the remaining area after cropping.

[0047] For ease of understanding, the embodiments of the present disclosure illustrate schematic diagrams for determining four types of target sub-regions, FIG4a, FIG4b, FIG4c, and FIG4d. In FIG4a, it is illustrated that Aa1c1C can be a target sub-region, and Bb1d1D can be a target sub-region. The above two target sub-regions are essentially edge sub-regions determined by using the two long sides of the target line region ABCD as target edges. In FIG4b, it is illustrated that Aa2b2B can be a target sub-region, and Cc2d2D can be a target sub-region. The above two target sub-regions are essentially edge sub-regions determined by using the two short sides (also called wide sides) of the target line region ABCD as target edges. In practical applications, Aa1c1C, Bb1d1D, Aa2b2B, and Cc2d2D can all be processed as target sub-regions at the same time, so that the four target edges (AC, BD, AB, CD) can all be repaired with aliasing. Furthermore, the embodiments of the present disclosure take into account that the target line area may be cropped in some scenarios. Taking FE as the cropping edge as an example, as shown in FIG4c , FE crops the target line area ABCD into two parts, namely AFEC and FBDE. If AFEC is retained after cropping, the target sub-areas can be Aa1c1C and faFEec respectively; if FBDE is retained after cropping, the target sub-areas can be FfbedE and b1BDd1 respectively. The above target sub-areas are edge sub-areas determined based on the cropped rectangular edges (AC, BD, EF). As shown in FIG4c , FE crops the target line area ABCD into two parts, namely AFEC and FBDE. If AFEC is retained after cropping, the target sub-areas can be AFf1a2 and c2e1EC respectively; if FBDE is retained after cropping, the target sub-areas can be FBb2f2 and e2d2DE respectively. In practical applications, taking AFEC retained after cropping as an example, Aa1c1C, faFEec, AFf1a2 and c2e1EC can be processed as target sub-regions respectively, that is, each target sub-region is subjected to aliasing repair processing respectively, so that the aliasing of the four edges of the target sub-region after cropping can be repaired without affecting the user's perception. The processing method of retaining FBDE after cropping is the same and will not be repeated here.

[0048] In step S206, a gradual blurring process is performed on the target sub-region, wherein the transparency of the pixels at the target edge in the target sub-region near the target line region is greater than the transparency of the pixels at the target edge in the target sub-region far from the target line region, and the target edge is the edge where the target sub-region overlaps with the target line region. In other words, the gradual blurring process primarily involves varying the transparency of the pixels in the target sub-region (also referred to as the edge sub-region). By applying varying degrees of transparency to the pixels near the edge, the user can be made to see no jagged edges, effectively alleviating the poor visual experience caused by jagged lines in the image.

[0049] In practical applications, the target line area may have one or more target edges. Specifically, the edge to be repaired for aliasing may be used as the target edge as required. The target edge of the target line area, i.e., the edge to be repaired for aliasing corresponding to the target line area, may be the original edge of the target line area or the cropped edge of the target line area. Each target edge corresponds to a target sub-area, and the target edge is the long side of the corresponding target sub-area. Specifically, it may be an edge where the target sub-area completely overlaps with the target line area or the cropped target line area. For example, in Figure 4a, the target edge of target subregion Aa1c1C is AC, and the target edge of target subregion Bb1d1D is BD. In Figure 4b, the target edge of target subregion Aa2b2B is AB, and the target edge of target subregion Cc2d2D is CD. In Figure 4c, FE crops the target line region ABCD into two parts, AFEC and FBDE. If AFEC is retained after cropping, the target edge of target subregion Aa1c1C is AC, and the target edge of target subregion faFEec is FE. If FBDE is retained after cropping, the target edge of target subregion FfbedE is FE, and the target edge of target subregion b1BDd1 is BD. In Figure 4d, if AFEC is retained after cropping, the target edge of target subregion AFf1a2 is AF, and the target edge of target subregion c2e1EC is CE. If FBDE is retained after cropping, the target edge of target subregion FBb2f2 is FB, and the target edge of target subregion e2d2DE is DE.

[0050] By applying varying degrees of transparency to pixels near the edges, users can no longer see aliasing, effectively alleviating the poor visual experience caused by aliasing in lines in the image.

[0051] Since the target sub-region and the target line region have overlapping edges, the target sub-region can be regarded as the edge region corresponding to the target line region. By performing a gradient blurring process on the edge region, not only can the aliasing problem be effectively alleviated, but the computational cost is also low and the performance consumption is small.

[0052] The key to determining the target sub-region is to determine whether the target line region will be cropped. In practical applications, whether the target line region should be cropped can be determined based on specific business needs or user needs. For example, a preset cropping configuration for the target line region can be obtained, and whether the target line region needs to be cropped can be determined based on the cropping configuration. Another example is that upon receiving a cropping instruction for the target line region, it can be determined that the target line region needs to be cropped. The specific settings can be flexible and are not limited here. The present disclosure proposes two main implementation methods for determining the target sub-region in the target line region, which can be implemented with reference to the following implementation methods 1 and 2:

[0053] Implementation method one:

[0054] Without cropping the target line region, a target edge is determined from all edges of the target line region, and a first adjustable parameter corresponding to the target edge is obtained. A target subregion is determined based on the target edge and the first adjustable parameter, wherein the first adjustable parameter is used to determine edges in the target subregion that do not overlap with the target edge. Taking target edge AC of target subregion Aa1c1C in Figure 4a as an example, the first adjustable parameter corresponding to target edge AC is used to determine the positions of a1 and c1. This can also be understood as the first adjustable parameter being used to determine the lengths of Aa1 and Cc1, thereby determining Aa1, Cc1, and a1c1. Similarly, the first adjustable parameter corresponding to target edge BD of target subregion Bb1d1D is used to determine the positions of b1 and d1, thereby determining Bb1, Dd1, and b1d1. Taking the target edge AB of the target sub-area Aa2b2B in Figure 4b as an example, the first adjustable parameter corresponding to the target edge AB is used to determine the position of a2 and the position of b2. It can also be understood that the first adjustable parameter is used to determine the lengths of Aa2 and Bb2, thereby determining Aa2, Bb2 and a2b2.

[0055] Implementation method 2:

[0056] In the case of cropping a target line area, a cropping edge corresponding to the target line area is obtained; the cropped target line area is determined based on the cropping edge, a target edge is determined from all edges of the cropped target line area, and a second adjustable parameter corresponding to the target edge is obtained; a target sub-area is determined based on the target edge and the second adjustable parameter; wherein the second adjustable parameter is used to determine edges in the cropped target line area that do not overlap with the target edge.

[0057] For example, in Figures 4c and 4d, the cropped edge is FE. Taking the target line area after cropping in Figure 4c as AFEC as an example, for the target edge FE of its target sub-area faFEec, the second adjustable parameter corresponding to the target edge FE is used to determine the position of fa and the position of ec. It can also be understood that the second adjustable parameter is used to determine the lengths of faF and ecE, thereby determining faF, ecE, and faec. Taking Figure 4d as another example, the target line area after cropping is AFEC. For the target edge of its target sub-area AFf1a2 as AF, the second adjustable parameter corresponding to the target edge AF is used to determine the position of f1 and the position of a2. It can also be understood that the second adjustable parameter is used to determine the lengths of Ff1 and Aa2, thereby determining Ff1, Aa2, and f1a2. The rest are similar and will not be repeated here.

[0058] Through the above-mentioned first adjustable parameter or second adjustable parameter, other edges in the target sub-area except the target edge can be flexibly adjusted. In actual applications, the first adjustable parameter and the second adjustable parameter can be set according to needs to change the width of the target sub-area and adjust the aliasing repair effect.

[0059] Based on the determination of the target sub-region, the embodiment of the present disclosure can further perform a gradual blurring process on the target sub-region, including the following steps A to C:

[0060] Step A: Obtain the original pixel value and position coordinates corresponding to the pixel points in the target sub-region. Specifically, the original pixel value and position coordinates corresponding to each pixel point in the target sub-region may be obtained.

[0061] Step B: Determine the transparency of the pixels in the target sub-region based on the position coordinates corresponding to the pixels in the target sub-region. That is, the transparency of each pixel is determined based on its position coordinates, so that the transparency of the pixels in the target sub-region near the target edge of the target line region is greater than the transparency of the pixels in the target sub-region far from the target edge of the target line region. This embodiment of the present disclosure provides a specific implementation example, which can be performed with reference to the following steps B1 to B2:

[0062] Step B1, based on the position coordinates of the top pixel point of the target edge of the target sub-region and the position coordinates of the edge pixel points on the adjacent edge in the target sub-region that intersects with the target edge, determine the transparency of the edge pixel points on the adjacent edge; wherein the transparency of the edge pixel points close to the top pixel point is greater than the transparency of the edge pixel points far from the top pixel point.

[0063] Taking Figure 4a as an example, the adjacent edges that intersect the target edge AC of the target sub-area Aa1c1C are Aa1 and Cc1, respectively. In practical applications, Aa1 is usually parallel to Cc1, so the transparency of only the edge pixels on one adjacent edge needs to be determined. The pixel at point A has the highest transparency and can be completely transparent (i.e., a transparency of 100%). In other words, the pixel at point A has the lowest opacity, i.e., an opacity of 0. The pixel at point a1 has the lowest transparency and can be completely opaque (i.e., a transparency of 0). In other words, the pixel at point a1 has the highest opacity, i.e., an opacity of 100%. The transparency of the pixels from point a1 to point A gradually increases; in other words, the opacity gradually decreases.

[0064] Taking Figure 4b as an example, the adjacent edges intersecting the target edge AB of the target sub-region Aa2b2B are Aa2 and Bb2 respectively. Taking Figure 4c as an example, the adjacent edges intersecting the target edge FE of the target sub-region faFEec are Ffa and Eec respectively. Taking Figure 4d as an example, the adjacent edges intersecting the target edge AF of the target sub-region AFf1a2 are Ff1 and Aa2 respectively. The method for determining the transparency of the pixels of the above adjacent edges can refer to the relevant description of Figure 4a above. The method for determining the adjacent edges of the remaining target sub-regions in Figures 4a to 4d is similar to the above examples and will not be repeated here.

[0065] In some specific examples, the top pixel on the target edge is completely transparent, while the top pixel on the adjacent edge that is farthest from the top pixel is completely opaque. That is, the top pixel on the target edge has a transparency of 100%, while the top pixel on the adjacent edge that is farthest from the top pixel has a transparency of 0. Alternatively, the top pixel on the target edge has an opacity of 0, the top pixel on the adjacent edge that is farthest from the top pixel has a transparency of 0, and the remaining pixels have a gradual transition in transparency or opacity.

[0066] Step B2, determining that the transparency of the associated pixel points corresponding to the edge pixel points in the target sub-region is equal to the transparency of the edge pixel points; wherein the distance between the associated pixel points and the target edge is equal to the distance between the edge pixel points and the target edge, such as, taking the target sub-region as a rectangle as an example, the line connecting the edge pixel points and the associated pixel points is parallel to the target edge. The above method can unify the transparency of the pixels that are at the same distance from the target edge, which is not only more reasonable, but also has high processing efficiency and better visual perception. It can be understood that there are multiple associated pixel points corresponding to each edge pixel point. In actual applications, the transparency of each edge pixel point and the transparency of the associated pixel points corresponding to the edge pixel point are known, and the transparency of all pixels in the target sub-region can be basically determined. The above method is convenient and efficient.

[0067] Step C: Determine the actual pixel value of the pixel in the target sub-region based on the original pixel value and transparency corresponding to the pixel in the target sub-region. For example, the actual pixel value is equal to the original pixel value * opacity, and the sum of opacity and transparency is 1.

[0068] In this way, the target sub-region can be efficiently and reliably subjected to gradual blurring. In order to facilitate a deeper understanding of the above implementation, the following derivation formula is explained in conjunction with Figures 5 to 10:

[0069] First, we can refer to the target line area schematic diagram shown in Figure 5, which clearly shows a parameter z based on Figure 3. This parameter z can be understood as an opacity parameter. Assume that the target line area is a very thick line drawn from coordinates (1, 2) to coordinates (7, 4). When rendering, the x and y coordinates of the four vertices ABCD are: A(1+offset, 2-offsetX), B(1-offset, 2+offsetX), C(7+offset, 4-offsetX), D(7-offset, 4+offsetX), and the coordinates of the remaining pixels are similar, so we will not repeat them here. In Figure 5, it is assumed that the entire target line area ABCD needs to be blurred and gradually changed, and AC has the highest transparency and the lowest opacity (z is 0), BD has the lowest transparency and the highest opacity (z is 1), and the transparency gradually increases from BD to AC, while the opacity gradually decreases. As shown in Figure 6, a schematic diagram of processing a target line area, the left figure of Figure 6 can be understood as a trend diagram of the change of the z value, and the right figure of Figure 6 can be understood as the effect diagram obtained by processing the target line area based on the z value, wherein Figure 6 first regards the entire target line area as the target sub-area to be gradually blurred. As the opacity z value shown in the left figure of Figure 6 increases, the texture color shown in the right figure of Figure 6 becomes lighter and lighter, tending to be transparent. For example, the corresponding z value is determined based on the coordinates of each pixel point, and the actual pixel value f(x) of each pixel point = pixel value * z. As can be seen from Figure 6, the target sub-area corresponding to a target edge can be blurred and gradually processed (can also be understood as feathering processing) through the z value. The line has multiple edges, and the corresponding edge areas all need to be blurred and gradually processed. For example, for another edge BD, it can be adjusted according to the following algorithm:

[0070] f(x)=pixel value*(1-abs(z*2-1)) where abs represents absolute value.

[0071] Based on the above formula, a processing diagram of a target line area can be referred to as shown in FIG7 . In FIG7 , the target area ABCD is essentially divided into two target sub-areas, and the z value is the highest at 1 at the common edge of the two target sub-areas (i.e., the center line of ABCD), and then decreases to 0 in both directions, thereby achieving a blurred gradient effect on the two edges of the target line area. However, the inventor has found through research that the right figure in FIG7 obtained according to the z value change trend of the left figure in FIG7 shows that the target line area is relatively blurred, and the effect is not good. Therefore, the area to be blurred can be further adjusted, that is, the width of the target sub-area can be adjusted. Further, the adjustment can be made according to the following formula: f(x) = pixel value*min(1.0,(1.0-abs(z*2.0-1.0))*m)

[0072] Here, m can be adjusted as needed, specifically corresponding to the first adjustable parameter mentioned above. The larger m is, the smaller the width of the target sub-region, that is, the smaller the edge area that needs to be blurred gradually. Taking m = 3 as an example, refer to the schematic diagram of processing a target line area shown in Figure 8. From the left figure in Figure 8, it can be seen that the maximum value of z in the middle segment (non-target sub-region) is 1, that is, the opacity is 1 and the transparency is 0. Z gradually decreases at the edges of the middle segment on both sides, thereby achieving a gradual blurring of the edge area, achieving the effect shown in the right figure in Figure 8.

[0073] It is understandable that different scenarios or different users handle the target line area differently. In some scenarios, it may be necessary to crop the target line area. For example, in Figure 4c, ABCD needs to be cropped into two parts along FE, retaining FBDE or AFEC depending on the scenario requirements. If half of the area is cropped based on the aforementioned Figure 8, edge jaggedness will still exist at EF. Further, the following formula can be used for adjustment: f(x) = pixel value * min(1.0, (1.0-abs(1.0-abs(z-0.5)*4.0)) * n)

[0074] Among them, n can be adjusted according to needs, specifically corresponding to the aforementioned second adjustable parameter. The larger n is, the smaller the width of the target sub-region is, that is, the smaller the edge area required for blur gradient processing is.

[0075] Based on the above formula, taking n=1 as an example, you can refer to the processing diagram of a target line area shown in Figure 9. In Figure 9, the target area ABCD is essentially divided into two small target areas. For each small target area, the processing method is similar to that shown in Figure 7. It should be noted that Figure 9 is only an example. In actual applications, each small target area in Figure 9 can be processed in a similar manner as shown in Figure 8. Subsequently, according to needs, the target area on the top of Figure 9 can be retained, or the target area on the bottom of Figure 9 can be retained, and the remaining target areas are considered to be cropped. Alternatively, you can first confirm the target area to be retained after cropping, and only perform gradient blur processing on the retained target area. It should be noted that the above is only an example of the target edge being the long edge of the target line area. The opacity (or transparency) of the edge pixels on the adjacent edge of the target edge can be determined based on the z value. If the target edge is the short edge of the target line area, in order to facilitate distinction, an additional w value can be set to represent the opacity (or transparency) of the edge pixels on the adjacent edge of the target edge. Taking Figure 5 as an example, the z value along the BA direction is the w value along the AC direction. The rest of the calculation methods are similar and will not be repeated here.

[0076] In summary, referring to the flowchart of an image processing method shown in FIG10 , the method mainly includes the following steps S1002 to S100:

[0077] Step S1002: Acquire a target line area in the image to be processed.

[0078] Step S1004 , determining whether to crop the target line area. If not, executing step S1006 . If cropped, executing step S1008 .

[0079] In step S1006, a target sub-region is determined based on all edges of the target line region, and a first preset algorithm is used to gradually blur the target sub-region. For example, the first preset algorithm is an algorithm that includes the first adjustable parameter, such as the following formula: f(x) = pixel value * min(1.0, (1.0 - abs(z * 2.0 - 1.0)) * m).

[0080] Step S1008, obtain the cropping edge corresponding to the target line area, determine the cropped target line area based on the cropping edge, and determine the target sub-area based on all edges of the cropped target line area, and use the second preset algorithm to perform a gradient blur process on the target sub-area. Exemplarily, the second preset algorithm is an algorithm that includes the above-mentioned second adjustable parameter, such as can be implemented with reference to the following formula: f(x) = pixel value * min(1.0, (1.0-abs(1.0-abs(z-0.5)*4.0)) * n)

[0081] Through the above method, not only can the aliasing problem be effectively alleviated, but also the computing cost is not high, the performance consumption is small, and it is lightweight. The controllability of the area that needs to be gradually blurred can be achieved through adjustable parameters, and it is easy to apply and expand in different business scenarios. Regardless of whether the line area will be cropped, the above method can be applied.

[0082] Corresponding to the aforementioned image processing method, FIG11 is a schematic structural diagram of an image processing device provided by an embodiment of the present disclosure. The device can be implemented by software and / or hardware and can generally be integrated into an electronic device. As shown in FIG11 , the device includes:

[0083] The line region acquisition module 1100 is used to acquire the target line region in the image to be processed;

[0084] A sub-region determining module 1102 is configured to determine a target sub-region in a target line region;

[0085] The blur processing module 1104 is used to perform gradual blur processing on the target sub-region, wherein the transparency of the pixel points of the target edge close to the target line region in the target sub-region is greater than the transparency of the pixel points of the target edge far from the target line region in the target sub-region, and the target edge is the edge where the target sub-region overlaps with the target line region.

[0086] Since the target sub-region and the target line region have overlapping edges, the target sub-region can be regarded as the edge region corresponding to the target line region. By performing a gradient blurring process on the edge region, not only can the aliasing problem be effectively alleviated, but the computational cost is also low and the performance consumption is small.

[0087] In some embodiments, the sub-region determination module 1102 is specifically used to: determine the target edge from all edges of the target line region without cropping the target line region, and obtain a first adjustable parameter corresponding to the target edge; determine the target sub-region based on the target edge and the first adjustable parameter; wherein the first adjustable parameter is used to determine the edge in the target sub-region that does not overlap with the target edge.

[0088] In some embodiments, the sub-area determination module 1102 is specifically used to: when the target line area is cropped, obtain the cropping edge corresponding to the target line area; determine the cropped target line area based on the cropping edge, determine the target edge from all edges of the cropped target line area, and obtain a second adjustable parameter corresponding to the target edge; determine the target sub-area based on the target edge and the second adjustable parameter; wherein the second adjustable parameter is used to determine the edge in the cropped target line area that does not overlap with the target edge.

[0089] In some embodiments, the target line area has a plurality of target edges; each target edge corresponds to a target sub-area, and the target edge is a long side of the corresponding target sub-area.

[0090] In some embodiments, the blurring processing module 1104 is specifically used to: obtain the original pixel values ​​and position coordinates corresponding to the pixel points in the target sub-area; determine the transparency corresponding to the pixel points in the target sub-area based on the position coordinates corresponding to the pixel points in the target sub-area; and determine the actual pixel values ​​of the pixel points in the target sub-area based on the original pixel values ​​and transparency corresponding to the pixel points in the target sub-area.

[0091] In some embodiments, the blurring processing module 1104 is specifically used to: determine the transparency of the edge pixel points on the adjacent edge based on the position coordinates of the top pixel point of the target edge of the target sub-region and the position coordinates of the edge pixel points on the adjacent edge having an intersection with the target edge in the target sub-region; wherein the transparency of the edge pixel points close to the top pixel point is greater than the transparency of the edge pixel points far from the top pixel point; determine that the transparency of the associated pixel points corresponding to the edge pixel points in the target sub-region is equal to the transparency of the edge pixel points; and the distance between the associated pixel points and the target edge is equal to the distance between the edge pixel points and the target edge.

[0092] In some embodiments, the top pixel point on the target edge is completely transparent, and the top pixel point on the adjacent edge that is farthest from the top pixel point is completely opaque.

[0093] In some embodiments, the line area acquisition module 1100 is specifically used to: in response to receiving a user's request to add graphics to the image to be processed, draw lines corresponding to the graphics adding request, and determine the target line area in the image to be processed based on the lines.

[0094] The image processing device provided by the embodiments of the present disclosure can execute the image processing method provided by any embodiment of the present disclosure, and has the corresponding functional modules and beneficial effects of the execution method.

[0095] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the above-described device embodiment can refer to the corresponding process in the method embodiment, and will not be repeated here.

[0096] An embodiment of the present disclosure further provides an electronic device, comprising: a processor; a memory for storing processor-executable instructions; and a processor for reading the executable instructions from the memory and executing the instructions to implement the above-mentioned image processing method.

[0097] FIG12 is a schematic diagram of the structure of an electronic device provided by an embodiment of the present disclosure. As shown in FIG12 , the electronic device 1200 includes one or more processors 1201 and a memory 1202 .

[0098] The processor 1201 may be a central processing unit (CPU) or other forms of processing units having data processing capabilities and / or instruction execution capabilities, and may control other components in the electronic device 1200 to perform desired functions.

[0099] The memory 1202 may include one or more computer program products, which may include various forms of computer-readable storage media, such as volatile memory and / or non-volatile memory. The volatile memory may include, for example, random access memory (RAM) and / or cache memory. The non-volatile memory may include, for example, read-only memory (ROM), a hard disk, a flash memory, etc. One or more computer program instructions may be stored on the computer-readable storage medium, and the processor 1201 may execute the program instructions to implement the image processing method of the embodiment of the present disclosure described above and / or other desired functions. Various contents such as input signals, signal components, noise components, etc. may also be stored in the computer-readable storage medium.

[0100] In one example, the electronic device 1200 may further include an input device 1203 and an output device 1204 , and these components are interconnected via a bus system and / or other forms of connection mechanisms (not shown).

[0101] In addition, the input device 1203 may also include, for example, a keyboard, a mouse, and the like.

[0102] The output device 1204 can output various information to the outside, including determined distance information, direction information, etc. The output device 1204 can include, for example, a display, a speaker, a printer, a communication network and its connected remote output device, etc.

[0103] Of course, for simplicity, FIG12 only shows some of the components related to the present disclosure in the electronic device 1200, omitting components such as buses, input / output interfaces, etc. In addition, the electronic device 1200 may further include any other appropriate components according to specific application scenarios.

[0104] In addition to the above-mentioned method and device, the embodiment of the present disclosure may also be a computer program product, which includes computer program instructions. When the computer program instructions are executed by a processor, the processor executes the image processing method provided by the embodiment of the present disclosure.

[0105] The computer program product may be written in any combination of one or more programming languages ​​to implement the operations of the disclosed embodiments, including object-oriented programming languages ​​such as Java, C++, and conventional procedural programming languages ​​such as C or similar programming languages. The program code may be executed entirely on the user's computing device, partially on the user's computing device, as a standalone software package, partially on the user's computing device and partially on a remote computing device, or entirely on a remote computing device or server.

[0106] In addition, the embodiment of the present disclosure may also be a computer-readable storage medium having computer program instructions stored thereon. When the computer program instructions are executed by a processor, the processor is enabled to execute the image processing method provided by the embodiment of the present disclosure.

[0107] The computer-readable storage medium can adopt any combination of one or more readable media. The readable medium can be a readable signal medium or a readable storage medium. The readable storage medium can, for example, include but is not limited to a system, device or component of electricity, magnetism, light, electromagnetic, infrared, or semiconductor, or any combination thereof. More specific examples (non-exhaustive list) of readable storage media include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof.

[0108] The embodiment of the present disclosure further provides a computer program product, including a computer program / instruction, which implements the image processing method in the embodiment of the present disclosure when executed by a processor.

[0109] It is understandable that before using the technical solutions disclosed in the various embodiments of this disclosure, the type, scope of use, usage scenarios, etc. of the personal information involved in this disclosure should be informed to the user and the user's authorization should be obtained in an appropriate manner in accordance with relevant laws and regulations.

[0110] For example, in response to a user's active request, a prompt message is sent to the user to clearly inform the user that the operation requested will require the acquisition and use of the user's personal information. This allows the user to independently choose whether to provide personal information to the electronic device, application, server, storage medium, or other software or hardware that performs the operations of the disclosed technical solution based on the prompt message.

[0111] As an optional but non-limiting implementation, in response to receiving a user's active request, the prompt information may be sent to the user in the form of a pop-up window, in which the prompt information may be presented in text form. Furthermore, the pop-up window may also contain a selection control for the user to select "agree" or "disagree" to provide personal information to the electronic device.

[0112] It is understandable that the above notification and user authorization process are merely illustrative and do not constitute a limitation on the implementation of the present disclosure. Other methods that comply with relevant laws and regulations may also be applied to the implementation of the present disclosure.

[0113] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article, or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or device. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of other identical elements in the process, method, article, or device comprising the element.

[0114] The foregoing description is intended only to provide specific embodiments of the present disclosure, intended to enable those skilled in the art to understand and implement the present disclosure. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present disclosure. Therefore, the present disclosure is not intended to be limited to the embodiments described herein, but rather to be construed in the broadest manner consistent with the principles and novel features disclosed herein.

Claims

1. An image processing method, comprising: Get the target line area in the image to be processed; Determine a target sub-region in the target line region; The target sub-region is subjected to a gradual blurring process, wherein the transparency of the pixel points of the target edge in the target sub-region close to the target line region is greater than the transparency of the pixel points of the target edge in the target sub-region far from the target line region, and the target edge is an edge where the target sub-region overlaps with the target line region.

2. The method according to claim 1, wherein determining the target sub-region in the target line region comprises: Without clipping the target line area, determining a target edge from all edges of the target line area, and acquiring a first adjustable parameter corresponding to the target edge; The target sub-region is determined based on the target edge and the first adjustable parameter; wherein the first adjustable parameter is used to determine an edge in the target sub-region that does not overlap with the target edge.

3. The method according to claim 1, wherein determining the target sub-region in the target line region comprises: In the case of cropping the target line area, obtaining a cropping edge corresponding to the target line area; Determine the cropped target line region based on the cropped edge, determine a target edge from all edges of the cropped target line region, and obtain a second adjustable parameter corresponding to the target edge; The target sub-region is determined based on the target edge and the second adjustable parameter; wherein the second adjustable parameter is used to determine the edge of the cropped target line region that does not overlap with the target edge.

4. The method according to any one of claims 1 to 3, wherein the target line area has a plurality of target edges; each of the target edges corresponds to a target sub-area, and the target edge is a long side of the corresponding target sub-area.

5. The method according to claim 1, wherein the step of performing a gradual blurring process on the target sub-region comprises: Obtaining original pixel values ​​and position coordinates corresponding to pixel points in the target sub-region; Determining the transparency of the pixel points in the target sub-region based on the position coordinates of the pixel points in the target sub-region; The actual pixel values ​​of the pixels in the target sub-region are determined according to the original pixel values ​​and transparency corresponding to the pixels in the target sub-region.

6. The method according to claim 5, wherein determining the transparency corresponding to the pixel points in the target sub-region based on the position coordinates corresponding to the pixel points in the target sub-region comprises: Determine the transparency of edge pixels on an adjacent edge based on the position coordinates of a top pixel of a target edge of the target sub-region and the position coordinates of edge pixels on an adjacent edge of the target sub-region that has an intersection with the target edge; wherein the transparency of edge pixels close to the top pixel is greater than the transparency of edge pixels far from the top pixel; Determine that the transparency of the associated pixel point in the target sub-region corresponding to the edge pixel point is equal to the transparency of the edge pixel point; wherein the distance between the associated pixel point and the target edge is equal to the distance between the edge pixel point and the target edge.

7. The method according to claim 6, wherein the top pixel point on the target edge is completely transparent, and the top pixel point on the adjacent edge that is farthest from the top pixel point is completely opaque.

8. The method according to claim 1, wherein obtaining the target line area in the image to be processed comprises: In response to receiving a user's request for adding a graphic to an image to be processed, a line corresponding to the request for adding the graphic is drawn, and a target line area in the image to be processed is determined based on the line.

9. An image processing device, comprising: A line region acquisition module is used to acquire a target line region in the image to be processed; A sub-region determining module, used to determine a target sub-region in the target line region; A blur processing module is used to perform gradual blur processing on the target sub-region, wherein the transparency of the pixel points of the target edge in the target sub-region close to the target line region is greater than the transparency of the pixel points of the target edge in the target sub-region far from the target line region, and the target edge is the edge where the target sub-region overlaps with the target line region.

10. An electronic device, comprising: processor; a memory for storing instructions executable by the processor; The processor is used to read the executable instructions from the memory and execute the instructions to implement the image processing method described in any one of claims 1-8.

11. A computer-readable storage medium storing a computer program, wherein the computer program is used to execute the image processing method according to any one of claims 1 to 8.

12. A computer program product, comprising instructions, which, when executed by a processor, implement the image processing method according to any one of claims 1 to 8.

Citation Information

Patent Citations

  • Image display area shape setting method and device

    CN107154063A

  • Image display method and display equipment

    CN113093903A

  • Image processing method and device, electronic equipment and storage medium

    CN113674303A

  • Image processing method and device, equipment and medium

    CN116894781A

  • Resolving obfuscated sections of an image with selectively captured new imagery

    US20230186445A1