Methods and apparatus for handling gradients at curved edges

By obtaining the intersection points of the curve edges and the diagonal division ratio to calculate the gain value, and combining weighted and weighted processing, the problems of jagged edges and color shifts in curve edge gradients are solved, achieving a high-quality gradient effect.

CN117252894BActive Publication Date: 2026-01-06CHIPONE TECHNOLOGY (BEIJING) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202311129186.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-09-04
Publication Date
2026-01-06
Estimated Expiration
2043-09-04

AI Technical Summary

Technical Problem

Existing technologies suffer from noticeable jagged edges, poor gradient effects, and color shifts when processing curve edge gradients, especially in image processing with newer arrangement methods such as RGBG and delta_RGB.

Method used

By obtaining the intersection points of the upper and lower boundaries of a row of pixels with the area to be gradientd, the longer diagonal is determined. The gain value is calculated based on the division ratio of the intersection points. Combined with the weighted sum of the pixels and adjacent pixels, the weight and gain value of each color channel are determined, and gradient processing is performed.

Benefits of technology

It achieves pixel-level processing of controllable gradient range, reduces edge jaggedness and color shift, and significantly improves gradient effect.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117252894B_ABST
    Figure CN117252894B_ABST
Patent Text Reader

Abstract

The present disclosure provides a curve edge gradual change processing method and related method and device, the processing method comprising: obtaining the intersection points of the upper and lower boundaries of a row of pixels and the two edge curves of a to-be-gradually-changed region; determining a longer one from the two diagonal lines formed by the intersection points, and determining the gain value of the corresponding pixel according to the division proportion of the area of each pixel in the row with respect to the determined diagonal line; determining a preset gradual change pixel value based on the input pixel value and the gain value of each pixel in the row, and determining a plurality of weights of each color channel of the pixel according to the preset gradual change pixel value; calculating the weighted sum of the gain values of each pixel and its adjacent pixels in the row to obtain the gain value of the corresponding color channel calculated using the plurality of weights of each color channel; and determining the output pixel value of the corresponding color channel after the gradual change processing based on the input pixel value and the gain value of each color channel of the pixel. The curve edge gradual change processing method provided by the present disclosure has good comprehensive performance.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of image processing technology, and in particular to a method and apparatus for processing curve edge gradients. Background Technology

[0002] After defining the fingerprint area, the Display Driver Integrated Circuit (DDIC) often encounters situations where a gradient processing is needed from the edge of the fingerprint area to the background. Fingerprint edges are typically curved, and existing techniques for processing curved edges use distance-based unidirectional gradient methods. These methods usually cannot achieve pixel-level processing with a controllable gradient range, resulting in noticeable jagged edges, poor gradient effects, and limitations in application. Furthermore, when applied to images arranged in newer layouts such as RGBG and delta_RGB, existing processing methods can lead to color shifts because sub-pixel rendering (SPR) technology allows pixels to borrow color from neighboring sub-pixels to compensate for lost pixel information. Summary of the Invention

[0003] In view of the above problems, this disclosure provides a method and related methods and apparatus for processing curve edge gradients, aiming to comprehensively improve the processing effect of curve edge gradients.

[0004] According to a first aspect of this disclosure, a method for processing curve edge gradients is provided, comprising:

[0005] Obtain the intersection points of the upper and lower boundaries of a row of pixels with the two edge curves of the area to be gradientd;

[0006] The longer of the two diagonals formed by the intersection is determined, and the gain value of the corresponding pixel is determined according to the division ratio of the area of ​​each pixel in the row by the determined diagonal.

[0007] A preset gradient pixel value is determined based on the input pixel value and gain value of each pixel in the row, and multiple weights of each color channel of the pixel are determined according to the preset gradient pixel value.

[0008] Calculate the weighted sum of the gain values ​​of each pixel and its neighboring pixels in the row to obtain the gain value of the corresponding color channel calculated using the multiple weights of each color channel;

[0009] The output pixel value of the corresponding color channel after gradient processing is determined based on the input pixel value and gain value of each color channel of the pixel.

[0010] Optionally, determining multiple weights for each color channel of the pixel based on the preset gradient pixel value includes: determining the multiple weights for each color channel of the pixel to values ​​within the range of 0 to 2 based on the preset gradient pixel value.

[0011] Optionally, the gain value of the corresponding pixel is determined according to the division ratio of the area of ​​each pixel in the row by the determined diagonal, including: determining the ratio of the area of ​​a pixel in the row on one side of the graphic of the determined diagonal to the pixel area as the gain value of the pixel.

[0012] Determining a preset gradient pixel value based on the input pixel value and gain value of each pixel in the row includes: adding the product of the input pixel value and gain value of the pixel to the product of the input pixel value of the background and the difference between 1 and the gain value, to obtain the preset gradient pixel.

[0013] Determining the output pixel value of the corresponding color channel after gradient processing based on the input pixel value and gain value of each color channel of the pixel includes: adding the product of the input pixel value and gain value of the color channel of the pixel to the product of the input pixel value of the color channel of the background and the difference between 1 and the gain value, to obtain the output pixel value of the color channel of the pixel.

[0014] Optionally, the gain value of the corresponding pixel is determined according to the division ratio of the area of ​​each pixel in the row by the determined diagonal, including: determining the ratio of the area of ​​a pixel in the row on the background side of the determined diagonal to the pixel area as the gain value of the pixel.

[0015] Determining a preset gradient pixel value based on the input pixel value and gain value of each pixel in the row includes: adding the product of the input pixel value of the pixel and the difference between 1 and the pixel gain value to the product of the input pixel value of the background and the gain value to obtain the preset gradient pixel.

[0016] Determining the output pixel value of the corresponding color channel after gradient processing based on the input pixel value and gain value of each color channel of the pixel includes: adding the product of the difference between the input pixel value of the color channel of the pixel and 1 minus the gain value of the color channel to the product of the input pixel value of the color channel of the background and the gain value, to obtain the output pixel value of the color channel of the pixel.

[0017] Optionally, determining the longer of the two diagonals formed by the intersection point includes: rounding the x-coordinate of the intersection point to the nearest pixel boundary and determining the longer of the two diagonals formed by the rounded intersection point.

[0018] According to a second aspect of this disclosure, a method for determining the gain value in curve edge gradient processing is provided, comprising:

[0019] Obtain the intersection points of the upper and lower boundaries of a row of pixels with the two edge curves of the area to be gradientd;

[0020] The longer of the two diagonals formed by the intersection is determined, and the gain value of the corresponding pixel is determined according to the division ratio of the area of ​​each pixel in the row by the determined diagonal.

[0021] A preset gradient pixel value is determined based on the input pixel value and gain value of each pixel in the row, and multiple weights of each color channel of the pixel are determined according to the preset gradient pixel value.

[0022] Calculate the weighted sum of the gain values ​​of each pixel and its neighboring pixels in the row to obtain the gain value of the corresponding color channel calculated using the multiple weights of each color channel for gradient processing.

[0023] Optionally, determining multiple weights for each color channel of the pixel based on the preset gradient pixel value includes: determining the multiple weights for each color channel of the pixel to values ​​within the range of 0 to 2 based on the preset gradient pixel value.

[0024] Optionally, determining the longer of the two diagonals formed by the intersection point includes: rounding the x-coordinate of the intersection point to the nearest pixel boundary and determining the longer of the two diagonals formed by the rounded intersection point.

[0025] According to a third aspect of this disclosure, an electronic device is provided, comprising: a processor, a memory, and a program stored in the memory and executable on the processor, wherein the program, when executed by the processor, implements the steps of any of the processing methods described in the first aspect or the steps of any of the determining methods described in the second aspect.

[0026] According to a fourth aspect of this disclosure, a computer-readable storage medium is provided, on which a computer program or instructions are stored, wherein when executed by a processor, the computer program or instructions implement the steps of any of the processing methods described in the first aspect or the steps of any of the determining methods described in the second aspect.

[0027] This disclosure brings the following beneficial effects:

[0028] In determining the gain value in the gradient processing of curved edges, this disclosure first obtains the intersection points of the upper and lower boundaries of a row of pixels with the two edge curves of the area to be gradient. The gain value of the corresponding pixel is determined based on the division ratio of the area of ​​each pixel in the row by the longer of the two diagonals formed by the intersection points. Then, a preset gradient pixel value is determined based on the input pixel value and gain value of each pixel in the row, and multiple weights of each color channel of the pixel are determined based on the preset gradient pixel value. Next, the weighted sum of the gain values ​​of each pixel and its adjacent pixels in the row is calculated to obtain the gain value of the corresponding color channel calculated using multiple weights of each color channel for gradient processing.

[0029] In this method, since the gain value of each color channel used for gradient processing is the weighted sum of the gain values ​​of that pixel and its neighboring pixels, for the novel pixel arrangement that borrows color from neighboring sub-pixels to compensate for lost pixel information, this gradient processing method, which considers neighboring pixels, ensures that the pixel value change of the pixel and its borrowing sub-pixels due to gradient processing is not too different while achieving gradient. Furthermore, by determining multiple weights for each color channel of the pixel based on preset gradient pixel values, different weights can be set for different color channels to compensate for color shifts that occur when the pixel uses preset gradient pixel values ​​to achieve gradient. This entire process is applicable to determining the gain value of regions to be gradiented with various curved edges, and also significantly improves anti-aliasing and gradient effects.

[0030] Other features and advantages of this disclosure will be set forth in the following description and will be apparent in part from the description or may be learned by practicing the disclosure. The objects and other advantages of this disclosure are realized and obtained through the structures particularly pointed out in the description and the drawings.

[0031] To make the above-mentioned objects, features and advantages of this disclosure more apparent and understandable, preferred embodiments are described below in detail with reference to the accompanying drawings. Attached Figure Description

[0032] The above and other objects, features and advantages of this disclosure will become clearer from the following description of embodiments with reference to the accompanying drawings, in which:

[0033] Figures 1(a) and 1(b) show two exemplary cases of noticeably jagged edges obtained by existing processing methods for curve edge gradients;

[0034] Figures 2(a) and 2(b) show two exemplary cases of poor gradient effects obtained by existing processing methods for curve edge gradients;

[0035] Figure 3 The diagram shown is a flowchart of a method for processing curve edge gradients according to an embodiment of the present disclosure;

[0036] Figures 4(a), 4(b), 4(c) and 4(d) show the longer diagonal lines corresponding to the edge curves at the four vertices of a figure according to an embodiment of the present disclosure;

[0037] Figure 5 The diagram shows the parameters required for calculating the gain value of multiple color channels of a pixel according to an embodiment of the present disclosure.

[0038] Figures 6(a), 6(b), and 6(c) show three images obtained by processing the curve edge gradient processing method provided in an embodiment of this disclosure;

[0039] Figure 7 The image shown is an illustration of the effect of applying the curve edge gradient processing method provided in this embodiment of the present disclosure to the straight edge gradient processing;

[0040] Figure 8 The diagram shown is a flowchart of a method for determining the gain value in a curve edge gradient processing according to another embodiment of the present disclosure;

[0041] Figure 9 The diagram shown is an exemplary structural schematic of a chip according to yet another embodiment of the present disclosure. Detailed Implementation

[0042] Various embodiments of the present disclosure will now be described in more detail with reference to the accompanying drawings. In the various drawings, the same elements are indicated by the same or similar reference numerals. For clarity, the various portions in the drawings are not drawn to scale.

[0043] Existing methods for processing curved edge gradients are distance-based, typically failing to achieve pixel-level processing within a controllable gradient range. Furthermore, they suffer from noticeable jagged edges and poor gradient effects. Figures 1(a) and 1(b) illustrate two examples of noticeably jagged edges, while Figures 2(a) and 2(b) illustrate two examples of poor gradient effects. Existing methods for processing curved edge gradients also have limitations, being applicable only to gradients of specific curved edges. Moreover, when applied to images arranged in novel ways such as RGBG and delta_RGB, existing methods can cause color shifts due to the gradient causing pixels and their borrowed sub-pixels to have different pixel value changes.

[0044] Therefore, this disclosure provides a method for processing curve edge gradients with good overall performance. Figure 3 The diagram shows a flowchart of a method for processing curve edge gradients according to an embodiment of this disclosure. (Refer to...) Figure 3The processing method includes:

[0045] Step S110: Obtain the intersection points of the upper and lower boundaries of a row of pixels with the two edge curves of the area to be gradient.

[0046] It should be noted that the curved edges of the graphic need to undergo a gradient process to the background. Specifically, the inner part of the curved edge of the graphic is the area to be gradientd, defined by two edge curves, one of which is the graphic's own edge curve. The aforementioned row of pixels represents the current row of pixels to be processed in the graphic. After all rows of pixels in the graphic have been processed, the entire graphic's curved edge gradient process is complete.

[0047] Specifically, the upper and lower boundaries of a row of pixels each have two intersection points with the two edge curves of the area to be gradient, so this step obtains four intersection points.

[0048] Step S120: Determine the longer of the two diagonals formed by the intersection points, and determine the gain value of the corresponding pixel based on the division ratio of the area of ​​each pixel in the row by the determined diagonal.

[0049] In some examples, the longer of the two diagonals formed by the intersection points is determined by rounding the x-coordinate of the intersection point to the nearest pixel boundary. The longer of the two diagonals is then selected from the rounded intersection points. Here, the rounded intersection point is obtained by moving the intersection point horizontally. If the intersection point is closer to the nearest pixel boundary on the left side of the horizontal direction, the rounded intersection point is obtained by moving the intersection point to the left; if the intersection point is closer to the nearest pixel boundary on the right side of the horizontal direction, the rounded intersection point is obtained by moving the intersection point to the right. Since the intersection point is based on the upper and lower boundaries of a row of pixels, its y-coordinate lies on the vertical boundary between pixels. Therefore, the rounded intersection point is located at a vertex of a pixel. The division ratio of the area of ​​each pixel in the row by the determined diagonal can be determined using the triangle area formula, without involving complex integration calculations. Furthermore, the impact of using the rounded intersection point on the gradient effect is minimal.

[0050] Specifically, since there are four intersection points, there are also four intersection points obtained by rounding. Figures 4(a), 4(b), 4(c), and 4(d) show the longer diagonals corresponding to the edge curves at the four vertices of the figure. Points A, B, C, and D indicate intersection points, and points A', B', C', and D' indicate intersection points obtained by rounding. In Figure 4(a), the case of the upper left corner of the figure is shown, and diagonal B'C' is the longer diagonal determined above. In Figure 4(b), the case of the upper right corner of the figure is shown, and diagonal A'D' is the longer diagonal determined above. In Figure 4(c), the case of the lower left corner of the figure is shown, and diagonal A'D' is the longer diagonal determined above. In Figure 4(d), the case of the lower right corner of the figure is shown, and diagonal B'C' is the longer diagonal determined above.

[0051] It should be noted that in some examples, the two edge curves of the area to be gradient in the graphic will gradually become straight lines at the end. This may cause one of the upper and lower boundaries of individual rows of pixels in the graphic to no longer intersect with one of the edge curves or even with neither edge curve. In this case, the intersection of the straight line obtained by connecting the dividing points where the two edge curves gradually become straight lines with the upper and lower boundaries of the row of pixels can be used as the required partial intersection points to perform the relevant processing.

[0052] For example, as shown in Figure 4(c), the right ends of the two edge curves gradually transition to straight lines, and the upper and lower boundary lines of the second-to-last row of pixels no longer intersect with one of the edge curves. The intersection point (marked with a hollow circle) of the straight line obtained by connecting the dividing points (indicated by solid squares) where the right ends of the two edge curves gradually transition to straight lines with the upper and lower boundary lines of that row of pixels is used as the required intersection point for the relevant processing. In this example, the area defined by the straight line connecting the two edge curves to the right of the dividing point can achieve a gradient effect using existing techniques for processing straight-line edge gradients.

[0053] Step S130: Determine a preset gradient pixel value based on the input pixel value and gain value of each pixel in the row, and determine multiple weights of each color channel of the pixel according to the preset gradient pixel value.

[0054] Specifically, the weights for each color channel of the current pixel are typically three weights, which serve as the weights for the current pixel and its two adjacent pixels. For a current pixel with red, green, and blue color channels, the weights for the red channel are: r_l, r_m, r_r; the weights for the green channel are: g_l, g_m, g_r; and the weights for the blue channel are: b_l, b_m, b_r. Here, r_m, g_m, and b_m correspond to the current pixel; r_l, g_l, and b_l correspond to the pixel to the left of the current pixel; and r_r, g_r, and b_r correspond to the pixel to the right of the current pixel.

[0055] The aforementioned preset gradient pixels can characterize whether a pixel has a color shift. Therefore, based on the preset gradient pixel values, it is possible to determine how to set multiple weights for each color channel of the pixel to compensate for the color shift. In practice, based on the preset gradient pixel values, multiple weights for each color channel of the pixel can be determined to be values ​​within the range of 0 to 2 to achieve color shift compensation. Since different areas of the curve edge will have different color casts, the multiple weights for the same color channel of different pixels are not the same. That is, different r_l, r_m, r_r, g_l, g_m, g_r and b_l, b_m, b_r can be determined in different areas of the curve edge.

[0056] Step S140: Calculate the weighted sum of the gain values ​​of each pixel and its adjacent pixels in the row to obtain the gain value of the corresponding color channel calculated using multiple weights of each color channel.

[0057] Specifically, if Figure 5 As shown, the gain value of the current pixel is Area_Gain2, the gain value of the pixel to its left is Area_Gain1, the gain value of the pixel to its right is Area_Gain3, and the weights of each color channel of the current pixel are shown in the dashed box in the figure. Then, for the current pixel, this step can obtain the gain value Spr_Gain_R of the red channel as shown in the following formula (1), the gain value Spr_Gain_G of the green channel as shown in the following formula (2), and the gain value Spr_Gain_B of the blue channel as shown in the following formula (3).

[0058] Spr_Gain_R=Area_Gain1×r_l+Area_Gain2×r_m+Area_Gain3×r_r (1)

[0059] Spr_Gain_G=Area_Gain1×g_l+Area_Gain2×g_m+Area_Gain3×g_r (2)

[0060] Spr_Gain_B=Area_Gain1×b_l+Area_Gain2×b_m+Area_Gain3×b_r (3)

[0061] Step S150: Determine the output pixel value of the corresponding color channel after gradient processing based on the input pixel value and gain value of each color channel of the pixel.

[0062] It should be noted that the pixels along the diagonal line determined in step S120 are the pixels whose pixel values ​​need to be changed to achieve the gradient effect, and each pixel along the diagonal line determined in step S120 has a determined gain value. Subsequently, in step S130, multiple weights for each color channel are determined for the pixels with determined gain values, and in step S140, the gain values ​​for each color channel are determined. Steps S130 and S140 are designed to address the color shift phenomenon that occurs in the image processed by subpixel rendering technology during the gradient process based on the gain values ​​obtained in step S120. Overall, they can be considered a subpixel rendering process. Step S150 involves changing the pixel values ​​of the pixels with determined gain values ​​for each color channel by determining the output pixel values ​​of each color channel to achieve the gradient effect.

[0063] The method for processing curved edge gradients provided in this disclosure requires that each pixel, which achieves the gradient effect by changing its pixel value, has a gain value obtained by dividing its own area based on a determined diagonal and a gain value for each color channel. Therefore, pixel-level processing with a controllable gradient range can be achieved. Furthermore, since the gain value of each color channel used for gradient processing is a weighted sum of the gain values ​​of that pixel and its neighboring pixels, this gradient processing method, which considers neighboring pixels, ensures that the pixel and its borrowed sub-pixels do not differ significantly in pixel value change due to gradient processing, especially for novel pixel arrangements that borrow color from neighboring sub-pixels to compensate for lost pixel information. In addition, by determining multiple weights for each color channel of the pixel based on preset gradient pixel values, different weights can be set for different color channels to compensate for color shifts caused by using preset gradient pixel values ​​to achieve gradients. This method for processing curved edge gradients is applicable to determining the multi-channel gain values ​​of regions with various curved edges to be gradientd, enabling gradient processing for regions with various curved edges, and significantly improving anti-aliasing and gradient effect.

[0064] In an optional embodiment, step S120 determines the gain value of the corresponding pixel based on the division ratio of the area of ​​each pixel in the row by the determined diagonal, including: determining the ratio of the area of ​​the pixel on one side of the graphic of the determined diagonal to the pixel area as the gain value of the pixel; step S130 determines the preset gradient pixel value based on the input pixel value and gain value of each pixel in the row, including: adding the product of the input pixel value and gain value of the pixel to the product of the input pixel value of the background and the difference between 1 and the gain value, to obtain the preset gradient pixel, as shown in formula (4), where Output represents the preset gradient pixel of the pixel, input1 represents the input pixel value of the same pixel, gain represents the gain value of the same pixel, and input2 represents the input pixel value of the background.

[0065] Output=input1×gain+input2×(1-gain) (4)

[0066] Taking Figure 4(b) as an example, the calculation of the gain value in this example is explained. The area of ​​the diagonal fill portion of each pixel is the area of ​​one side of the defined diagonal pattern. Let the pixel size be 1×1. The areas of the three pixels traversed by the defined diagonal in Figure 4(b) from right to left on one side of the defined diagonal pattern are: 1 / 6, 1 / 2, and 5 / 6. Since the pixel area is 1, the gain values ​​of the three pixels involved from right to left are also: 1 / 6, 1 / 2, and 5 / 6.

[0067] It should be noted that formula (4) is a universal formula. If the background is black as shown in Figure 1(a) and Figure 2(a), then the input pixel value of the background is input2 = 0, and formula (4) is transformed into formula (5) as shown below.

[0068] Output = input1 × gain (5)

[0069] In addition, if the graphic is white as shown in Figure 1(b) and Figure 2(b), then the input pixel value input1 = 255, and then formula (1) is transformed into formula (6) as shown below.

[0070] Output=gain×255+input2×(1-gain) (6)

[0071] In this embodiment, step S150, determining the output pixel value of the corresponding color channel after gradient processing based on the input pixel value and gain value of each color channel of the pixel, includes: adding the product of the input pixel value and gain value of the color channel of the pixel to the product of the input pixel value of the color channel of the background and the difference between 1 and the gain value, to obtain the output pixel value of the color channel of the pixel.

[0072] For pixels with red, green, and blue color channels: the output pixel value of the red channel is shown in formula (7), where Output_R represents the output pixel value of the red channel after gradient processing, input1_R represents the input pixel value of the red channel, Spr_Gain_R represents the gain value of the red channel, and input2_R represents the input pixel value of the red channel of the background; the output pixel value of the green channel is shown in formula (8), where Output_G represents the output pixel value of the green channel after gradient processing. The values ​​are as follows: input1_G represents the input pixel value of the green channel of the pixel, Spr_Gain_G represents the gain value of the green channel of the pixel, and input2_G represents the input pixel value of the green channel of the background. The output pixel value of the blue channel is as shown in formula (9), where Output_B represents the output pixel value of the blue channel of the pixel after gradient processing, input1_B represents the input pixel value of the blue channel of the pixel, Spr_Gain_B represents the gain value of the blue channel of the pixel, and input2_B represents the input pixel value of the blue channel of the background.

[0073] Output_R=input1_R×Spr_Gain_R+input2_R×(1-Spr_Gain_R) (7)

[0074] Output_G=input1_G×Spr_Gain_G+input2_G×(1-Spr_Gain_G) (8)

[0075] Output_B=input1_B×Spr_Gain_B+input2_B×(1-Spr_Gain_B) (9)

[0076] In another optional embodiment, step S120 determines the gain value of the corresponding pixel based on the division ratio of the area of ​​each pixel in the row by the determined diagonal, including: determining the ratio of the area of ​​the pixel on the background side of the determined diagonal to the pixel area as the gain value of the pixel; step S130 determines the preset gradient pixel value based on the input pixel value and gain value of each pixel in the row, including: adding the product of the input pixel value of the pixel and the difference between 1 and the gain value of the pixel to the product of the input pixel value of the background and the gain value to obtain the preset gradient pixel, as shown in formula (10), where Output represents the preset gradient pixel of the pixel, input1 represents the input pixel value of the same pixel, gain represents the gain value of the same pixel, and input2 represents the input pixel value of the background.

[0077] Output=input1×(1-gain)+input2×gain (10)

[0078] Using Figure 4(b) as an example, the calculation of the gain value in this example is explained. The area of ​​the dot-filled portion of each pixel is the area of ​​the background side of the determined diagonal. Let the pixel size be 1×1. The areas of the three pixels traversed by the determined diagonal in Figure 4(b) from right to left on the background side of the determined diagonal are: 5 / 6, 1 / 2, and 1 / 6 respectively. Since the pixel area is 1, the gain values ​​of the three pixels involved from right to left are also: 5 / 6, 1 / 2, and 1 / 6 respectively.

[0079] Similarly, formula (10) is a universal formula. If the background is black as shown in Figure 1(a) and Figure 2(a), then the input pixel value of the background is input2 = 0, and formula (10) is transformed into formula (11) as shown below.

[0080] Output=input1×(1-gain) (11)

[0081] In addition, if the graphic is white as shown in Figure 1(b) and Figure 2(b), then the input pixel value input1 = 255, and then formula (10) is transformed into formula (12) as shown below.

[0082] Output=(1-gain)×255+input2×gain (12)

[0083] In this embodiment, step S150, determining the output pixel value of the corresponding color channel after gradient processing based on the input pixel value and gain value of each color channel of the pixel, includes: adding the product of the difference between the input pixel value of the color channel of the pixel and 1 minus the gain value of the color channel to the product of the input pixel value of the color channel of the background and the gain value, to obtain the output pixel value of the color channel of the pixel.

[0084] For pixels with red, green, and blue color channels: the output pixel value of the red channel is shown in formula (13), where Output_R represents the output pixel value of the red channel after gradient processing, input1_R represents the input pixel value of the red channel, Spr_Gain_R represents the gain value of the red channel, and input2_R represents the input pixel value of the red channel of the background; the output pixel value of the green channel is shown in formula (14), where Output_G represents the output pixel value of the green channel after gradient processing. The values ​​are as follows: input1_G represents the input pixel value of the green channel of the pixel, Spr_Gain_G represents the gain value of the green channel of the pixel, and input2_G represents the input pixel value of the green channel of the background. The output pixel value of the blue channel is as shown in formula (15), where Output_B represents the output pixel value of the blue channel of the pixel after gradient processing, input1_B represents the input pixel value of the blue channel of the pixel, Spr_Gain_B represents the gain value of the blue channel of the pixel, and input2_B represents the input pixel value of the blue channel of the background.

[0085] Output_R=input1_R×(1-Spr_Gain_R)+input2_R×Spr_Gain_R (13)

[0086] Output_G=input1_G×(1-Spr_Gain_G)+input2_G×Spr_Gain_G (14)

[0087] Output_B=input1_B×(1-Spr_Gain_B)+input2_B×Spr_Gain_B (15)

[0088] Figures 6(a), 6(b), and 6(c) show three images processed by the curve edge gradient processing method provided in this embodiment of the present disclosure. Compared with the prior art, the method significantly improves anti-aliasing and gradient effect. The curve edge gradient processing method provided in this embodiment of the present disclosure can process gradient regions with edges described by curve equations or graphic equations, including but not limited to the circular edges shown in Figures 6(a) and 6(c) and the arc-shaped edges shown in Figure 6(b). Here, Figure 6(a) is a black and white image, and Figures 6(b) and 6(c) are two color images. It should be understood that since black and white images and grayscale images can be considered as having equal pixel values ​​in the red, green, and blue channels, the above formulas based on the red, green, and blue channels are also applicable to black and white images and grayscale images. Furthermore, for black and white images and grayscale images, they can be considered as having only one color channel, grayscale, and thus the output pixel value of a pixel can be determined based on the fact that a pixel value is only grayscale.

[0089] It should be noted that the method for processing curved edge gradients provided in this embodiment can also be applied to the processing of straight edge gradients. In this case, the two diagonals formed by the intersection points obtained by rounding are of the same length. Therefore, in step S120, either one can be selected to determine the pixel gain, so that the gradient processing is finally performed based on the determined gain values ​​of each color channel of the pixel. Figure 7 The figure shown is an effect diagram of the processing of straight line edge gradient using the curve edge gradient processing method provided in the embodiments of this disclosure. It can be seen from the figure that the gradient effect is quite ideal.

[0090] Another embodiment of this disclosure also provides a method for determining the gain value in curve edge gradient processing. Figure 8 The flowchart shown is for this determination method. Figure 8 The determination method includes:

[0091] Step S210: Obtain the intersection points of the upper and lower boundaries of a row of pixels with the two edge curves of the area to be gradient.

[0092] Step S220: Determine the longer of the two diagonals formed by the intersection point, and determine the gain value of the corresponding pixel based on the division ratio of the area of ​​each pixel in the row by the determined diagonal.

[0093] Step S230: Determine a preset gradient pixel value based on the input pixel value and gain value of each pixel in the row, and determine multiple weights of each color channel of the pixel according to the preset gradient pixel value.

[0094] Step S240: Calculate the weighted sum of the gain values ​​of each pixel and its adjacent pixels in the row to obtain the gain value of the corresponding color channel calculated using multiple weights of each color channel for gradient processing.

[0095] In an optional embodiment, step S230, determining multiple weights of each color channel of the pixel based on the preset gradient pixel value, includes: determining multiple weights of each color channel of the pixel to values ​​within the range of 0 to 2 based on the preset gradient pixel value.

[0096] In another optional embodiment, step S220, determining the longer of the two diagonals formed by the intersection point, includes: rounding the x-coordinate of the intersection point to the nearest pixel boundary line and determining the longer of the two diagonals formed by the rounded intersection point.

[0097] The method for determining the gain value in curved edge gradient processing provided in this disclosure has a gain value for each pixel obtained by dividing its area based on a determined diagonal and a final determined gain value for each color channel, thus enabling pixel-level processing with a controllable gradient range. Furthermore, since the gain value of each color channel used for gradient processing is a weighted sum of the gain values ​​of the pixel and its neighboring pixels, this gradient processing method, which considers neighboring pixels, ensures that the pixel and its borrowed sub-pixels do not differ significantly in pixel value change due to gradient processing, especially for novel pixel arrangements that borrow color from neighboring sub-pixels to compensate for lost pixel information. In addition, by determining multiple weights for each color channel of the pixel based on preset gradient pixel values, different weights can be set for different color channels to compensate for color shifts caused by using preset gradient pixel values ​​to achieve gradients. This method for determining the gain value in curved edge gradient processing is applicable to determining the multi-channel gain value of regions to be gradiented with various curved edges, enabling gradient processing of regions with various curved edges, and significantly improving anti-aliasing and gradient effects.

[0098] Since the steps used in the method for determining the gain value in the curve edge gradient processing provided in this disclosure are all present in the curve edge gradient processing method provided in the above embodiments, the execution details of each step in this disclosure can be referred to the corresponding parts in the embodiments of the curve edge gradient processing method, and will not be repeated here.

[0099] Corresponding to the above method embodiments, another embodiment of this disclosure provides an electronic device. Figure 9 The image shows an exemplary electronic device. (As shown) Figure 9 As shown, the electronic device 1300 includes a memory 1310 and a processor 1320, as well as a program stored in the memory 1310 and executable on the processor 1320. When the program is executed by the processor 1320, it can implement the steps of the embodiments of the above processing method or the steps of the embodiments of the above determination method, and can achieve the same technical effect.

[0100] Specifically, if the above program is executed by processor 1320 and implements the steps of each embodiment of the above processing method, then electronic device 1300 can be a display driver chip. That is, electronic device 1300 internally calculates the gain value of each color channel of the pixel and performs gradient processing in the graphics display process using the calculated gain values ​​of each color channel of the pixel. If the above program is executed by processor 1320 and implements the steps of each embodiment of the above determination method, then electronic device 1300 can be an application processor (AP). In this case, the gain values ​​of each color channel of the pixel determined by the application processor can be first stored in static random-access memory (SRAM), and then the display driver chip reads the gain values ​​of each color channel of the pixel from the static random-access memory during operation to perform gradient processing in the graphics display process.

[0101] Of course, the electronic device 1300 may also include auxiliary devices such as a network interface 1330 and an input / output interface 1340 to acquire various required data or output results in the above method embodiments.

[0102] Those skilled in the art will understand that all or part of the steps in the above method embodiments can be implemented by instructions, or by instructions controlling related hardware. These instructions can be stored in a computer-readable storage medium and loaded and executed by a processor. Therefore, in another embodiment of this disclosure, a computer-readable storage medium is provided, on which a computer program is stored. When executed by a processor, the computer program can implement the steps of the embodiments of the above processing methods or the steps of the embodiments of the above determining methods. The computer-readable storage medium includes various media capable of storing program code, such as a USB flash drive, a portable hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.

[0103] Since the program stored in the readable storage medium can execute the steps of the various embodiments of the processing methods or the various embodiments of the determination methods provided in the embodiments of this disclosure, the beneficial effects that any processing method or any determination method provided in the embodiments of this disclosure can achieve can be realized, as detailed in the preceding embodiments, and will not be repeated here. The specific implementation of each of the above operations can be found in the preceding embodiments, and will not be repeated here.

[0104] It should be noted that in describing the various embodiments in this specification, the focus is on the differences from other embodiments, while the same or similar parts between the various embodiments can be understood by referring to each other. Regarding the electronic device embodiment, since it is basically similar to the method embodiment, the relevant parts can be referred to the description of the method embodiment. Because this electronic device embodiment has the beneficial effects that can be achieved by the above-described method embodiments, as detailed in the preceding embodiments, it will not be repeated here.

[0105] Furthermore, it should be noted that in the apparatus and method of this disclosure, it is obvious that the components or steps can be decomposed and / or recombined. These decompositions and / or recombinations should be considered equivalent solutions of this disclosure. Moreover, the steps performing the above series of processes can naturally be executed in the order described, but are not necessarily required to be executed in chronological order; some steps can be executed in parallel or independently of each other. Those skilled in the art will understand that all or any step or component of the method and apparatus of this disclosure can be implemented in any computing device (including processors, storage media, etc.) or network of computing devices, in hardware, firmware, software, or a combination thereof, which can be achieved by those skilled in the art using their basic programming skills after reading the description of this disclosure.

[0106] Finally, it should be noted that the terms "first," "second," and "third" are used for descriptive purposes only and should not be construed as indicating or implying relative importance. Furthermore, the embodiments described above are merely specific implementations of this disclosure, used to illustrate the technical solutions of this disclosure, and not to limit it. The scope of protection of this disclosure is not limited thereto. Although this disclosure has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that any person skilled in the art can still modify or easily conceive of changes to the technical solutions described in the foregoing embodiments, or make equivalent substitutions for some of the technical features, within the scope of the technology disclosed in this disclosure; and these modifications, changes, or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this disclosure, and should all be covered within the scope of protection of this disclosure. Therefore, the scope of protection of this disclosure should be determined by the scope of the claims.

Claims

1. A processing method of curved edge fade, comprising: acquiring intersection points of upper and lower boundaries of a row of pixels with two edge curves of a region to be faded; determining a longer one of two diagonals formed by the intersection points, and determining a gain value of a corresponding pixel according to a division proportion of an area of each pixel in the row along the determined diagonal; determining a preset fade pixel value based on an input pixel value and the gain value of each pixel in the row, and determining a plurality of weights of each color channel of the pixel according to the preset fade pixel value; calculating a weighted sum of the gain values of each pixel and its adjacent pixels in the row to obtain a gain value of a corresponding color channel calculated using the plurality of weights of each color channel; determining an output pixel value of the corresponding color channel after fade processing based on the input pixel value and the gain value of each color channel of the pixel.

2. The treatment method of claim 1, wherein, The determining of the plurality of weights of each color channel of the pixel according to the preset fade pixel value comprises: determining the plurality of weights of each color channel of the pixel as a value in a range of 0-2 according to the preset fade pixel value. 3.The processing method of claim 1, wherein the determining of the gain value of the corresponding pixel according to the division proportion of the area of each pixel in the row along the determined diagonal comprises: determining a proportion of an area of a pattern side of a pixel in the row along the determined diagonal to an area of the pixel as the gain value of the pixel; the determining of the preset fade pixel value based on the input pixel value and the gain value of each pixel in the row comprises: adding a product of the input pixel value and the gain value of the pixel to a product of an input pixel value of a background and a difference between 1 and the gain value to obtain the preset fade pixel; the determining of the output pixel value of the corresponding color channel after fade processing based on the input pixel value and the gain value of each color channel of the pixel comprises: adding a product of the input pixel value and the gain value of a color channel of the pixel to a product of an input pixel value of the background and a difference between 1 and the gain value to obtain the output pixel value of the color channel of the pixel. 4.The processing method of claim 1, wherein the determining of the gain value of the corresponding pixel according to the division proportion of the area of each pixel in the row along the determined diagonal comprises: determining a proportion of an area of a background side of a pixel in the row along the determined diagonal to an area of the pixel as the gain value of the pixel; the determining of the preset fade pixel value based on the input pixel value and the gain value of each pixel in the row comprises: adding a product of the input pixel value and a difference between 1 and the gain value of the pixel to a product of an input pixel value of a background and the gain value to obtain the preset fade pixel; the determining of the output pixel value of the corresponding color channel after fade processing based on the input pixel value and the gain value of each color channel of the pixel comprises: adding a product of the input pixel value and a difference between 1 and the gain value of a color channel of the pixel to a product of an input pixel value of the background and the gain value to obtain the output pixel value of the color channel of the pixel.

5. The treatment method of claim 1, wherein, The determining of the longer one of the two diagonals formed by the intersection points comprises: rounding off abscissas of the intersection points to the nearest pixel boundary line, and determining the longer one of the two diagonals formed by the intersection points obtained by the rounding off.

6. A method for determining gain values in a curved edge blending process, comprising: acquiring intersection points of upper and lower boundaries of a row of pixels with two edge curves of a region to be blended; determining a longer diagonal line from two diagonals formed by the intersection points, and determining a gain value of a pixel according to a division ratio of the pixel area by the determined diagonal line; determining a preset blending pixel value based on input pixel values and gain values of the pixels in the row, and determining a plurality of weights of color channels of the pixel according to the preset blending pixel value; calculating a weighted sum of gain values of the pixels in the row and their adjacent pixels, and obtaining a gain value of a corresponding color channel calculated using the plurality of weights of the color channels for blending processing.

7. The determination method according to claim 6, wherein The determining of the plurality of weights of color channels of the pixel according to the preset blending pixel value comprises: determining the plurality of weights of color channels of the pixel as values in a range of 0-2 according to the preset blending pixel value.

8. The determination method according to claim 6, wherein The determining of the longer diagonal line from the two diagonals formed by the intersection points comprises: rounding the abscissa of the intersection point to an adjacent pixel boundary, and determining the longer diagonal line from two diagonals formed by the intersection points obtained by rounding.

9. An electronic device comprising: A processor, a memory, and a program stored on the memory and executable on the processor, the program being executed by the processor to implement the steps of the processing method of any one of claims 1-5 or the steps of the determining method of any one of claims 6-8.

10. A computer readable storage medium having stored thereon a computer program or instructions, the computer program or instructions being executed by a processor to implement the steps of the processing method of any one of claims 1-5 or the steps of the determining method of any one of claims 6-8.

Citation Information

Patent Citations

  • OLED panel brightness compensation method and device, driving chip and storage medium

    CN113516946A

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

    CN113870293A