Image anti-aliasing method, device, equipment, medium and program product
By generating customized scaling factors and color ratios in the image in the HDR space, and performing color mixing, the problem of balancing image detail clarity and highlight area anti-aliasing effects is solved, and efficient anti-aliasing processing is achieved.
Patent Information
- Application Number
- CN202211045046.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-08-30
- Publication Date
- 2025-01-21
- Estimated Expiration
- 2042-08-30
AI Technical Summary
In the prior art, it is difficult to balance the image detail clarity and the anti-aliasing effect of the highlight area, resulting in the need to continuously adjust the sub-pixel anti-aliasing quality parameters in the FXAA scheme of the merged drawing process, but the contradictions are still not effectively resolved.
By obtaining the edge pixels of the image in the HDR space, a scaling factor is generated based on the local brightness environment where it is located, and a customized color ratio is generated by combining the brightness values of multiple pixels, and color mixing is performed to achieve the anti-aliasing effect.
It effectively solves the contradiction between image detail clarity and highlight area anti-aliasing effect in the detail anti-aliasing branch, and achieves excellent anti-aliasing effects on the edges of the highlight area and clarity of image details under the FXAA scheme of the merged drawing process.
Smart Images

Figure CN117710237B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of image rendering, and in particular to an image anti-aliasing method, device, equipment, medium and program product. Background Art
[0002] Aliasing refers to the situation in which the drawn geometric lines appear jagged due to insufficient pixel precision during the image rendering process. The technical means to eliminate aliasing is called anti-aliasing (also known as anti-aliasing). During the image rendering process, a frame can be drawn by multiple drawing processes (Pass), and each drawing process is a complete drawing process for a frame.
[0003] In the related art, the FXAA (Fast Approximate Antialiasing) algorithm provided by NVIDIA is often used for image anti-aliasing. The FXAA solution with separate drawing processes provided by NVIDIA requires two drawing processes. The first drawing process is to map the HDR space tone to the LDR (Low-Dynamic Range) space, and the second drawing process is to execute the FXAA algorithm in the LDR space. The two drawing processes consume too much bandwidth resources, and the performance of the mobile terminal is poor. In order to solve the problem of excessive resource consumption caused by the two drawing processes, the related art also provides an FXAA solution that merges the drawing processes, that is, the tone mapping and the FAXX algorithm are completed in one drawing process. At this time, the FAXX algorithm directly acts on the edges under the HDR space.
[0004] Regardless of whether it is a separate drawing process or a combined drawing process FXAA solution, the FXAA solution includes a main anti-aliasing branch and a detail anti-aliasing branch. The main anti-aliasing branch is used to eliminate the aliasing of the main lines on a macro scale, and the detail anti-aliasing branch is used to perform separate anti-aliasing processing on each edge pixel to make up for the edges missed by the main anti-aliasing branch. Affected by the specific algorithm of the main anti-aliasing branch, the main anti-aliasing branch cannot eliminate the aliasing of the highlight area in the HDR space. The aliasing of the highlight area in the HDR space needs to be eliminated by the detail anti-aliasing branch.
[0005] However, the detail anti-aliasing branch is based on the sub-pixel anti-aliasing quality parameter (SubPixQuality). When the value of the sub-pixel anti-aliasing quality parameter is 0, no anti-aliasing is performed on the edges of the image details. At this time, the image details are clear, but there are obvious aliasing in the highlight area; when the value of the sub-pixel anti-aliasing quality parameter is 1, the anti-aliasing effect on the edges of the image details reaches the maximum, and the edges of the highlight area achieve the best anti-aliasing effect, but the image details appear blurred. Therefore, in the FXAA scheme of the merged drawing process, the value of the sub-pixel anti-aliasing quality parameter will be continuously adjusted to balance the clarity of the picture details and the anti-aliasing effect of the highlight area. However, continuously adjusting the value of the sub-pixel anti-aliasing quality parameter cannot effectively take into account the clarity of the picture details and the anti-aliasing effect of the highlight area. Summary of the invention
[0006] The present application provides an image anti-aliasing method, device, equipment, medium and program product, which solves the contradiction between the image detail clarity and the anti-aliasing effect of the highlight area under the detail anti-aliasing branch. The technical solution is as follows:
[0007] According to one aspect of the present application, a method for anti-aliasing of an image is provided, the method comprising:
[0008] Get the first edge pixel of the image in HDR space;
[0009] Generate a first scaling factor according to a local brightness environment where the first edge pixel is located;
[0010] Generate a to-be-processed color ratio corresponding to the first edge pixel according to the brightness values of a plurality of pixels in the image block where the first edge pixel is located;
[0011] Scaling the color ratio to be processed based on the first scaling factor to obtain a first color ratio;
[0012] The first color value is obtained by mixing the color value of the first edge pixel and the color value of the target pixel in combination with the first color ratio; the target pixel is the pixel with the largest color value difference from the first edge pixel among the plurality of surrounding pixels of the first edge pixel;
[0013] The first color value is updated to the color value of the first edge pixel.
[0014] According to another aspect of the present application, an anti-aliasing device for an image is provided, the device comprising:
[0015] An acquisition module is used to acquire the first edge pixel of the image in the HDR space;
[0016] A first generating module, used for generating a first scaling factor according to a local brightness environment where the first edge pixel is located;
[0017] A second generating module, used for generating a to-be-processed color ratio corresponding to the first edge pixel according to the brightness values of a plurality of pixels in the image block where the first edge pixel is located;
[0018] A scaling module, used for scaling the color ratio to be processed based on a first scaling factor to obtain a first color ratio;
[0019] a mixing module, configured to obtain a first color value by mixing the color value of the first edge pixel and the color value of the target pixel in combination with a first color ratio; the target pixel is a pixel with the largest color value difference from the first edge pixel among a plurality of surrounding pixels of the first edge pixel;
[0020] An updating module is used to update the first color value to the color value of the first edge pixel.
[0021] According to one aspect of the present application, a computer device is provided, comprising: a processor and a memory, wherein the memory stores a computer program, and the computer program is loaded and executed by the processor to implement the above-mentioned anti-aliasing method for an image.
[0022] According to another aspect of the present application, a computer-readable storage medium is provided, wherein the storage medium stores a computer program, and the computer program is loaded and executed by a processor to implement the anti-aliasing method of an image as described above.
[0023] According to another aspect of the present application, a computer program product is provided, the computer program product comprising computer instructions, the computer instructions being stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the anti-aliasing method of an image provided in the above aspect.
[0024] The beneficial effects brought by the technical solution provided by the embodiment of the present application include at least:
[0025] By generating a scaling factor for each edge pixel of the image in the HDR space, a personalized customized scaling factor will be generated for each edge pixel, and each edge pixel performs color mixing based on its own scaling factor, which effectively solves the contradiction between the image detail clarity and the anti-aliasing effect in the highlight area caused by using only one sub-pixel anti-aliasing quality parameter for the entire frame image in the detail anti-aliasing branch.
[0026] Through the anti-aliasing method of the present application, the detail anti-aliasing branch under the FXAA scheme of the combined drawing process not only has a better anti-aliasing effect on the edge of the highlight area, but also ensures the clarity of the image details. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0028] Figure 1 A schematic diagram showing the anti-aliasing effect of the FXAA solution in the combined drawing process in the related art is shown;
[0029] Figure 2 A schematic diagram of an image anti-aliasing framework provided by an exemplary embodiment is shown;
[0030] Figure 3 A flowchart of an anti-aliasing method for an image provided by an exemplary embodiment is shown;
[0031] Figure 4 A schematic diagram of an image block provided by an exemplary embodiment is shown;
[0032] Figure 5 A schematic diagram showing a process of generating a scaling factor provided by an exemplary embodiment is shown;
[0033] Figure 6 A schematic diagram showing a brightness weight of an image block provided by an exemplary embodiment is shown;
[0034] Figure 7 A schematic diagram showing a mapping relationship between brightness difference and a color ratio to be processed provided by an exemplary embodiment;
[0035] Figure 8 A schematic diagram of an image anti-aliasing framework provided by another exemplary embodiment is shown;
[0036] Fig. 9 A schematic diagram of an image anti-aliasing framework provided by another exemplary embodiment is shown;
[0037] Fig.10 A schematic diagram showing a process of depth filtering and brightness compensation provided by an exemplary embodiment;
[0038] Fig.11 A schematic diagram of an image anti-aliasing framework provided by another exemplary embodiment is shown;
[0039] Fig.12 A schematic diagram showing a comparison between the FXAA solution of the merged drawing process provided by an exemplary embodiment and the anti-aliasing effect of the present application;
[0040] Fig.13A schematic diagram showing a comparison between the FXAA solution of the sub-rendering process provided by an exemplary embodiment and the anti-aliasing effect of the present application;
[0041] Fig.14 A structural block diagram of an anti-aliasing device for an image provided by an exemplary embodiment is shown;
[0042] Fig.15 A structural block diagram of a computer device provided by an exemplary embodiment is shown. DETAILED DESCRIPTION
[0043] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.
[0044] It should be understood that the "several" mentioned in this article refers to one or more, and "multiple" refers to two or more. "And / or" describes the association relationship of the associated objects, indicating that there can be three relationships. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the associated objects before and after are in an "or" relationship.
[0045] First, the nouns involved in the embodiments of the present application are briefly introduced:
[0046] High Dynamic Range (HDR): HDR is a rendering technology that is closer to real lighting. Compared with low dynamic range (LDR), the maximum value of pixel brightness in HDR can exceed 1. HDR technology is used to simulate and calculate real light intensity; while the maximum value of pixel brightness in LDR is 1. Images in LDR space are suitable for screen drawing. In related technologies, HDR colors are mapped to LDR through tone mapping, and finally drawn to the screen.
[0047] Post-processing stage: The drawing stage after scene object drawing and character drawing in game rendering, which can adjust the final drawn picture, such as tone adjustment, anti-aliasing processing, etc. In related technologies, tone mapping is located in the post-processing stage.
[0048] Pass: During the rendering process of a picture, a frame can be drawn by multiple passes, and each pass will complete a complete drawing process, including vertex drawing, fragment drawing, and a series of drawing processes. In related technologies, tone mapping is a complete drawing process.
[0049] Fast Approximate Anti-Aliasing (FXAA): It is a post-processing based anti-aliasing solution proposed by NVIDIA. FXAA uses a separate post-processing drawing process to perform anti-aliasing on the currently rendered image. In the post-processing drawing process, the shader will receive the input sub-pixel anti-aliasing quality parameter (SubPixQuality) and perform detail anti-aliasing according to the sub-pixel anti-aliasing quality parameter.
[0050] When the sub-pixel anti-aliasing quality parameter value is 0, the details of the picture (the edges of the more detailed pictures, such as leaves and fine wall textures) are not anti-aliased, and the picture details are sharp; when the sub-pixel anti-aliasing quality parameter value is 1, the anti-aliasing effect of the picture details reaches the maximum, and the picture details are blurred. The sub-pixel anti-aliasing quality parameter is only effective for the details of the picture in the detail anti-aliasing branch, and does not affect the anti-aliasing effect on the main lines on a macro scale (such as the edges of the outlines of larger objects in the scene).
[0051] In the FXAA solution proposed by NVIDIA, the pixel color in the HDR space needs to be mapped to the pixel color in the LDR space through tone mapping in one rendering process, and then FXAA anti-aliasing processing is performed in another rendering process, that is, FXAA anti-aliasing is performed through a separate rendering process. The separate rendering process solution will consume the bandwidth corresponding to the two rendering processes. When used in mobile terminals, the bandwidth of the processor of the mobile terminal is limited, which will lead to poor performance of the mobile terminal.
[0052] In the related art, in order to solve the problem of excessive performance consumption caused by the separate drawing process solution, a combined drawing process solution is also proposed. The combined drawing process solution mainly includes the following two types:
[0053] Local tone mapping scheme: Since the FXAA algorithm can obtain better anti-aliasing effect in LDR space, this scheme first maps the current pixel of HDR space to LDR space in one drawing process, and then performs FXAA calculation on the current calculation pixel. At this time, the calculation result is the same as the anti-aliasing effect of the sub-drawing process scheme.
[0054] However, mapping the current pixel tone to the LDR space requires looking up the color value of the current pixel in the HDR space (the HDR value to be mapped) and the color values of multiple pixels including the current pixel in the HDR space (the multiple HDR values required for mapping) from the LUT (Lookup Table). Therefore, the HDR value of the current pixel needs to be sampled twice from the LUT. For mobile terminals, the bandwidth consumed by this solution is still too high.
[0055] Parameter adjustment scheme: This scheme directly uses the FXAA algorithm for images in the HDR space. In this scheme, when the value of the sub-pixel anti-aliasing quality parameter is 0, no anti-aliasing is performed on the image details, which makes the overall picture clear, but the anti-aliasing effect is very poor in the highlights; when the value of the sub-pixel anti-aliasing quality parameter is 1, the strongest anti-aliasing is performed on the image details, which makes the overall picture blurry, but the anti-aliasing effect is better in the highlights due to the blur effect.
[0056] Indicative, Figure 1 Parts (a) and (b) show the anti-aliasing effects at the highlights of the image when the sub-pixel anti-aliasing quality parameter is 1 and 0, respectively. It can be seen that the anti-aliasing effect at the highlights when the sub-pixel anti-aliasing quality parameter is equal to 1 is better than the anti-aliasing effect at the highlights when the sub-pixel anti-aliasing quality parameter is equal to 0. Figure 1 Parts (c) and (d) show the performance of image details when the sub-pixel anti-aliasing quality parameter is 1 and 0. It can be seen that the anti-aliased image when the sub-pixel anti-aliasing quality parameter is equal to 1 is more blurred than the anti-aliased image when the sub-pixel anti-aliasing quality parameter is equal to 0.
[0057] Therefore, directly using the FXAA algorithm in the HDR space will cause a contradiction between image clarity and the anti-aliasing effect in the highlights. A sub-pixel anti-aliasing quality parameter that is too small will lead to a worse anti-aliasing effect in the highlights, while a sub-pixel anti-aliasing quality parameter that is too large will make the details in the picture blurred.
[0058] In summary, both the above-mentioned separate drawing process solution and the combined drawing process solution have their own shortcomings. Based on this, the present application provides an image anti-aliasing method in an HDR space.
[0059] Figure 2 A schematic diagram of an image anti-aliasing framework provided by an exemplary embodiment of the present application is shown. The image anti-aliasing framework 200 includes an edge pixel detection stage 201, a scaling factor generation stage 202, a detail anti-aliasing stage 203 and a mixed color generation stage 204.
[0060] The edge pixel detection stage 201 is used to detect all edge pixels in the image in the HDR space. All edge pixels obtained in the edge pixel detection stage 201 are input into the detail anti-aliasing stage 203.
[0061] The scaling factor generation stage 202 is used to generate a scaling factor corresponding to each pixel for all edge pixels of the image in the HDR space, and the scaling factor is used to dynamically adjust the color ratio of each edge pixel.
[0062] The detail anti-aliasing stage 203 is used to generate the color ratio of all edge pixels. For an edge pixel, the detail anti-aliasing stage 203 generates the color ratio to be processed corresponding to the edge pixel, and adjusts the color ratio corresponding to the edge pixel according to the scaling factor corresponding to the edge pixel.
[0063] The mixed color generation stage 204 is used to mix the colors of all edge pixels of the image to obtain an anti-aliasing effect of the image. For an edge pixel, a target pixel for mixing colors corresponding to the edge pixel is determined, and the final color of the edge pixel is mixed according to the color of the edge pixel and the color of the target pixel in combination with the color ratio determined above. By mixing the colors of all edge pixels of the image, an anti-aliased image can be obtained.
[0064] In one embodiment, the image anti-aliasing framework 200 is run on a terminal. Optionally, the image anti-aliasing framework 200 is executed by a shader in the terminal. Optionally, the image anti-aliasing framework 200 is used to render image frames of an application, and the application runs on an operating system platform (Android or IOS). Optionally, the terminal includes at least one of a smart phone, a tablet computer, a wearable device, a smart TV, a car terminal, an e-book reader, an MP3 player, an MP4 player, a laptop portable computer, and a desktop computer. The following embodiments are illustrated by taking the terminal including a smart phone as an example.
[0065] Figure 3 A flowchart of an anti-aliasing method for an image provided by an exemplary embodiment of the present application is shown, and the method is illustrated by taking the method executed by a terminal as an example. The method includes:
[0066] Step 310, obtaining a first edge pixel of the image in the HDR space;
[0067] The first edge pixel refers to a pixel in the image block where the pixel difference reaches a threshold value. Optionally, the first edge pixel refers to a pixel in the image block where the brightness value difference reaches a threshold value. Optionally, the first edge pixel refers to a pixel in the image block where the brightness value difference reaches a threshold value.
[0068] The image block where the first edge pixel is located refers to a square pixel array divided with the first edge pixel as the center. Figure 4 , Figure 4 An image block where a first edge pixel is located is shown, the pixel indicated by M is the first edge pixel, N, S, W and E indicate pixels at the top, bottom, left and right positions of the first edge pixel, and NW, SW, NE and SE indicate pixels at the top left, bottom left, top right and bottom right positions of the first edge pixel.
[0069] The first edge pixel is any one of all edge pixels of the image in the HDR space.
[0070] Step 310 consists of Figure 2 The illustrated anti-aliasing framework 200 performs an edge pixel detection stage 201 .
[0071] In one embodiment, before obtaining the first edge pixel of the image in the HDR space, all edge pixels of the image need to be detected. The step of detecting all edge pixels of the image includes: after obtaining the image in the HDR space, for the jth pixel of the image, obtaining the pixel with the largest brightness value and the pixel with the smallest brightness value among multiple pixels in the image block where the jth pixel is located; when the brightness value difference between the pixel with the largest brightness value and the pixel with the smallest brightness value among multiple pixels in the image block where the jth pixel is located reaches the jth threshold, determining the jth pixel as an edge pixel; determining multiple edge pixels of the image; wherein the jth pixel is any pixel of the image.
[0072] Combined with reference Figure 4 , Figure 4 An image block in an image is shown, the pixel indicated by M is the j-th pixel, N, S, W and E indicate the pixels at the upper, lower, left and right positions of the j-th pixel, and NW, SW, NE and SE indicate the pixels at the upper left, lower left, upper right and lower right positions of the j-th pixel.
[0073] Optional, in Figure 4 All pixels in the image block shown determine the pixel with the largest brightness value and the pixel with the smallest brightness value; optionally, the pixel with the largest brightness value and the pixel with the smallest brightness value are determined among the multiple pixels indicated by N, S, W and E; optionally, the pixel with the largest brightness value and the pixel with the smallest brightness value are determined among the multiple pixels indicated by NW, SW, NE and SE.
[0074] Step 320, generating a first scaling factor according to a local brightness environment where the first edge pixel is located;
[0075] Step 320 consists of Figure 2 The anti-aliasing framework 200 is shown as executing a scaling factor generation stage 202 .
[0076] The first scaling factor refers to a scaling factor used to adjust the ratio of the color to be processed corresponding to the first edge pixel, and the color ratio is used to mix the color of the first edge pixel and the color of the target pixel.
[0077] The local brightness environment refers to the brightness condition inside the image block where the first edge pixel is located. Optionally, the local brightness environment is measured by the maximum brightness value and the minimum brightness value inside the image block where the first edge pixel is located. Optionally, the local brightness environment refers to the brightness condition of multiple pixels inside the image block where the first edge pixel is located. Optionally, the local brightness environment is measured by the maximum brightness value and the minimum brightness value of multiple pixels inside the image block where the first edge pixel is located.
[0078] Combined with reference Figure 4 , Figure 4 It can also be understood as the image block where the first edge pixel is located, M is the first edge pixel, N, S, W and E indicate the pixels at the upper, lower, left and right positions of the first edge pixel, and NW, SW, NE and SE indicate the pixels at the upper left, lower left, upper right and lower right positions of the first edge pixel.
[0079] Optionally, the local brightness environment of the first edge pixel is Figure 4 The brightness conditions of all pixels in the image block shown; optionally, the local brightness environment in which the first edge pixel is located refers to the brightness conditions of the four pixels indicated by N, S, W and E; optionally, the local brightness environment in which the first edge pixel is located refers to the brightness conditions of the four pixels indicated by NW, SW, NE and SE.
[0080] Step 330, generating a to-be-processed color ratio corresponding to the first edge pixel according to the brightness values of a plurality of pixels in the image block where the first edge pixel is located;
[0081] Step 330 consists of Figure 2 The anti-aliasing framework 200 is shown as performing a detail anti-aliasing stage 203 .
[0082] Optionally, the image block where the first edge pixel is located is a square pixel array, such as Figure 4 According to the brightness values of all pixels in the image block, a color ratio to be processed corresponding to the first edge pixel is generated.
[0083] Step 340, scaling the color ratio to be processed based on the first scaling factor to obtain a first color ratio;
[0084] Step 340 consists of Figure 2 The anti-aliasing framework 200 is shown as performing a detail anti-aliasing stage 203 .
[0085] Optionally, the first color ratio corresponding to the first edge pixel is obtained according to the first scaling factor obtained in step 320 and the color ratio to be processed obtained in step 330. Optionally, the first color ratio can be obtained by multiplying the first scaling factor by the color ratio to be processed.
[0086] Schematically, the first color ratio is calculated by the following formula:
[0087] AA sub =AA sub0 *f;
[0088] Among them, AA sub is the first color ratio obtained after scaling, AA sub0 is the color ratio to be processed, and f is the first scaling factor.
[0089] Step 350, mixing the color value of the first edge pixel and the color value of the target pixel in combination with the first color ratio to obtain a first color value;
[0090] Step 350 consists of Figure 2 The anti-aliasing framework 200 is shown as being performed at the mixed color generation stage 204 .
[0091] The target pixel is a pixel with the largest color value difference between the first edge pixel and the first edge pixel among the plurality of surrounding pixels of the first edge pixel. Figure 4 , the first edge pixel is the pixel indicated by M, optionally, the target pixel is the pixel whose color value is most different from the pixel indicated by M among the multiple surrounding pixels indicated by N, S, W and E; optionally, the target pixel is the pixel whose color value is most different from the pixel indicated by M among the multiple surrounding pixels indicated by NW, SW, NE and SE; optionally, the target pixel is the pixel whose color value is most different from the pixel indicated by M among the multiple surrounding pixels indicated by N, S, W, E, NW, SW, NE and SE.
[0092] Optionally, the target pixel is determined based on the edge direction of the first edge pixel. Optionally, after all edge pixels of the image are detected, the edge directions corresponding to the edge pixels are calculated, and the edge directions are stored in a lookup table. In one embodiment, the edge direction is a vertical direction or a horizontal direction, and the target pixel is a pixel that is closest to the first edge pixel in the vertical direction of the edge direction.
[0093] For example, if the edge direction of the first edge pixel is from left to right and the vertical direction of the edge direction is from bottom to top, the target pixel is the first pixel above the first edge pixel. For example, if the edge direction of the first edge pixel is from top to bottom and the vertical direction of the edge direction is from left to right, the target pixel is the first pixel to the right of the first edge pixel.
[0094] The target pixel is determined according to the edge direction, and the color value of the target pixel is the color value with the largest difference between the first edge pixel and a plurality of surrounding pixels of the first edge pixel.
[0095] According to the color value of the first edge pixel and the color value of the target pixel, as well as the first color ratio, the first color value can be mixed to obtain the first color value.
[0096] Step 360: Update the first color value to the color value of the first edge pixel.
[0097] The first color value obtained by mixing in step 350 is updated as the color value of the first edge pixel. Based on this, the same operation is performed on all edge pixels of the image in the HDR space, so that anti-aliasing processing of the image in the HDR space can be achieved.
[0098] It should be noted that between the above steps 320 and 330, step 320 may be performed first and then step 330, or step 330 may be performed first and then step 320, or step 320 and step 330 may be performed simultaneously.
[0099] In summary, by generating a scaling factor for each edge pixel of the image in the HDR space, a personalized customized scaling factor will be generated for each edge pixel, and each edge pixel performs color mixing based on its own scaling factor, which effectively solves the contradiction between the image detail clarity and the anti-aliasing effect in the highlight area caused by using only one sub-pixel anti-aliasing quality parameter for the entire frame image in the detail anti-aliasing branch.
[0100] Through the anti-aliasing method of the present application, the detail anti-aliasing branch under the FXAA scheme of the combined drawing process not only has a better anti-aliasing effect on the edge of the highlight area, but also ensures the clarity of the image details.
[0101] The following will describe the above in detail Figure 3 The related contents of multiple steps in the method embodiment are shown.
[0102] based on Figure 3 In the optional embodiment shown, "generating a first scaling factor according to the local brightness environment of the first edge pixel" in step 320 can be replaced by: generating the first scaling factor according to the brightness values of the first surrounding pixels and the brightness values of the second surrounding pixels.
[0103] The first surrounding pixel is a pixel with the largest brightness value among multiple pixels of the image block where the first edge pixel is located, and the second surrounding pixel is a pixel with the smallest brightness value among multiple pixels of the image block where the first edge pixel is located.
[0104] Combined with reference Figure 4 , Figure 4 The M in the figure indicates the first edge pixel. Optionally, the first surrounding pixel and the second surrounding pixel are from Figure 4 All pixels in the image block shown are determined; optionally, the first surrounding pixels and the second surrounding pixels are obtained from Figure 4The first surrounding pixel and the second surrounding pixel are determined from the plurality of surrounding pixels indicated by N, S, W and E shown in the figure; optionally, the first surrounding pixel and the second surrounding pixel are determined from Figure 4 The pixels are determined from a plurality of surrounding pixels indicated by NW, SW, NE and SE shown.
[0105] In one embodiment, the brightness value of the first surrounding pixel and the brightness value of the second surrounding pixel are input into a scaling function to obtain a first scaling factor. The scaling function satisfies: the first scaling factor is positively correlated with the brightness value of the first surrounding pixel; the first scaling factor is negatively correlated with the brightness value of the second surrounding pixel; when the brightness value of the second surrounding pixel is 0, the value of the first scaling factor is equal to 0.
[0106] The derivation of the scaling function is as follows:
[0107] Since the purpose of the scaling factor is to adjust the color ratio of edge pixels, the scaling function needs to be able to perceive the brightness environment of the edge pixels, so as to obtain different scaling factors for edge pixels with different brightness values.
[0108] First, set the general formula of the scaling function to:
[0109] F=(a*Luma min +b) x *(c*Luma max +d) y +e;
[0110] Where F is the scaling factor required by the scaling function, Luma min With Luma max are respectively the pixel with the smallest brightness value and the pixel with the largest brightness value among multiple pixels of the image block where the edge pixel is located, and a, c, x, y, b, d and e are undetermined items of the general formula.
[0111] Then, the scaling function needs to satisfy the following two conditions:
[0112] 1. The highlight of the image has a good anti-aliasing effect, namely Luma max Positively correlated with F;
[0113] 2. The clarity of the low-brightness edge of the image is protected, i.e. Luma min is negatively correlated with F, and when Luma min When it approaches 0, F also approaches 0.
[0114] In order to meet the above condition 2, e and b are discarded in the general formula. In addition, in order to reduce the time consumed by the shader in calculation, x and y in the general formula are simplified to 1. The general formula is simplified as follows:
[0115] F=(a*Luma min )*(c*Luma max +d);
[0116] In order to make the calculation as simple as possible and ensure good results, the function formula is further simplified to obtain the final scaling function:
[0117] F=Luma min *(Luma max +1);
[0118] It can be seen that the scaling function only performs one multiplication calculation and one addition calculation, and only consumes one MAD calculation instruction in the shader calculation process. The MAD calculation instruction does not consume too much computing resources.
[0119] After the scaling function has been constructed, for the first edge pixel of the image in the HDR space, the process of calculating the first scaling factor is as follows: multiplying the first brightness value by the second brightness value to obtain a first sub-scaling factor; using the second brightness value as the second sub-scaling factor; and summing the first sub-scaling factor and the second sub-scaling factor, performing normalization processing, and obtaining the first scaling factor.
[0120] The first brightness value is the brightness value of the first surrounding pixel, and the second brightness value is the brightness value of the second surrounding pixel.
[0121] Combination Figure 5 As shown, Figure 5 Part (a) shows the original image in HDR space. Figure 5 Part (b) shows the scaling factors corresponding to all pixels of the image in the HDR space. Figure 5 The brightness value of the pixel in part (b) is the value of the scaling factor. It can be seen that the scaling factor calculated in the highlight area of the original image is larger, and the scaling factor calculated in the area with lower brightness is smaller.
[0122] In summary, the above method provides the specific content of the scaling function. To ensure that the detail anti-aliasing branch can be used for anti-aliasing of the edge of the highlight area, the larger the maximum brightness value in the environment where the first edge pixel in the highlight area is located, the larger the first scaling factor corresponding to the first edge pixel should be. To protect the clarity of the low-brightness edge pixel, the smaller the minimum brightness value in the environment where the first edge pixel is located, the smaller the first scaling factor should be, and when the minimum brightness value in the environment where the first edge pixel is located approaches 0, the first scaling factor should also approach 0.
[0123] based on Figure 3In the optional embodiment shown, step 330 can be replaced by: obtaining multiple brightness weights of multiple pixels in the image block where the first edge pixel is located; generating a first brightness difference based on the brightness and brightness weight of each pixel in the image block; and mapping the first brightness difference to obtain the color ratio to be processed.
[0124] Among them, multiple pixels in the image block correspond to multiple brightness weights one by one; and the first brightness difference is used to characterize the local brightness environment where the first edge pixel is located.
[0125] Combined with reference Figure 4 ,according to Figure 4 The brightness value of each pixel in the image block shown and the brightness weight corresponding to each pixel generate a first brightness difference of the first edge pixel, and the first brightness difference is used to characterize the difference between the brightness of the first edge pixel and the overall brightness of the image block.
[0126] In one embodiment, the image block is a square pixel array centered on the first edge pixel. Multiple brightness weights of multiple pixels in the image block satisfy the following conditions:
[0127] Pixels in the square pixel array that are at the same distance from the first edge pixel have the same corresponding brightness weights;
[0128] The closer the pixel is to the first edge pixel in the square pixel array, the smaller the corresponding brightness weight is;
[0129] The brightness weights corresponding to the pixels other than the first edge pixel in the square pixel array are positive numbers, and the brightness weight corresponding to the first edge pixel is negative;
[0130] The sum of the brightness weights of all pixels in a square pixel array is zero.
[0131] Combined with reference Figure 4 and Figure 6 , Figure 6 Shows Figure 4 After obtaining the brightness weight of each pixel in the square pixel array, a first brightness difference is generated according to the brightness and brightness weight of each pixel in the image block.
[0132] In one embodiment, the product of the brightness of each pixel in the image block and the respective brightness weight is calculated; the product of each pixel in the image block is summed and then divided by the absolute value of the brightness weight corresponding to the first edge pixel to obtain the first brightness difference. Figure 4 and Figure 6 , the calculation expression of the first brightness difference corresponding to the first edge pixel (represented by M) is:
[0133] F=(NW*1+N*2+NE*1+E*2+SE*1+S*2+SW*1+W*2-M*12) / 12;
[0134] After calculating the first brightness difference, the first brightness difference is normalized; and the normalized first brightness difference is mapped to obtain the color ratio to be processed, so that the value interval of the color ratio to be processed is [0, 1], and the color ratio to be processed is positively correlated with the first brightness difference. Figure 7 , Figure 7 The mapping relationship between the color ratio to be processed and the first brightness difference is shown. Figure 7 The horizontal axis represents the first brightness difference, Figure 7 The vertical axis represents the color ratio to be processed.
[0135] In summary, the above method provides a method for generating a color ratio to be processed, which is used to constitute the detail anti-aliasing branch of the present application, so as to further generate the first color ratio together with the scaling factor.
[0136] based on Figure 3 In the optional embodiment shown, step 350 can be replaced by: multiplying the second color ratio by the color value of the first edge pixel to obtain the first color component; the sum of the second color ratio and the first color ratio is 1; multiplying the first color ratio by the color value of the target pixel to obtain the second color component; summing the first color component and the second color component to obtain the first color value.
[0137] Illustratively, the value of the first color ratio is p, the value of the second color ratio is 1-p, the color value of the first edge pixel is x, and the color value of the target pixel is x', then the first color value can be expressed by the following formula:
[0138] F = (1-p)*4x+p*4x';
[0139] F represents the calculated first color value.
[0140] In summary, the above method is a specific color mixing algorithm for each edge pixel provided by the detail anti-aliasing branch to achieve anti-aliasing processing of edge pixels under the detail anti-aliasing branch.
[0141] based on Figure 2 The image shown is an anti-aliased frame. Figure 8 A schematic diagram of another image anti-aliasing framework provided by the present application is shown. Figure 8 Compared to Figure 2The main anti-aliasing branch 804 is added. The image anti-aliasing framework 800 includes an edge pixel detection stage 801, a scaling factor generation stage 802, a detail anti-aliasing branch 803, a main anti-aliasing branch 804, a color ratio determination stage 805 and a mixed color generation stage 806.
[0142] The edge pixel detection stage 801 is used to detect all edge pixels in the image under the HDR space. Optionally, the edge pixel detection stage 801 is also used to generate at least one linear edge based on all edge pixels, and the linear edge is formed by connecting multiple adjacent edge pixels in series. All edge pixels obtained in the edge pixel detection stage 801 are input into the detail anti-aliasing branch 803, and at least one linear edge obtained in the edge pixel detection stage 801 is input into the main anti-aliasing branch 804.
[0143] The scaling factor generation stage 802 is used to generate a scaling factor corresponding to each pixel for all edge pixels of the image in the HDR space, and the scaling factor is used to dynamically adjust the color ratio of each edge pixel.
[0144] The detail anti-aliasing branch 803 is used to generate the color ratio of all edge pixels. For an edge pixel, the detail anti-aliasing branch 803 generates the color ratio to be processed corresponding to the edge pixel, and adjusts the color ratio corresponding to the edge pixel according to the scaling factor corresponding to the edge pixel.
[0145] The main anti-aliasing branch 804 is used to generate the color ratio of edge pixels on the linear edge. For an edge pixel on the linear edge, the main anti-aliasing branch 804 generates the color ratio corresponding to the edge pixel according to the position of the edge pixel on the linear edge.
[0146] The color ratio determination stage 805 is used to determine the final color ratio of all edge pixels. For an edge pixel, the maximum value of the color ratio generated by the detail anti-aliasing branch 803 and the color ratio generated by the main anti-aliasing branch 804 for the edge pixel is determined, and the maximum value is determined as the final color ratio.
[0147] The mixed color generation stage 806 is used to mix the colors of all edge pixels of the image to obtain an anti-aliasing effect of the image. For an edge pixel, a target pixel for mixing the color corresponding to the edge pixel is determined, and the final color of the edge pixel is mixed according to the color of the edge pixel and the color of the target pixel in combination with the color ratio determined above. By mixing the colors of all edge pixels of the image, an anti-aliased image can be obtained.
[0148] based on Figure 8 The anti-aliased frame 800 shown, Figure 3In the optional embodiment shown, the anti-aliasing method for an image further includes the following steps S1 and S2, and step 350 can be replaced by step S3. Step S1 is composed of Figure 8 The main anti-aliasing branch 804 shown is implemented, step S2 is implemented by the color ratio determination stage 805, and step S3 is implemented by the mixed color generation stage 806.
[0149] S1, when the first edge pixel is used to form a linear edge, obtaining a third color ratio corresponding to the first edge pixel according to the position of the first edge pixel on the linear edge;
[0150] The linear edge includes a plurality of adjacent edge pixels.
[0151] In one embodiment, the linear edge is obtained by iteratively expanding to adjacent edge pixels. After an edge pixel is determined, it is detected whether the adjacent pixels of the edge pixel are edge pixels. If so, the adjacent pixels are connected in series, and then the adjacent pixels are expanded again until the expanded adjacent pixels are not edge pixels or the iteration number threshold is reached, then the iterative expansion is stopped, and finally a linear edge is obtained.
[0152] In one embodiment, according to the position of the first edge pixel on the linear edge, the third color ratio corresponding to the first edge pixel is obtained. Schematically, the linear edge includes ten pixels from left to right, the colors of the five pixels on the left are close to the colors of the pixels below the linear edge, and the colors of the five pixels on the right are close to the colors of the pixels above the linear edge. Starting from the leftmost pixel, the five pixels from left to right of the linear edge gradually deviate from the color of the pixels below, and the five pixels will be color mixed with the pixels above the linear edge, and the color ratio corresponding to the five pixels gradually increases. For example, the color ratios are 0.1, 0.2, 0.3, 0.4 and 0.5, respectively.
[0153] Starting from the rightmost pixel, the five pixels from right to left of the linear edge gradually deviate from the color of the upper pixel, and the five pixels will be mixed with the lower pixel of the linear edge, and the color ratio corresponding to the five pixels gradually increases. For example, the color ratios are 0.1, 0.2, 0.3, 0.4 and 0.5 respectively.
[0154] S2, determining the maximum value of the first color ratio and the third color ratio as the maximum color ratio corresponding to the first edge pixel;
[0155] S3, mixing the color value of the first edge pixel and the color value of the target pixel in combination with the maximum color ratio to obtain a first color value.
[0156] In summary, the above steps S1, S2 and S3 are actually Figure 8The main anti-aliasing branch 804 is shown as related to the main anti-aliasing branch 804. The main anti-aliasing branch 804 is a branch for anti-aliasing of linear edges. In fact, the main anti-aliasing branch cannot be applied to the anti-aliasing of the highlight area of the image in the HDR space, because linear mixing is used when mixing colors, and the conversion from HDR space to LDR space is a nonlinear transformation.
[0157] For example, assume that there is a horizontal linear edge, the brightness of the upper pixels of the linear edge is 1, the brightness of the lower pixels is 0.8, and the brightness of the linear edge is linearly distributed from left to right from 1 to 0.8.
[0158] In HDR space, assuming that the brightness of the upper pixel of the linear edge in the highlight area is 10, and the brightness of the lower pixel of the linear edge is 0.8, the brightness of the linear edge is linearly distributed from left to right from 10 to 0.8. In this linear edge, the brightness of most edge pixels is greater than 1. At this time, when this linear edge is converted from HDR space to LDR space through tone mapping (Tonemap), the color values of most edge pixels will be mapped to values close to 1. Tone mapping is nonlinear for color mapping. At this time, the linear edge in LDR space after tone mapping actually only has the position of the aliasing shifted instead of the aliasing disappearing.
[0159] based on Figure 2 The image shown is an anti-aliased frame. Fig. 9 FIG. 1 shows a schematic diagram of an image anti-aliasing framework 900 provided by an exemplary embodiment of the present application. Fig. 9 Compared to Figure 2 The main additions are the depth filtering & brightness compensation stage 905, the edge pixel detection stage 901, the scaling factor generation stage 902, the detail anti-aliasing branch 903 and the mixed color generation stage 904 in the image anti-aliasing framework 900. Figure 2 The corresponding contents shown are similar.
[0160] The depth filtering & brightness compensation stage 905 is used to perform depth filtering on all pixels of the image in the HDR space to filter out areas where the depth information changes significantly. However, the depth filtering only considers the depth information and is prone to filtering out the highlight edges, so brightness compensation is also required to compensate for the filtered highlight edges.
[0161] After the depth filtering & brightness compensation stage 905, an edge pixel cluster of the image is obtained. If the current pixel does not belong to the edge pixel cluster, the value of the scaling factor of the current pixel is set to 0. If the current pixel belongs to the edge pixel cluster, the scaling factor calculated previously is further input into the detail anti-aliasing branch 903.
[0162] based on Fig. 9The image anti-aliasing framework 900 shown, Figure 3 In the optional embodiment shown, step 320 also includes the following steps 321 and 322.
[0163] Step 321, performing a depth filtering operation and a brightness compensation operation on the image to obtain an edge pixel cluster;
[0164] The depth filtering operation refers to the operation of filtering out areas in the image where the depth changes are not obvious, and retaining areas in the image where the depth changes are obvious. At this time, the areas with obvious depth changes retained can be called depth edges (edges determined according to depth changes). After the image undergoes the depth filtering operation, a first edge pixel cluster will be obtained, and the depth value difference between the pixels in the first edge pixel cluster and the surrounding pixels reaches a threshold.
[0165] It should be noted that the depth filtering operation is based on the original image, and after the depth filtering operation, the first edge pixel cluster will be obtained. The depth filtering operation filters out pixels whose depth value difference with the surrounding pixels does not reach the threshold. Therefore, the first edge pixel cluster refers to the cluster composed of edge pixels determined from the original image based on the depth information.
[0166] Combined with reference Fig.10 , Fig.10 Part (a) is the original image. Fig.10 Part (b) is the image obtained after the depth filtering operation. It can be seen that the depth filtering operation not only filters the texture of the wall and the ground, but also filters the luminous rectangle.
[0167] The brightness compensation operation refers to the operation of identifying pixels other than the first edge pixel cluster in the image as edge pixels when the brightness environment of the pixels meets certain conditions. In this case, the edge pixels can be called brightness edges. The image after the depth filtering operation is brightness compensated, and the edge pixels obtained by brightness compensation are added to the second edge pixel cluster.
[0168] It should be noted that the brightness compensation operation is performed based on the pixels filtered out by the depth filtering operation. From the pixels filtered out by the depth filtering operation, pixels whose brightness difference in the image block meets the threshold are selected and added to the second edge pixel cluster. Therefore, the second edge pixel cluster refers to a cluster composed of edge pixels determined from the pixels filtered out by the depth filtering operation based on brightness information.
[0169] Illustratively, for the i-th pixel in the image except the first edge pixel cluster, determine the pixel with the largest brightness value and the pixel with the smallest brightness value among the multiple pixels of the image block where the i-th pixel is located; when the brightness value difference between the pixel with the largest brightness value and the pixel with the smallest brightness value among the multiple pixels of the image block where the i-th pixel is located reaches the i-th threshold, add the i-th pixel to the second edge pixel cluster; wherein the i-th pixel is any pixel in the image except the first edge pixel cluster, the first edge pixel cluster and the second edge pixel cluster together constitute an edge pixel cluster, and the i-th threshold is a preset threshold.
[0170] Combined with reference Figure 4 , Figure 4 The pixel indicated by M in the figure can be understood as the i-th pixel. Figure 4 The pixel with the largest brightness value and the pixel with the smallest brightness value are determined among all the pixels of the image block shown; optionally, the pixel with the largest brightness value and the pixel with the smallest brightness value are determined among the multiple pixels indicated by N, S, W and E; optionally, the pixel with the largest brightness value and the pixel with the smallest brightness value are determined among the multiple pixels indicated by NW, SW, NE and SE.
[0171] Combined with reference Fig.10 , Fig.10 Part (c) shows the image obtained after the depth filtering operation and then the brightness compensation operation. It can be seen that the brightness compensation compensates the filtered luminous rectangle. Fig.10 The pixels whose brightness is not 0 shown in part (c) constitute an edge pixel cluster.
[0172] Step 322, determining that the first edge pixel is a pixel in the edge pixel cluster;
[0173] The edge pixel cluster is a cluster composed of edge pixels determined from the image by combining depth information and brightness information. Specifically, the depth edge is first determined from the original image through a depth filtering operation based on the depth information, and then the brightness edge is determined from the pixels filtered out by the depth filtering operation based on the brightness information. All depth edges and brightness edges together constitute an edge pixel cluster.
[0174] For example, the original image includes 50 pixels, 30 depth edges are determined based on the depth information of the 50 pixels, and then 5 brightness edges are determined from 20 pixels other than the 30 depth edges, so a total of 30 depth edges and 5 brightness edges are obtained, and 35 edges constitute an edge pixel cluster.
[0175] The edge pixel cluster is used to set the scaling factors corresponding to pixels outside the edge pixel cluster in the image to 0. After determining that the first edge pixel belongs to the edge pixel cluster obtained in step 321, the generated first scaling factor is further used to scale the color ratio to be processed.
[0176] In summary, through the above-mentioned depth filtering and brightness compensation operations, an edge pixel cluster is obtained, and the edge pixel cluster includes edge pixels obtained through depth filtering and brightness compensation. After determining that the first edge pixel falls into the edge pixel cluster, it is determined to use the calculated first scaling factor. If the first edge pixel does not fall into the edge pixel cluster, the scaling factor of the first edge pixel is set to 0 to continue to perform subsequent steps.
[0177] In fact, step 321 and step 322 are for filtering out pixels with lower brightness among the multiple edge pixels obtained in the initial edge detection stage, so as to avoid anti-aliasing of these pixels with lower brightness, which makes these pixels with lower brightness unclear; that is, depth filtering & brightness compensation, the purpose is to retain the real highlight area, filter out unnecessary low-brightness areas, and use a larger scaling factor only for the highlight area, while the scaling factor used for other areas is 0.
[0178] Fig.11 An anti-aliasing framework 1100 provided by an exemplary embodiment of the present application is shown. The image anti-aliasing framework 1100 can be obtained by combining the above-mentioned anti-aliasing framework 200, anti-aliasing framework 800 and anti-aliasing framework 900, wherein the edge pixel detection stage 1101, the scaling factor generation stage 1102, the detail anti-aliasing branch 1103, the main anti-aliasing branch 1104, the color ratio determination stage 1105, the mixed color generation stage 1106 and the depth filtering & brightness compensation stage 1107 in the anti-aliasing framework 1100 have all been introduced in detail and will not be repeated here.
[0179] Fig.12 A comparison chart of the anti-aliasing effect is shown. Fig.12 Part (a) shows a schematic diagram of the anti-aliasing effect of the FXAA scheme in the combined drawing process in the related art. Fig.12 Part (a) shows the sawtooth in the rectangular frame 1201, Fig.12 The value of the sub-pixel anti-aliasing quality parameter (SubPixQuality) of the FXAA scheme used in part (a) is equal to 1. It can be seen that Fig.12 In part (a), the image is clear as a whole. From the partial enlarged image on the right, we can see that the jagged edges in the highlight area of the image are quite obvious.
[0180] Fig.12 Part (b) shows the Fig.11The anti-aliasing frame 1100 is a schematic diagram showing the effect of anti-aliasing. Fig.12 Part (b) of FIG. 1 shows the sawtooth in the rectangular frame 1202. It can be seen that Fig.12 In part (b), the overall clarity of the image is Fig.12 It is consistent with part (a) of . From the local enlarged image on the right, it can be seen that there is no aliasing in the highlight area of the image, the anti-aliasing effect is better, and the optimization effect is obvious.
[0181] Fig.13 Another anti-aliasing effect comparison chart is shown. Fig.13 Part (a) shows the original image used for comparing the anti-aliasing effect. Fig.13 Part (b) shows the anti-aliasing effect of the FXAA scheme when the sub-pixel anti-aliasing quality parameter is equal to 0 in the sub-rendering process. Fig.13 Part (c) shows the anti-aliasing effect of the FXAA scheme when the sub-pixel anti-aliasing quality parameter is equal to 1 in the sub-rendering process.
[0182] Fig.13 Part (d) shows the anti-aliasing effect of the anti-aliasing method provided by the present application.
[0183] It can be seen that in the highlight part shown in the rectangular frame area, the anti-aliasing effect of the present application at the highlight is the same as when the sub-pixel anti-aliasing quality parameter is 1, and is better than when the sub-pixel anti-aliasing quality parameter is 0. It can be seen that in the picture details shown in the elliptical area, the clarity of the picture details of the present application is the same as when the sub-pixel anti-aliasing quality parameter is 0, and is clearer than when the sub-pixel anti-aliasing quality parameter is 1.
[0184] After testing, the anti-aliasing solution provided by this application has excellent anti-aliasing effect and does not consume too much performance.
[0185] Using common mobile terminals on the market for testing, when the FXAA solution in the related technology that combines the drawing process for tone mapping and anti-aliasing is used, the drawing process of the mobile terminal takes a total of 2.86ms, the bandwidth for reading data is 1.759MB, and the bandwidth for writing data is 68KB.
[0186] When the same mobile terminal is tested, when the anti-aliasing solution of the present application performs tone mapping and anti-aliasing, the drawing process of the mobile terminal takes a total of 2.85ms, the bandwidth for reading data is 1.765MB, and the bandwidth for writing data is 69KB.
[0187] It can be seen that the anti-aliasing solution provided in the present application and the FXAA solution in the related art that combines the drawing process have almost the same values of various consumption indicators, but the anti-aliasing effect is significantly enhanced.
[0188] Fig.14: is a structural block diagram of an image anti-aliasing device provided by an exemplary embodiment of the present application, the device comprising:
[0189] An acquisition module 1401 is used to acquire a first edge pixel of an image in an HDR space;
[0190] A first generating module 1402, configured to generate a first scaling factor according to a local brightness environment where the first edge pixel is located;
[0191] The second generating module 1404 is used to generate a to-be-processed color ratio corresponding to the first edge pixel according to the brightness values of a plurality of pixels in the image block where the first edge pixel is located;
[0192] A scaling module 1405 is used to scale the color ratio to be processed based on a first scaling factor to obtain a first color ratio;
[0193] A mixing module 1408 is used to mix the color value of the first edge pixel and the color value of the target pixel in combination with the first color ratio to obtain a first color value; the target pixel is a pixel with the largest color value difference from the first edge pixel among a plurality of surrounding pixels of the first edge pixel;
[0194] The updating module 1409 is configured to update the first color value to the color value of the first edge pixel.
[0195] In an optional embodiment, the first generating module 1402 is further used to generate a first scaling factor according to the brightness value of the first surrounding pixels and the brightness value of the second surrounding pixels; the first surrounding pixels are pixels with the largest brightness value among multiple pixels of the image block where the first edge pixel is located, and the second surrounding pixels are pixels with the smallest brightness value among multiple pixels of the image block where the first edge pixel is located.
[0196] In an optional embodiment, the first generating module 1402 is further used to input the brightness value of the first surrounding pixels and the brightness value of the second surrounding pixels into a scaling function to obtain a first scaling factor; wherein the scaling function satisfies: the first scaling factor is positively correlated with the brightness value of the first surrounding pixels; the first scaling factor is negatively correlated with the brightness value of the second surrounding pixels; when the brightness value of the second surrounding pixels is zero, the value of the first scaling factor is equal to zero.
[0197] In an optional embodiment, the brightness value of the first surrounding pixel is a first brightness value, and the brightness value of the second surrounding pixel is a second brightness value. The first generating module 1402 is further configured to multiply the first brightness value by the second brightness value to obtain a first sub-scaling factor; use the second brightness value as the second sub-scaling factor; and perform normalization processing after summing the first sub-scaling factor and the second sub-scaling factor to obtain the first scaling factor.
[0198] In an optional embodiment, the second generation module 1404 is also used to obtain multiple brightness weights of multiple pixels in the image block where the first edge pixel is located; the multiple pixels in the image block correspond one-to-one to the multiple brightness weights; according to the brightness and brightness weight of each pixel in the image block, a first brightness difference is generated; the first brightness difference is used to characterize the local brightness environment where the first edge pixel is located; the first brightness difference is mapped to obtain the color ratio to be processed.
[0199] In an optional embodiment, the image block is a square pixel array centered on the first edge pixel; and multiple brightness weights of multiple pixels in the image block satisfy the following conditions:
[0200] The pixels in the square pixel array that are at the same distance from the first edge pixel have the same corresponding brightness weights;
[0201] The closer the pixel is to the first edge pixel in the square pixel array, the smaller the corresponding brightness weight is;
[0202] The brightness weights corresponding to the pixels other than the first edge pixel in the square pixel array are positive numbers, and the brightness weight corresponding to the first edge pixel is a negative number;
[0203] The sum of the brightness weights of all pixels in a square pixel array is zero.
[0204] In an optional embodiment, the second generation module 1404 is further used to calculate the product of the brightness of each pixel in the image block and the respective brightness weight; after summing the products of each pixel in the image block, the products are divided by the absolute value of the brightness weight corresponding to the first edge pixel to obtain the first brightness difference.
[0205] In an optional embodiment, the second generation module 1404 is also used to normalize the first brightness difference; map the normalized first brightness difference to obtain the color ratio to be processed, so that the color ratio to be processed belongs to a closed interval from zero to one, and the color ratio to be processed is positively correlated with the first brightness difference.
[0206] In an optional embodiment, the mixing module 1408 is further used to multiply the second color ratio by the color value of the first edge pixel to obtain the first color component; the sum of the second color ratio and the first color ratio is 1; the first color ratio is multiplied by the color value of the target pixel to obtain the second color component; and the first color component and the second color component are summed to obtain the first color value.
[0207] In an optional embodiment, the device further includes a third generation module 1406. The third generation module 1406 is used to obtain a third color ratio corresponding to the first edge pixel according to the position of the first edge pixel on the linear edge when the first edge pixel is used to form a linear edge; and determine the maximum value of the first color ratio and the third color ratio as the maximum color ratio corresponding to the first edge pixel. The mixing module is further used to obtain the first color value by mixing the color value of the first edge pixel and the color value of the target pixel in combination with the maximum color ratio; wherein the linear edge includes a plurality of adjacent edge pixels.
[0208] In an optional embodiment, the acquisition module is also used to acquire an image in an HDR space; for the jth pixel of the image, the pixel with the largest brightness value and the pixel with the smallest brightness value among multiple pixels of the image block where the jth pixel is located are acquired; when the brightness value difference between the pixel with the largest brightness value and the pixel with the smallest brightness value among multiple pixels of the image block where the jth pixel is located reaches a jth threshold, the jth pixel is determined to be an edge pixel; and multiple edge pixels of the image are determined; wherein the jth pixel is any pixel of the image.
[0209] In an optional embodiment, the device further includes a processing module 1403. The processing module 1403 is configured to perform a depth filtering operation and a brightness compensation operation on the image to obtain an edge pixel cluster; determine that the first edge pixel is a pixel in the edge pixel cluster; wherein the edge pixel cluster is used to set the scaling factor corresponding to the pixels in the image other than the edge pixel cluster to zero.
[0210] In an optional embodiment, the processing module 1403 is also used to perform a depth filtering operation on the image to obtain a first edge pixel cluster, and the depth value difference between the pixels in the first edge pixel cluster and the surrounding pixels reaches a threshold; for the i-th pixel in the image except the first edge pixel cluster, determine the pixel with the largest brightness value and the pixel with the smallest brightness value among the multiple pixels of the image block where the i-th pixel is located; when the brightness value difference between the pixel with the largest brightness value and the pixel with the smallest brightness value among the multiple pixels of the image block where the i-th pixel is located reaches the i-th threshold, add the i-th pixel to the second edge pixel cluster; wherein the i-th pixel is any pixel in the image except the first edge pixel cluster, and the first edge pixel cluster and the second edge pixel cluster together constitute an edge pixel cluster.
[0211] In an optional embodiment, the device further includes a search module 1407. The search module 1407 is further configured to search for an edge direction corresponding to the first edge pixel, where the edge direction is a vertical direction or a horizontal direction; and determine a pixel with the smallest distance from the first edge pixel in the vertical direction of the edge direction as a target pixel.
[0212] In summary, by generating a scaling factor for each edge pixel of the image in the HDR space, a personalized customized scaling factor will be generated for each edge pixel, and each edge pixel performs color mixing based on its own scaling factor, which effectively solves the contradiction between the image detail clarity and the anti-aliasing effect in the highlight area caused by using only one sub-pixel anti-aliasing quality parameter for the entire frame image in the detail anti-aliasing branch.
[0213] Through the anti-aliasing device of the present application, the detail anti-aliasing branch under the FXAA scheme of the combined drawing process not only has a better anti-aliasing effect on the edge of the highlight area, but also ensures the clarity of the image details.
[0214] Fig.15 The block diagram of the structure of a computer device 1500 provided by an exemplary embodiment of the present application is shown. The computer device 1500 may be a portable mobile terminal, such as a smart phone, a tablet computer, an MP3 player (Moving Picture Experts Group Audio Layer III), an MP4 player (Moving Picture Experts Group Audio Layer IV), a laptop computer or a desktop computer. The computer device 1500 may also be called a user device, a portable terminal, a laptop terminal, a desktop terminal or other names.
[0215] Typically, the computer device 1500 includes a processor 1501 and a memory 1502 .
[0216] The processor 1501 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 1501 may be implemented in at least one hardware form of DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), and PLA (Programmable Logic Array). The processor 1501 may also include a main processor and a coprocessor. The main processor is a processor for processing data in the awake state, also known as a CPU (Central Processing Unit); the coprocessor is a low-power processor for processing data in the standby state. In some embodiments, the processor 1501 may be integrated with a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 1501 may also include an AI (Artificial Intelligence) processor, which is used to process computing operations related to machine learning.
[0217] The memory 1502 may include one or more computer-readable storage media, which may be non-transitory. The memory 1502 may also include a high-speed random access memory, and a non-volatile memory, such as one or more disk storage devices, flash memory storage devices. In some embodiments, the non-transitory computer-readable storage medium in the memory 1502 is used to store at least one instruction, which is used to be executed by the processor 1501 to implement the anti-aliasing method of the image provided by the method embodiment of the present application.
[0218] In some embodiments, the computer device 1500 may also optionally include: a peripheral device interface 1503 and at least one peripheral device. The processor 1501, the memory 1502 and the peripheral device interface 1503 may be connected via a bus or a signal line. Each peripheral device may be connected to the peripheral device interface 1503 via a bus, a signal line or a circuit board. For example, the peripheral device may include: at least one of a radio frequency circuit 1504, a display screen 1505, a camera assembly 1506, an audio circuit 1507 and a power supply 1508.
[0219] The peripheral device interface 1503 may be used to connect at least one peripheral device related to I / O (Input / Output) to the processor 1501 and the memory 1502. In some embodiments, the processor 1501, the memory 1502, and the peripheral device interface 1503 are integrated on the same chip or circuit board; in some other embodiments, any one or two of the processor 1501, the memory 1502, and the peripheral device interface 1503 may be implemented on a separate chip or circuit board, which is not limited in this embodiment.
[0220] The radio frequency circuit 1504 is used to receive and transmit RF (Radio Frequency) signals, also known as electromagnetic signals. The radio frequency circuit 1504 communicates with the communication network and other communication devices through electromagnetic signals. The radio frequency circuit 1504 converts the electrical signal into an electromagnetic signal for transmission, or converts the received electromagnetic signal into an electrical signal. Optionally, the radio frequency circuit 1504 includes: an antenna system, an RF transceiver, one or more amplifiers, a tuner, an oscillator, a digital signal processor, a codec chipset, a user identity module card, and the like. The radio frequency circuit 1504 can communicate with other terminals through at least one wireless communication protocol. The wireless communication protocol includes, but is not limited to: the World Wide Web, a metropolitan area network, an intranet, various generations of mobile communication networks (2G, 3G, 4G and 5G), a wireless local area network and / or a WiFi (Wireless Fidelity) network. In some embodiments, the radio frequency circuit 1504 may also include circuits related to NFC (Near Field Communication), which is not limited in this application.
[0221] The display screen 1505 is used to display a UI (User Interface). The UI may include graphics, text, icons, videos, and any combination thereof. When the display screen 1505 is a touch display screen, the display screen 1505 also has the ability to collect touch signals on the surface or above the surface of the display screen 1505. The touch signal can be input to the processor 1501 as a control signal for processing. At this time, the display screen 1505 can also be used to provide virtual buttons and / or virtual keyboards, also known as soft buttons and / or soft keyboards. In some embodiments, the display screen 1505 can be one, set on the front panel of the computer device 1500; in other embodiments, the display screen 1505 can be at least two, respectively set on different surfaces of the computer device 1500 or in a folding design; in other embodiments, the display screen 1505 can be a flexible display screen, set on a curved surface or a folding surface of the computer device 1500. Even, the display screen 1505 can also be set to a non-rectangular irregular shape, that is, a special-shaped screen. The display screen 1505 can be made of materials such as LCD (Liquid Crystal Display) and OLED (Organic Light-Emitting Diode).
[0222] The camera assembly 1506 is used to capture images or videos. Optionally, the camera assembly 1506 includes a front camera and a rear camera. Typically, the front camera is arranged on the front panel of the terminal, and the rear camera is arranged on the back of the terminal. In some embodiments, there are at least two rear cameras, which are any one of a main camera, a depth of field camera, a wide-angle camera, and a telephoto camera, so as to realize the fusion of the main camera and the depth of field camera to realize the background blur function, the fusion of the main camera and the wide-angle camera to realize the panoramic shooting and VR (Virtual Reality) shooting function or other fusion shooting functions. In some embodiments, the camera assembly 1506 may also include a flash. The flash can be a monochrome temperature flash or a dual-color temperature flash. A dual-color temperature flash refers to a combination of a warm light flash and a cold light flash, which can be used for light compensation at different color temperatures.
[0223] The audio circuit 1507 may include a microphone and a speaker. The microphone is used to collect sound waves from the user and the environment, and convert the sound waves into electrical signals and input them into the processor 1501 for processing, or input them into the radio frequency circuit 1504 to achieve voice communication. For the purpose of stereo acquisition or noise reduction, there may be multiple microphones, which are respectively arranged at different parts of the computer device 1500. The microphone may also be an array microphone or an omnidirectional acquisition microphone. The speaker is used to convert the electrical signal from the processor 1501 or the radio frequency circuit 1504 into sound waves. The speaker may be a traditional film speaker or a piezoelectric ceramic speaker. When the speaker is a piezoelectric ceramic speaker, it can not only convert the electrical signal into sound waves audible to humans, but also convert the electrical signal into sound waves inaudible to humans for purposes such as ranging. In some embodiments, the audio circuit 1507 may also include a headphone jack.
[0224] The power supply 1508 is used to power various components in the computer device 1500. The power supply 1508 can be an alternating current, a direct current, a disposable battery, or a rechargeable battery. When the power supply 1508 includes a rechargeable battery, the rechargeable battery can be a wired rechargeable battery or a wireless rechargeable battery. A wired rechargeable battery is a battery that is charged through a wired line, and a wireless rechargeable battery is a battery that is charged through a wireless coil. The rechargeable battery can also be used to support fast charging technology.
[0225] In some embodiments, the computer device 1500 further includes one or more sensors 1509 , including but not limited to: an acceleration sensor 1510 , a gyroscope sensor 1511 , a pressure sensor 1512 , an optical sensor 1513 , and a proximity sensor 1514 .
[0226] The acceleration sensor 1510 can detect the magnitude of acceleration on the three coordinate axes of the coordinate system established by the computer device 1500. For example, the acceleration sensor 1510 can be used to detect the components of gravity acceleration on the three coordinate axes. The processor 1501 can control the display screen 1505 to display the user interface in a horizontal view or a vertical view according to the gravity acceleration signal collected by the acceleration sensor 1510. The acceleration sensor 1510 can also be used to collect game or user motion data.
[0227] The gyro sensor 1511 can detect the body direction and rotation angle of the computer device 1500, and the gyro sensor 1511 can cooperate with the acceleration sensor 1510 to collect the user's 3D actions on the computer device 1500. The processor 1501 can implement the following functions based on the data collected by the gyro sensor 1511: motion sensing (such as changing the UI according to the user's tilt operation), image stabilization during shooting, game control, and inertial navigation.
[0228] The pressure sensor 1512 can be set on the side frame of the computer device 1500 and / or the lower layer of the display screen 1505. When the pressure sensor 1512 is set on the side frame of the computer device 1500, it can detect the user's grip signal of the computer device 1500, and the processor 1501 performs left and right hand recognition or shortcut operations according to the grip signal collected by the pressure sensor 1512. When the pressure sensor 1512 is set on the lower layer of the display screen 1505, the processor 1501 controls the operability controls on the UI interface according to the user's pressure operation on the display screen 1505. The operability controls include at least one of a button control, a scroll bar control, an icon control, and a menu control.
[0229] The optical sensor 1513 is used to collect the ambient light intensity. In one embodiment, the processor 1501 can control the display brightness of the display screen 1505 according to the ambient light intensity collected by the optical sensor 1513. For example, when the ambient light intensity is high, the display brightness of the display screen 1505 is increased; when the ambient light intensity is low, the display brightness of the display screen 1505 is decreased. In another embodiment, the processor 1501 can also dynamically adjust the shooting parameters of the camera component 1506 according to the ambient light intensity collected by the optical sensor 1513.
[0230] The proximity sensor 1514, also called a distance sensor, is usually disposed on the front panel of the computer device 1500. The proximity sensor 1514 is used to collect the distance between the user and the front of the computer device 1500. In one embodiment, when the proximity sensor 1514 detects that the distance between the user and the front of the computer device 1500 is gradually decreasing, the processor 1501 controls the display screen 1505 to switch from the screen-on state to the screen-off state; when the proximity sensor 1514 detects that the distance between the user and the front of the computer device 1500 is gradually increasing, the processor 1501 controls the display screen 1505 to switch from the screen-off state to the screen-on state.
[0231] Those skilled in the art will understand that Fig.15 The structure shown in the figure does not constitute a limitation on the computer device 1500, and the computer device 1500 may include more or less components than shown in the figure, or combine some components, or adopt a different arrangement of components.
[0232] The present application also provides a computer-readable storage medium, in which at least one instruction, at least one program, a code set or an instruction set is stored. The at least one instruction, the at least one program, the code set or the instruction set is loaded and executed by a processor to implement the anti-aliasing method of the image provided by the above method embodiment.
[0233] The present application provides a computer program product or a computer program, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the anti-aliasing method of an image provided by the above method embodiment.
[0234] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.
[0235] A person skilled in the art will understand that all or part of the steps to implement the above embodiments may be accomplished by hardware or by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a disk or an optical disk, etc.
[0236] The above description is only an optional embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application shall be included in the protection scope of the present application.
Claims
1. An anti-aliasing method for an image, characterized in that: The method comprises: Get the first edge pixel of the image in the high dynamic rendering HDR space; generating a first scaling factor according to a local brightness environment where the first edge pixel is located; generating a color ratio to be processed corresponding to the first edge pixel according to the brightness values of a plurality of pixels in the image block where the first edge pixel is located; Scaling the color ratio to be processed based on the first scaling factor to obtain a first color ratio; A first color value is obtained by mixing the color value of the first edge pixel and the color value of the target pixel in combination with the first color ratio; the target pixel is a pixel having the largest color value difference with the first edge pixel among a plurality of surrounding pixels of the first edge pixel; The first color value is updated to the color value of the first edge pixel.
2. The method according to claim 1, characterized in that The generating a first scaling factor according to the local brightness environment where the first edge pixel is located includes: A first scaling factor is generated according to the brightness value of a first surrounding pixel and the brightness value of a second surrounding pixel; the first surrounding pixel is a pixel with the largest brightness value among multiple pixels of the image block where the first edge pixel is located, and the second surrounding pixel is a pixel with the smallest brightness value among multiple pixels of the image block where the first edge pixel is located.
3. The method according to claim 2, characterized in that The step of generating a first scaling factor according to the brightness value of the first surrounding pixel and the brightness value of the second surrounding pixel comprises: Inputting the brightness value of the first surrounding pixel and the brightness value of the second surrounding pixel into a scaling function to obtain the first scaling factor; The scaling function satisfies: the first scaling factor is positively correlated with the brightness value of the first surrounding pixels; the first scaling factor is negatively correlated with the brightness value of the second surrounding pixels; when the brightness value of the second surrounding pixels is zero, the value of the first scaling factor is equal to zero.
4. The method according to claim 3, characterized in that The brightness value of the first surrounding pixel is a first brightness value, and the brightness value of the second surrounding pixel is a second brightness value; The step of inputting the brightness value of the first surrounding pixel and the brightness value of the second surrounding pixel into a scaling function to obtain the first scaling factor comprises: multiplying the first brightness value by the second brightness value to obtain a first sub-scaling factor; Using the second brightness value as a second sub-scaling factor; The first sub-scaling factor and the second sub-scaling factor are summed and then normalized to obtain the first scaling factor.
5. The method according to any one of claims 1 to 4, characterized in that: The step of generating a to-be-processed color ratio corresponding to the first edge pixel according to the brightness values of a plurality of pixels in the image block where the first edge pixel is located includes: Acquire multiple brightness weights of multiple pixels in the image block where the first edge pixel is located; the multiple pixels in the image block correspond one to one to the multiple brightness weights; generating a first brightness difference according to the brightness and brightness weight of each pixel in the image block; the first brightness difference is used to characterize the local brightness environment where the first edge pixel is located; The first brightness difference is mapped to obtain the color ratio to be processed.
6. The method according to claim 5, characterized in that The image block is a square pixel array centered on the first edge pixel; and multiple brightness weights of multiple pixels in the image block satisfy the following conditions: The pixels in the square pixel array that are at the same distance from the first edge pixel have the same corresponding brightness weights; The closer the pixel in the square pixel array is to the first edge pixel, the smaller the corresponding brightness weight; The brightness weights corresponding to the other pixels in the square pixel array except the first edge pixel are positive numbers, and the brightness weight corresponding to the first edge pixel is a negative number; The sum of the brightness weights of all pixels in the square pixel array is zero.
7. The method according to claim 6, characterized in that The step of generating a first brightness difference according to the brightness and brightness weight of each pixel in the image block comprises: Calculating the product of the brightness of each pixel in the image block and the respective brightness weight; The first brightness difference is obtained by summing the products of each pixel in the image block and dividing the sum by the absolute value of the brightness weight corresponding to the first edge pixel.
8. The method according to claim 7, characterized in that The method further comprises: Normalizing the first brightness difference; Mapping the first brightness difference to obtain the color ratio to be processed includes: The normalized first brightness difference is mapped to obtain the color ratio to be processed, so that the color ratio to be processed belongs to a closed interval from zero to one, and the color ratio to be processed is positively correlated with the first brightness difference.
9. The method according to any one of claims 1 to 4, characterized in that: The step of mixing the color value of the first edge pixel and the color value of the target pixel in combination with the first color ratio to obtain the first color value includes: Multiplying a second color ratio by a color value of the first edge pixel to obtain a first color component; a sum of the second color ratio and the first color ratio is one; Multiplying the first color ratio by the color value of the target pixel to obtain a second color component; The first color component and the second color component are summed to obtain the first color value.
10. The method according to any one of claims 1 to 4, characterized in that: The method further comprises: When the first edge pixel is used to form a linear edge, obtaining a third color ratio corresponding to the first edge pixel according to a position of the first edge pixel on the linear edge; Determine the maximum value of the first color ratio and the third color ratio as the maximum color ratio corresponding to the first edge pixel; The step of mixing the color value of the first edge pixel and the color value of the target pixel in combination with the first color ratio to obtain the first color value includes: According to the color value of the first edge pixel and the color value of the target pixel, the first color value is obtained by mixing in combination with the maximum color ratio; Wherein, the linear edge includes a plurality of adjacent edge pixels.
11. The method according to any one of claims 1 to 4, characterized in that: The method further comprises: Acquire the image in the HDR space; For the j-th pixel of the image, obtaining a pixel with the largest brightness value and a pixel with the smallest brightness value among multiple pixels of the image block where the j-th pixel is located; When a brightness difference between a pixel with a maximum brightness value and a pixel with a minimum brightness value among a plurality of pixels in the image block where the j-th pixel is located reaches a j-th threshold, determining that the j-th pixel is an edge pixel; Determine a plurality of edge pixels of the image; The j-th pixel is any pixel of the image.
12. The method according to any one of claims 1 to 4, characterized in that: After generating the first scaling factor according to the local brightness environment of the first edge pixel, the method further includes: Performing a depth filtering operation and a brightness compensation operation on the image to obtain an edge pixel cluster; determining that the first edge pixel is a pixel in the edge pixel cluster; The edge pixel cluster is used to set the scaling factors corresponding to the pixels in the image other than the edge pixel cluster to zero.
13. The method according to claim 12, characterized in that The performing a depth filtering operation and a brightness compensation operation on the image to obtain an edge pixel cluster includes: Performing a depth filtering operation on the image to obtain a first edge pixel cluster, wherein a depth value difference between pixels in the first edge pixel cluster and surrounding pixels reaches a threshold; For an i-th pixel in the image except the first edge pixel cluster, determine a pixel with a maximum brightness value and a pixel with a minimum brightness value among a plurality of pixels in an image block where the i-th pixel is located; When the brightness difference between a pixel with the largest brightness value and a pixel with the smallest brightness value among multiple pixels of the image block where the i-th pixel is located reaches an i-th threshold, adding the i-th pixel to the second edge pixel cluster; The i-th pixel is any pixel in the image except the first edge pixel cluster, and the first edge pixel cluster and the second edge pixel cluster together constitute the edge pixel cluster.
14. The method according to any one of claims 1 to 4, characterized in that: Before obtaining the first color value by mixing the color value of the first edge pixel and the color value of the target pixel in combination with the first color ratio, the method further includes: Finding and obtaining an edge direction corresponding to the first edge pixel, where the edge direction is a vertical direction or a horizontal direction; A pixel having the smallest distance from the first edge pixel in a direction perpendicular to the edge direction is determined as the target pixel.
15. An anti-aliasing device for an image, characterized in that: The device comprises: An acquisition module is used to acquire the first edge pixel of the image in the HDR space; A first generating module, configured to generate a first scaling factor according to a local brightness environment where the first edge pixel is located; A second generating module, configured to generate a to-be-processed color ratio corresponding to the first edge pixel according to brightness values of a plurality of pixels in the image block where the first edge pixel is located; A scaling module, configured to scale the color ratio to be processed based on the first scaling factor to obtain a first color ratio; a mixing module, configured to obtain a first color value by mixing the color value of the first edge pixel and the color value of the target pixel in combination with the first color ratio; the target pixel is a pixel with the largest color value difference from the first edge pixel among a plurality of surrounding pixels of the first edge pixel; An updating module, configured to update the first color value to a color value of the first edge pixel.
16. A computer device, characterized in that: The computer device comprises: a processor and a memory, wherein the memory stores a computer program, and the computer program is loaded and executed by the processor to implement the anti-aliasing method for an image as claimed in any one of claims 1 to 14.
17. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and the computer program is loaded and executed by a processor to implement the anti-aliasing method for an image as claimed in any one of claims 1 to 14.
18. A computer program product, characterized in that The computer program product stores a computer program, and the computer program is loaded and executed by a processor to implement the anti-aliasing method for an image as claimed in any one of claims 1 to 14.
Citation Information
Patent Citations
Method and system for anti-aliasing of primitives
CN110648386A
Image display method and display equipment
CN113093903A