CN116433515A - Image rotation antialiasing method, apparatus, computer device, and storage medium - Google Patents

Image rotation antialiasing method, apparatus, computer device, and storage medium Download PDF

Info

Publication number
CN116433515A
CN116433515A CN202310323775.1A CN202310323775A CN116433515A CN 116433515 A CN116433515 A CN 116433515A CN 202310323775 A CN202310323775 A CN 202310323775A CN 116433515 A CN116433515 A CN 116433515A
Authority
CN
China
Prior art keywords
image
pixel block
pixel
coordinates
rotating
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202310323775.1A
Other languages
Chinese (zh)
Inventor
张殿胜
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Glenfly Tech Co Ltd
Original Assignee
Glenfly Tech Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Glenfly Tech Co Ltd filed Critical Glenfly Tech Co Ltd
Priority to CN202310323775.1A priority Critical patent/CN116433515A/en
Publication of CN116433515A publication Critical patent/CN116433515A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/90Dynamic range modification of images or parts thereof
    • G06T5/94Dynamic range modification of images or parts thereof based on local image properties, e.g. for local contrast enhancement
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T3/00Geometric image transformations in the plane of the image
    • G06T3/60Rotation of whole images or parts thereof
    • G06T3/604Rotation of whole images or parts thereof using coordinate rotation digital computer [CORDIC] devices
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/70Denoising; Smoothing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/30Determination of transform parameters for the alignment of images, i.e. image registration
    • G06T7/33Determination of transform parameters for the alignment of images, i.e. image registration using feature-based methods
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/70Determining position or orientation of objects or cameras
    • G06T7/73Determining position or orientation of objects or cameras using feature-based methods
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/90Determination of colour characteristics

Landscapes

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

Abstract

The application relates to an image rotation antialiasing method, an apparatus, a computer device, and a storage medium. The method comprises the following steps: taking the original image as an angle adjustment object, and rotating the angle adjustment object by a preset angle along a preset direction to obtain a rotating image; updating the pixel values corresponding to the pixel blocks in the rotating image based on the pixel values of the pixel blocks in the angle adjustment object, the coordinates of the pixel blocks in the rotating image in the graphic coordinate system and the coordinates of the pixel blocks in the angle adjustment object in the graphic coordinate system; reversely rotating the rotation image with the updated pixel value by a preset angle to obtain a reversely rotated image; and if the distortion degree of the reverse rotation image meets the preset requirement, carrying out weighted summation on the pixel values of the pixel blocks at the corresponding positions in the reverse rotation image and the original image to obtain the anti-aliasing image. The method has higher calculation speed, and better antialiasing effect by adopting repeated rotation antialiasing and weighting and summing pixel values of the pixel blocks at positions corresponding to the original image.

Description

Image rotation antialiasing method, apparatus, computer device, and storage medium
Technical Field
The present disclosure relates to the field of image processing technologies, and in particular, to an image rotation antialiasing method, an apparatus, a computer device, and a storage medium.
Background
The anti-aliasing of the graph refers to performing brightness transition processing on the image edge, so that the image edge looks smoother and is closer to the object of the real object. The traditional pattern antialiasing mainly adopts the following two modes, in the first mode, the number of pixel points in the screen display is increased, and the more the pixel points, the smoother the pattern is, but the cost is higher; in the second mode, the pixel edges are searched, discontinuous edge modes such as U type, Z type and L type are identified, then the pixel edges corresponding to the edge modes are mixed with surrounding colors, so that saw teeth are eliminated, and the mode has the defects of large occupied hardware resources, low calculation speed and high power consumption.
Disclosure of Invention
In view of the foregoing, it is desirable to provide an image rotation antialiasing method, apparatus, computer device, and storage medium that can process in real time, occupy small hardware resources, and have a high computation speed.
In a first aspect, the present application provides an image rotation antialiasing method, the method comprising:
Taking the original image as an angle adjustment object, and rotating the angle adjustment object by a preset angle along a preset direction to obtain a rotating image;
updating the pixel values corresponding to the pixel blocks in the rotating image based on the pixel values of the pixel blocks in the angle adjustment object, the coordinates of the pixel blocks in the rotating image in the graphic coordinate system and the coordinates of the pixel blocks in the angle adjustment object in the graphic coordinate system;
reversely rotating the rotation image with the updated pixel value by a preset angle to obtain a reversely rotated image;
and if the distortion degree of the reverse rotation image meets the preset requirement, carrying out weighted summation on the pixel values of the pixel blocks at the corresponding positions in the reverse rotation image and the original image to obtain the anti-aliasing image.
In one embodiment, the method further comprises:
if the distortion degree of the reverse rotation image does not meet the preset requirement, taking the reverse rotation image as an angle adjustment object, returning to the step of rotating the angle adjustment object by a preset angle along the preset direction, and continuing to execute until the obtained distortion degree of the reverse rotation image meets the preset requirement.
In one embodiment, rotating an angle adjustment object by a preset angle along a preset direction to obtain a rotation image includes:
Taking the image center of the angle adjustment object as an origin, rotating the angle adjustment object by a preset angle along a preset direction, and obtaining a rotating image; wherein, the position information of each pixel block in the rotating image in the graphic coordinate system is stored in the appointed storage space of the memory.
In one embodiment, updating pixel values corresponding to each pixel block in a rotated image based on pixel values of each pixel block in the angle adjustment object, coordinates of each pixel block in the rotated image in a graphics coordinate system, and coordinates of each pixel block in the angle adjustment object in the graphics coordinate system, includes:
for each pixel block in the rotated image, determining original information and reference information corresponding to the current pixel block in the rotated image; the original information comprises coordinates and pixel values of the corresponding original pixel blocks in the image coordinate system in the angle adjustment object before the current pixel block rotates; the reference information includes coordinates and pixel values of a plurality of reference pixel blocks adjacent to the original pixel block in a graphic coordinate system; the original pixel block is a position mapping pixel block of the current pixel block in an angle adjustment object; the reference pixel block is a pixel block adjacent to the original pixel block in the angle adjustment object;
Determining a distance between a current pixel block and each reference pixel block in a graph coordinate system based on coordinates of the current pixel block and coordinates of a plurality of reference pixel blocks in the rotated image;
and updating the pixel value corresponding to the current pixel block based on the pixel value corresponding to each reference pixel block and the distance between the current pixel block and each reference pixel block, and obtaining the updated pixel value of each pixel block in the rotating image.
In one embodiment, determining original information and reference information corresponding to a current pixel block in a rotated image includes:
reading the coordinates of a current pixel block in the rotating image from a memory, and determining the coordinates of an original pixel block corresponding to the current pixel block before rotation and the coordinates of a plurality of reference pixel blocks adjacent to the original pixel block based on the position mapping relation of each pixel block before rotation and after rotation in the rotating image and the coordinates of the current pixel block;
and inquiring the pixel value corresponding to the original pixel block and the pixel value corresponding to each reference pixel block in the memory according to the coordinates of the original pixel block and the coordinates of each reference pixel block.
In one embodiment, updating the pixel value corresponding to the current pixel block based on the pixel value corresponding to each reference pixel block and the distance between the current pixel block and each reference pixel block includes:
Determining the weight corresponding to each reference pixel block according to the distance between the current pixel block and each reference pixel block;
and carrying out weighted summation on the pixel values corresponding to the reference pixel blocks and the weights to obtain updated pixel values of the current pixel block.
In one embodiment, before the pixel values of the pixel blocks at the corresponding positions in the original image and the counter-rotated image are weighted and summed to obtain the anti-aliasing image, the method further includes:
after the counter-rotated image is obtained, the pixel value corresponding to each pixel block in the counter-rotated image is updated based on the pixel value of each pixel block in the rotated image, and the coordinates of each pixel block in the counter-rotated image and the coordinates of each pixel block in the rotated image.
In a second aspect, the present application also provides an image rotation antialiasing apparatus. The device comprises:
the rotating module is used for taking the original image as an angle adjustment object, rotating the angle adjustment object by a preset angle along a preset direction, and obtaining a rotating image;
the first antialiasing module is used for updating the pixel value corresponding to each pixel block in the rotating image based on the pixel value of each pixel block in the angle adjustment object, the coordinate of each pixel block in the rotating image in the graphic coordinate system and the coordinate of each pixel block in the angle adjustment object in the graphic coordinate system;
The reverse rotation module is used for reversely rotating the rotation image with the updated pixel value by a preset angle to obtain a reverse rotation image;
and the second antialiasing module performs weighted summation on the pixel values of the pixel blocks at the corresponding positions in the reverse rotation image and the original image when the distortion degree of the reverse rotation image meets the preset requirement, so as to obtain the antialiased image.
In a third aspect, the present application also provides a computer device. The computer device comprises a memory storing a computer program and a processor which when executing the computer program performs the steps of:
taking the original image as an angle adjustment object, and rotating the angle adjustment object by a preset angle along a preset direction to obtain a rotating image;
updating the pixel values corresponding to the pixel blocks in the rotating image based on the pixel values of the pixel blocks in the angle adjustment object, the coordinates of the pixel blocks in the rotating image in the graphic coordinate system and the coordinates of the pixel blocks in the angle adjustment object in the graphic coordinate system;
reversely rotating the rotation image with the updated pixel value by a preset angle to obtain a reversely rotated image;
and if the distortion degree of the reverse rotation image meets the preset requirement, carrying out weighted summation on the pixel values of the pixel blocks at the corresponding positions in the reverse rotation image and the original image to obtain the anti-aliasing image.
In a fourth aspect, the present application also provides a computer-readable storage medium. The computer readable storage medium having stored thereon a computer program which when executed by a processor performs the steps of:
taking the original image as an angle adjustment object, and rotating the angle adjustment object by a preset angle along a preset direction to obtain a rotating image;
updating the pixel values corresponding to the pixel blocks in the rotating image based on the pixel values of the pixel blocks in the angle adjustment object, the coordinates of the pixel blocks in the rotating image in the graphic coordinate system and the coordinates of the pixel blocks in the angle adjustment object in the graphic coordinate system;
reversely rotating the rotation image with the updated pixel value by a preset angle to obtain a reversely rotated image;
and if the distortion degree of the reverse rotation image meets the preset requirement, carrying out weighted summation on the pixel values of the pixel blocks at the corresponding positions in the reverse rotation image and the original image to obtain the anti-aliasing image.
In a fifth aspect, the present application also provides a computer program product. The computer program product comprises a computer program which, when executed by a processor, implements the steps of:
taking the original image as an angle adjustment object, and rotating the angle adjustment object by a preset angle along a preset direction to obtain a rotating image;
Updating the pixel values corresponding to the pixel blocks in the rotating image based on the pixel values of the pixel blocks in the angle adjustment object, the coordinates of the pixel blocks in the rotating image in the graphic coordinate system and the coordinates of the pixel blocks in the angle adjustment object in the graphic coordinate system;
reversely rotating the rotation image with the updated pixel value by a preset angle to obtain a reversely rotated image;
and if the distortion degree of the reverse rotation image meets the preset requirement, carrying out weighted summation on the pixel values of the pixel blocks at the corresponding positions in the reverse rotation image and the original image to obtain the anti-aliasing image.
The image rotation antialiasing method, the device, the computer equipment and the storage medium take an original image as an angle adjustment object, rotate the angle adjustment object by a preset angle along a preset direction, and obtain a rotation image; and updating the pixel value corresponding to each pixel block in the rotating image based on the pixel value of each pixel block in the angle adjustment object, the coordinate of each pixel block in the graph coordinate system in the rotating image and the coordinate of each pixel block in the graph coordinate system in the angle adjustment object, and reversely rotating the rotating image with the updated pixel value by a preset angle to obtain a reversely rotated image. In the process of each image rotation, the pixel value of each pixel block in the rotated image is updated, so that the image jaggy feeling is eliminated. The invention adopts the positions before and after the image rotation to update the pixel values of each pixel block, compared with the traditional method for discriminating the image edge, detecting the shape and other multiple discrimination methods, the anti-aliasing method has higher calculation speed, and adopts multiple rotation anti-aliasing and the pixel values of the pixel blocks at the positions corresponding to the original image to carry out weighted summation, thus having better anti-aliasing effect.
Drawings
FIG. 1 is a diagram of an application environment for an image rotation antialiasing method in one embodiment;
FIG. 2 is a display image with a noticeable jaggy feel in one embodiment;
FIG. 3 is a block diagram of pixels of the line of FIG. 2 with the smallest slope in one embodiment;
FIG. 4 is a block diagram of pixels of the approximately vertical line of FIG. 2 in one embodiment;
FIG. 5 is a flow diagram of an image rotation antialiasing method in one embodiment;
FIG. 6 is a schematic diagram of an original image in one embodiment;
FIG. 7 is a schematic diagram of a rotated image in one embodiment;
FIG. 8 is a schematic diagram of coordinates of a pixel block before and after rotation in one embodiment;
FIG. 9 is a flowchart of updating pixel values corresponding to each pixel block in a rotated image according to one embodiment;
FIG. 10 is a partial pixel block image of an original image in one embodiment;
FIG. 11 is a rotated image of a partial pixel block image of an original image rotated by an angle θ in a clockwise direction in one embodiment;
FIG. 12 is an image of an updated pixel block of a rotated image in one embodiment;
FIG. 13 is a schematic diagram of a counter-rotated image in one embodiment;
FIG. 14 is an effect diagram of the antialiasing image illustrated in FIG. 3 in one embodiment;
FIG. 15 is an effect diagram of the antialiasing of the image illustrated in FIG. 4 in one embodiment;
FIG. 16 is a graph of the effect of FIG. 3 after antialiasing using an isotropic antialiasing method in one embodiment;
FIG. 17 is an antialiasing effect graph in one embodiment;
FIG. 18 is another antialiasing effect graph in one embodiment;
FIG. 19 is a block diagram of an image rotation antialiasing device in one embodiment;
fig. 20 is an internal structural view of a computer device in one embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application will be further described in detail with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the present application.
The image rotation antialiasing method provided by the embodiment of the application can be applied to an application environment as shown in fig. 1. The graphics processor 102 takes an original image as an angle adjustment object, rotates the angle adjustment object by a preset angle along a preset direction, and obtains a rotation image; updating the pixel values corresponding to the pixel blocks in the rotating image based on the pixel values of the pixel blocks in the angle adjustment object, the coordinates of the pixel blocks in the rotating image in the graphic coordinate system and the coordinates of the pixel blocks in the angle adjustment object in the graphic coordinate system; reversely rotating the rotation image with the updated pixel value by a preset angle to obtain a reversely rotated image; and if the distortion degree of the reverse rotation image meets the preset requirement, carrying out weighted summation on the pixel values of the pixel blocks at the corresponding positions in the reverse rotation image and the original image to obtain the anti-aliasing image. The graphics processor 102 stores coordinates in a graphics coordinate system of each pixel block in the rotated image and each pixel block in the counter-rotated image, as well as pixel values of the original image, the rotated image, and the counter-rotated image, into the memory 104.
When the display device displays an image, the display device mainly displays different pixel values through a plurality of single pixel points, and the single pixel display points cannot be infinitely small, and any displayed curve is formed by discrete point pixels, so that lines in the image have a saw tooth feel visually when the display device displays the image. The jaggy feel is more pronounced when there is a long diagonal line in the image or graphic, due to the sensitivity of the human eye to view the image and the inertia of the brain's consciousness, especially when the offset is horizontal or vertical at a small angle. For example, as shown in fig. 2, the lines in the display image have obvious jaggy feeling, and the lines with the smallest slope in fig. 2 are amplified to obtain a pixel block distribution diagram of the lines as shown in fig. 3; amplifying the approximately vertical line in fig. 2 to obtain a pixel block distribution diagram of the line as shown in fig. 4; as can be seen from fig. 3 and 4, the pixel blocks are not distributed in the same direction, so that there is a clear jaggy feeling in the image, and an antialiasing operation is required to be performed on the image in order to reduce the distortion degree of the image.
In one embodiment, as shown in fig. 5, there is provided an image rotation antialiasing method, which is described by taking an example that the method is applied to the graphics processor in fig. 1, and includes the following steps:
Step 502, taking the original image as an angle adjustment object, and rotating the angle adjustment object by a preset angle along a preset direction to obtain a rotated image.
The image rotation refers to a process of forming a new image by rotating an image by a certain angle with a certain point as the center, and in this embodiment, the angle adjustment object rotates by a certain angle with a certain point as the center to form a rotation image. The preset direction may be either clockwise or counterclockwise. The preset angle is to ensure that at least one pixel block generates offset between two vertexes of the longest hypotenuse line segment in the original image after the original image rotates. For example, for a current display device with an approximately 8bit gray scale resolution, a maximum of 256 pixel gradation bands can be resolved, with 0.2 degrees selected. In this embodiment, the longest hypotenuse line segment is selected to be convenient for measuring the rotation angle, and the rotation angle corresponding to the longest hypotenuse line segment is the most obvious, and the higher the measurement accuracy is. In this embodiment, the specific value of the preset angle is not limited, and the deflection angle can be dynamically changed according to the content of the original image, so as to generate different anti-aliasing effects.
In some embodiments, step 502 specifically includes the steps of: taking the image center of the angle adjustment object as an origin, rotating the angle adjustment object by a preset angle along a preset direction, and obtaining a rotating image; wherein, the position information of each pixel block in the rotating image in the graphic coordinate system is stored in the appointed storage space of the memory.
The length and width of the circumscribed boundary of the occupied area of the rotation image in the rotation process are changed according to the rotation angle of the rotation image, and accordingly, the graph in the circumscribed boundary and the designated storage space required by the memory are required to be recalculated and stored. For example, when the original image is rotated by a predetermined angle as shown in fig. 6, the obtained rotated image is shown in fig. 7, the circumscribed boundary of fig. 7 is larger than that of fig. 6, and the designated storage space required for storing the graphic data shown in fig. 7 is also larger.
Because the original image uses the top left corner vertex in the original image as the origin, uses the horizontal axis as the x axis, uses the coordinate axis of the vertical x axis as the image coordinate system established by the y axis, if the original image is rotated by using the top left corner as the origin, the larger the space range required by the image rotation is, the more the corresponding required storage resources are. Therefore, in this embodiment, the image coordinate system is reconstructed with the image center of the original image as the origin, the horizontal axis as the x-axis, and the coordinate axis of the vertical x-axis as the y-axis. In the actual use process, if the image resolution of the original image is (X max ,Y max ) The image center of the original image is the image resolution of (1/2*X) max ,1/2*Y max ) Corresponding points.
The present embodiment rotates the original image with the image center of the original image as the origin, and the required space range is minimum, so that the required designated storage space is also minimum.
According to the rotation of the image center, there will naturally be one such attribute: the positions of the points before and after rotation are unchanged from the center of the image, and based on the attribute, the coordinate corresponding relation of the same pixel block in the original image before and after rotation can be obtained. For example, as shown in fig. 8, in the reconstructed image coordinate system, assuming that the distance between the point (x 0, y 0) and the origin is r, the angle between the line between the point and the origin and the x axis is b, the angle of rotation is a, and the point after rotation is (x 1, y 1), the coordinate correspondence relationship between the same pixel block before rotation and after rotation is as follows:
x0=r*cosb;y0=r*sinb
x1=r*cos(b-a)=r*cosb*cosa+r*sinb*sina=x0cosa+y0sina;
y1=r*sin(b-a)=r*sinb*cosa–r*cosb*sina=-x0sina+y0cosa。
step 504, updating the pixel values corresponding to the pixel blocks in the rotated image based on the pixel values of the pixel blocks in the angle adjustment object and the coordinates of the pixel blocks in the rotated image and the coordinates of the pixel blocks in the angle adjustment object in the graphic coordinate system.
Wherein, the pixel values of the original image and the rotated image are mixed, and the process of updating the pixel values corresponding to each pixel block in the rotated image is even the process of eliminating the image jaggy feeling.
It should be noted that: the axial direction of each axis is kept unchanged in the image rotation process of the graphic coordinate system, namely the graphic coordinate system does not rotate along with the angle adjustment object and the rotation image. In this embodiment, the coordinates before rotation and the coordinates after rotation are obtained in the same coordinate system, and the basic data can be provided for the subsequent calculation of the updated pixel value based on the position changes of each pixel block before rotation and after rotation and the distance between the coordinates before rotation and the coordinates after rotation of the same pixel block.
Optionally, the graphics processor determines the distance between the same pixel block before and after rotation based on the coordinates of each pixel block in the rotation image in the graphics coordinate system and the coordinates of each pixel block in the angle adjustment object in the graphics coordinate system; and carrying out weighted summation based on the distance corresponding to each pixel block and the pixel value, thereby updating the pixel value corresponding to each pixel block in the rotating image, and storing the coordinates of each pixel block in the rotating image in a graph coordinate system and the updated pixel value into a memory.
And step 506, reversely rotating the rotation image with the updated pixel value by a preset angle to obtain a reversely rotated image.
After the rotation image is reversely rotated by a preset angle, the obtained direction of the reverse rotation image is consistent with that of the original image, and it is noted that the pixel value of each pixel block in the reverse rotation image is different from that of the pixel block at the corresponding position in the original image, so that the reverse rotation image is not the original image.
It should be noted that: after the counter-rotated image is obtained, before step 508 is performed, it may be determined whether an image antialiasing process is required to further eliminate the image aliasing. If the image antialiasing is required to be performed again, updating the pixel value corresponding to each pixel block in the reverse rotation image based on the pixel value of each pixel block in the rotation image after updating the pixel value, and the coordinates of each pixel block in the reverse rotation image and the coordinates of each pixel block in the rotation image. If no more antialiasing of the image is required, the next step is performed after the counter-rotated image is obtained, step 508.
It should be noted that: the direction of the rotating image in the image coordinate system is not horizontal, and at the moment, if the rotating image is not reversely rotated by a preset angle, the image processor reads the coordinates and the pixel values corresponding to each pixel block in the rotating image based on the memory, and the displayed rotating image is inclined and does not meet the image display requirement; in addition, in step 508, the corresponding positions of the original image and the rotated image cannot be found in the process of performing the weighted summation of the pixel values with the pixel blocks at the corresponding positions in the original image.
Optionally, the graphic processor rotates the rotation image reversely by a preset angle by taking the image center of the rotation image as an origin, obtains a reverse rotation image, determines coordinates of each pixel block in the reverse rotation image in a graphic coordinate system according to a position mapping relation of each pixel block in the reverse rotation image before and after rotation, and stores position information of each pixel block in the reverse rotation image in the graphic coordinate system in a designated storage space of the memory, wherein the size of the designated storage space is determined based on an circumscribed boundary of an occupied area of the reverse rotation image in the rotation process.
In step 508, if the distortion degree of the reverse rotation image meets the preset requirement, the pixel values of the pixel blocks at the corresponding positions in the reverse rotation image and the original image are weighted and summed to obtain the anti-aliasing image.
The distortion degree is used for judging the image jaggies, and the smaller the distortion degree is, the smaller the image jaggies are, and the smoother the image edges are. The distortion degree can be obtained through subjective judgment of staff or calculation by a software algorithm, and the obtaining method of the distortion degree is not limited.
The anti-aliasing effect can be further increased or reduced by weighted summation of the pixel values of the counter-rotated image and the corresponding pixel blocks in the original image.
It should be noted that: the antialiasing effect of the original image is not proportional to the number of antialiasing treatments, in some cases, the more antialiasing treatments, the less antialiasing effect; thus, in this embodiment, the antialiasing procedure is set to 2-3 times, i.e., 2-3 rotations, each of which updates the pixel value of the image. After the antialiasing operation is performed, if the antialiasing effect is not as good as that of the antialiasing operation of the last time, in the process of performing weighted summation on the pixel values of the pixel blocks at the corresponding positions in the counter-rotated image and the original image, the antialiasing effect is weakened by increasing the weight of the original image; after the antialiasing operation is performed, if the antialiasing effect does not meet the preset requirement, the antialiasing effect is enhanced by increasing the weight of the counter-rotated image.
In this embodiment, since the antialiasing effect of the counter-rotated image is better than the antialiasing effect of the counter-rotated image after the pixel values of the pixel blocks at the corresponding positions in the original image are weighted and summed, in this embodiment, the weight of the counter-rotated image or the original image may be set to 0. If the weight of the reverse rotation image is set to 0, the anti-aliasing effect of the reverse rotation image is not better than that of the original image, and the original image is taken as a final anti-aliasing image; if the weight of the original image is set to 0, it is indicated that the antialiasing effect of the reverse-rotated image is the best of all weight combinations, and the reverse-rotated image is taken as the final antialiased image.
In some embodiments, if the distortion degree of the reverse rotation image does not meet the preset requirement, the reverse rotation image is taken as the angle adjustment object, and the step of rotating the angle adjustment object by a preset angle along the preset direction is returned and continuously performed until the obtained distortion degree of the reverse rotation image meets the preset requirement.
The number of image rotations in this embodiment is necessarily an even number. In this embodiment, the rotation of the object is adjusted by an angle to obtain a rotation image, and the reverse rotation of the rotation image to obtain a reverse rotation image is a set of antialiasing procedures of the double rotation images, and the rotation directions of the two rotation directions are different, but the rotation angles are the same. The preset rotation angles in the antialiasing process of each group of double-rotation images can be the same or different.
Optionally, the image processor acquires the distortion degree of the reverse rotation image, and if the distortion degree of the reverse rotation image meets a preset requirement, the pixel values of the pixel blocks at the corresponding positions in the reverse rotation image and the original image are weighted and summed to obtain an anti-aliasing image; and if the distortion degree of the reverse rotation image does not meet the preset requirement, taking the reverse rotation image as an angle adjustment object, returning to the step of rotating the angle adjustment object by a preset angle along the preset direction, and continuing to execute until the obtained distortion degree of the reverse rotation image meets the preset requirement.
In the image rotation antialiasing method, an original image is taken as an angle adjustment object, and the angle adjustment object is rotated by a preset angle along a preset direction to obtain a rotation image; and updating the pixel value corresponding to each pixel block in the rotating image based on the pixel value of each pixel block in the angle adjustment object, the coordinate of each pixel block in the graph coordinate system in the rotating image and the coordinate of each pixel block in the graph coordinate system in the angle adjustment object, and reversely rotating the rotating image with the updated pixel value by a preset angle to obtain a reversely rotated image. In the process of each image rotation, the pixel value of each pixel block in the rotated image is updated, so that the image jaggy feeling is eliminated. In the embodiment, the pixel values of each pixel block are updated by adopting the positions before and after the image rotation, compared with the traditional method for discriminating the image edge, detecting the shape and other multiple discrimination methods, the antialiasing method has higher calculation speed, and the antialiasing effect is better by adopting the repeated rotation antialiasing and the weighted summation of the pixel values of the pixel blocks at the positions corresponding to the original image.
In one embodiment, the principle of updating the pixel values corresponding to the pixel blocks in the rotated image is the same as that of updating the pixel values corresponding to the pixel blocks in the counter rotated image, and therefore, only the principle of updating the pixel values corresponding to the pixel blocks in the rotated image will be described herein. As shown in fig. 9, updating pixel values corresponding to each pixel block in a rotated image based on pixel values of each pixel block in an angle adjustment object, and coordinates of each pixel block in a rotated image in a graphics coordinate system, and coordinates of each pixel block in the angle adjustment object in the graphics coordinate system, includes the steps of:
Step 902, for each pixel block in the rotated image, determining original information and reference information corresponding to the current pixel block in the rotated image; the original information comprises coordinates and pixel values of the corresponding original pixel blocks in the image coordinate system in the angle adjustment object before the current pixel block rotates; the reference information includes coordinates and pixel values of a plurality of reference pixel blocks adjacent to the original pixel block in a graphic coordinate system; the original pixel block is a position mapping pixel block of the current pixel block in an angle adjustment object; the reference pixel block is a pixel block adjacent to the original pixel block in the angle adjustment object.
The principle of the pixel value updating process of each pixel block in the rotated image is the same, so that the pixel value updating process of the pixel block in the rotated image is described by taking one of the pixel blocks as an example.
In some embodiments, determining original information and reference information corresponding to a current pixel block in a rotated image includes the steps of:
and step 1, reading the coordinates of a current pixel block in the rotating image from a memory, and determining the coordinates of an original pixel block corresponding to the current pixel block before rotation and the coordinates of a plurality of reference pixel blocks adjacent to the original pixel block based on the position mapping relation of each pixel block before rotation and after rotation in the rotating image and the coordinates of the current pixel block.
And 2, inquiring the pixel value corresponding to the original pixel block and the pixel value corresponding to each reference pixel block in a memory according to the coordinates of the original pixel block and the coordinates of each reference pixel block.
In order to obtain the coordinates of the original image before and after rotation, the conventional method is to store the original coordinates of each pixel block before rotation into a memory, then calculate the coordinates after rotation, store the coordinates of each pixel block after rotation into the memory, store and read the coordinates for several times in the middle, and store the coordinates twice, which wastes storage resources and has low calculation efficiency. Therefore, in order to solve the above problem, in this embodiment, coordinates of each pixel block in the rotated image are obtained by a raster scanning manner, the coordinates of each pixel block in the rotated image are stored in a memory, the coordinates of each pixel block in the original image are reversely calculated based on a position mapping relationship between each pixel block in the rotated image before and after rotation (i.e., the coordinates and rotation angle after rotation are known, and the original coordinates before rotation are reversely solved), after the coordinates of each pixel block in the original image are obtained, the coordinates of the reference pixel block are obtained by reasoning based on the coordinates of each pixel block in the original image and the position relationship between the reference pixel block and the pixel block in the original image, and pixel values corresponding to each pixel block in the original image and pixel values corresponding to the reference pixel block are obtained by a table look-up manner; the memory stores pixel values of pixel blocks in the original image in a tabular mode in advance. By adopting the reverse table lookup method, the coordinates and the pixel values before rotation are obtained, only the images after rotation are scanned, the coordinates after rotation are obtained, the coordinates after rotation are stored, the coordinates before rotation are not required to be stored, hardware storage resources can be reduced, the memory query time is shortened, and the calculation efficiency is improved.
It should be noted that: in this embodiment, the number of reference pixel blocks may be selected from adjacent 1, 2, 3, 4 or other pixel blocks.
Alternatively, as shown in fig. 10, a partial pixel block image of the original image; fig. 11 is a rotated image obtained by rotating a partial image of an original image by an angle θ in the clockwise direction. Taking a current pixel block in a rotation image as a pixel block A in FIG. 11 as an example, obtaining the coordinates of the current pixel block A in a graph coordinate system in a raster scanning mode, and determining that an original pixel block corresponding to the current pixel block A in an angle adjustment object before rotation is A 'and the coordinates (x 0, y 0) of the original pixel block is A' based on the position mapping relation of each pixel block before rotation and after rotation in the rotation image, wherein four reference pixel blocks which are adjacent to the original pixel block in the vertical and horizontal directions are a reference pixel block A1, a reference pixel block A2, a reference pixel block A3 and a reference pixel block A4 respectively; after the coordinates corresponding to the original pixel block a 'and the reference pixel block A1, the reference pixel block A2, the reference pixel block A3 and the reference pixel block A4 are obtained, the pixel values of the original pixel block a' and the reference pixel block A1, the reference pixel block A2, the reference pixel block A3 and the reference pixel block A4 are obtained in a table look-up mode.
Step 904, determining a distance between the current pixel block and each reference pixel block in the graphics coordinate system based on the coordinates of the current pixel block in the rotated image and the coordinates of the plurality of reference pixel blocks.
Wherein, since the current pixel block and the reference pixel block are in the same coordinate system, the distance between the current pixel block and the reference pixel block can be determined based on the coordinates of the current pixel block and the reference pixel block.
Alternatively, as shown in fig. 11, distances from the current pixel block a to the reference pixel block A1, the reference pixel block A2, the reference pixel block A3, and the reference pixel block A4 are calculated based on the coordinates of the current pixel block a and the coordinates of the reference pixel block A1, the reference pixel block A2, the reference pixel block A3, and the reference pixel block A4, respectively.
Step 906, updating the pixel value corresponding to the current pixel block based on the pixel value corresponding to each reference pixel block and the distance between the current pixel block and each reference pixel block, and obtaining the updated pixel value of each pixel block in the rotated image.
Wherein step 906 comprises the steps of:
and step 1, determining the weight corresponding to each reference pixel block according to the distance between the current pixel block and each reference pixel block.
And step 2, carrying out weighted summation on the pixel values corresponding to each reference pixel block and the weights to obtain updated pixel values of the current pixel block.
And carrying out weighted summation on pixel values corresponding to each reference pixel block and weights based on the distances between the current pixel block in the rotated image and a plurality of adjacent reference pixel blocks in the original image as weights, so as to obtain updated pixel values of the current pixel block. The pixel values of each pixel block in the rotated image are updated by the same method, and the final image effect is to add the pixel blocks gradually changed in the controlled direction in the slope direction of the image edge. As shown in fig. 12, for the updated image of each pixel block in the rotated image, as can be seen from comparing fig. 11, the pixel blocks gradually changed in the controlled direction, that is, the pixel blocks defined by the dotted line in fig. 12, are added in the slope direction of the edge of the image in fig. 12, and the pixel values of the pixel blocks gradually decrease in the slope direction of the line segment along the edge portion of the line segment in the rotated image, that is, the gradual change effect is exhibited. After the reverse rotation of fig. 12 by a preset angle, the obtained reverse rotation image returns to the original position, and a schematic diagram of the reverse rotation image is shown in fig. 13.
In some embodiments, the effects of the anti-aliasing method of the present embodiment after the anti-aliasing of fig. 3 and 4 are respectively shown in fig. 14 and 15, and as can be obtained by comparing fig. 13 to 15, the anti-aliasing effect of the present embodiment is smoother than the original image.
In this embodiment, since the original image is rotated, the distances from any pixel block in the rotated image to each pixel block in the original image are different. In the process of carrying out pixel value weighted summation according to the distance, the proportion of each pixel block participating in antialiasing is different, and the antialiasing effect finally presented is that a controlled direction gradually changes along the oblique line direction on a line segment in an original image, namely, the antialiasing effect of the embodiment is better compared with the traditional isotropic antialiasing method, such as a bilinear interpolation algorithm, a bicubic interpolation algorithm and the like, by adopting the anisotropic method. For example, as shown in fig. 16, the effect after antialiasing in fig. 3 using the isotropic antialiasing method, and comparing fig. 15 and fig. 16, it can be seen that the anisotropic antialiasing effect is significantly better than the isotropic antialiasing effect in this embodiment.
In some embodiments, the present embodiment also provides anti-aliasing effects of other lines, specifically, as shown in fig. 17 and fig. 18, according to fig. 17 and fig. 18, the rotary anti-aliasing method of the present embodiment can also obtain morphological anti-aliasing effects.
In this embodiment, based on the pixel values corresponding to each reference pixel block and the distances between the current pixel block and each reference pixel block, the pixel values corresponding to the current pixel block are updated, and the updated pixel values of each pixel block in the rotated image are obtained, and the finally presented image antialiasing effect is to add the pixel block gradually changed in the controlled direction along the slope direction of the oblique line in the original image, that is, the present embodiment adopts the anisotropic method to antialiase, and compared with the traditional isotropic antialiasing method, such as the bilinear interpolation algorithm, the bicubic interpolation algorithm, and the like, the antialiasing effect of the present embodiment is better, the applicability is stronger, and the processing algorithm is simple.
In one embodiment, after the rotated image is obtained, the coordinates of each pixel block in the rotated image need to be stored in a memory; after the pixel value of the rotating image is updated, the pixel value of the rotating image after updating is required to be stored in a memory; after the counter-rotated image is obtained, the coordinates of each pixel block in the counter-rotated image also need to be stored in the memory. In the above storage process, a plurality of times of storage is needed, and each time of storage needs to store the position data corresponding to the whole image, and more hardware storage resources are needed, so in order to solve the above problem, the embodiment does not need to buffer the whole image, only needs 2 times of image rotation line buffering, namely, 2 times of image rotation line buffering needs 1 time of 2 times of rotation in the rotation image and the reverse rotation image is obtained. The specific implementation steps are as follows: the input video pixel values are read in raster scan order and these data will be stored in an on-chip line buffer, each of which operates as a FIFO.
In order to increase the processing speed, reduce the clock frequency of the processing circuit and simultaneously consider the area of the processing circuit, a parallel processing mode of 1 pixel block/2 pixel block/4 pixel block/8 pixel block can be adopted. The 2 pixel block/4 pixel block/8 pixel block parallel processing mode needs to simultaneously fetch the original image pixel values of the 2 pixel block/4 pixel block/8 pixel block from the line buffer, and meanwhile, the 2 pixel block/4 pixel block/8 pixel block parallel after rotation can be scattered in the upper and lower adjacent 2/4/8 lines. Parallel counter-rotation look-up tables for adjacent 2 pixel blocks/4 pixel blocks/8 pixel blocks will look up within 2/4/8 of the rows. If the line buffer is implemented by SRAM, 2/4/8 line content should be read out at a time, and then the pixel value lookup table of 2 pixel block/4 pixel block/8 pixel block should be found.
Taking a 4-pixel block as an example for illustration, the coordinates after the image rotation transformation are expressed as: (Xo, yo) represents the original coordinates before rotation; (Xh, yh) represents the coordinates after rotation; a represents a rotation angle;
Yh=Xo*sin(a)+Yo*cos(a)=Xo*sin(a)+Yo*sin(90-a)
Xh=Xo*cos(a)-Yo*sin(a)=Xo*sin(90-a)-Yo*sin(a)
for consecutive 4 points in any row: the relation between the coordinates (Xh, yh) after rotation and the coordinates (Xo, yo) before rotation is as follows
Xo=n,n+1,n+2,n+3
Yo= m (not change in one line), m represents the ordinate, the ordinate of the pixel block of the same row being unchanged;
Yh=Xo*sin(a)+m*sin(90-a)
Xh=Xo*sin(90-a)-m*sin(a)
yh|max= (n+3) ×sin (a) +m×sin (90-a), yh|max representing the maximum value of the y coordinate after rotation;
yh|min= (n+0) ×sin (a) +m×sin (90-a), yh|min representing the minimum value of the y coordinate after rotation;
yh|max-yh|min=3 sin (a) <=3, yh|max-yh|min representing the maximum range of variation of the y coordinate after rotation;
the same principle can be obtained:
the maximum range of variation of the rotated y-coordinate is: xh|max-xh|min=3×cos (a) <=3
It can be derived that: the coordinates X or Y after the continuous 4-point transformation in one row are not more than 4, namely, in 4 rows of a row buffer, the rotated values can be searched in 4 rows of SRAM (static random access memory) in one step, and the starting position of the 4 rows is any value.
According to the method, an SRAM can be designed, 4 rows are taken at a time, ROM addresses of pixel blocks of the 4 rows are firstly searched, and then pixel block values of corresponding columns in each row are filtered out.
In one embodiment, the present embodiment provides a specific step of an image rotation antialiasing method, including the steps of:
step 1, taking an original image as an angle adjustment object, taking the image center of the angle adjustment object as an original point, and rotating the angle adjustment object by a preset angle along a preset direction to obtain a rotating image; wherein, the position information of each pixel block in the rotating image in the graphic coordinate system is stored in the appointed storage space of the memory.
And 2, for each pixel block in the rotating image, reading the coordinates of the current pixel block in the rotating image from a memory, and determining the coordinates of an original pixel block corresponding to the current pixel block before rotation and the coordinates of a plurality of reference pixel blocks adjacent to the original pixel block based on the position mapping relation between the pixel blocks before rotation and after rotation in the rotating image and the coordinates of the current pixel block.
And step 3, inquiring the pixel value corresponding to the original pixel block and the pixel value corresponding to each reference pixel block in a memory according to the coordinates of the original pixel block and the coordinates of each reference pixel block.
And 4, determining the distance between the current pixel block and each reference pixel block in the graphic coordinate system based on the coordinates of the current pixel block in the rotated image and the coordinates of the plurality of reference pixel blocks.
And 5, determining the weight corresponding to each reference pixel block according to the distance between the current pixel block and each reference pixel block.
And 6, carrying out weighted summation on the pixel values corresponding to each reference pixel block and the weights to obtain updated pixel values of the current pixel block, and obtaining updated pixel values of each pixel block in the rotating image based on the steps 2-6.
Step 7, reversely rotating the rotation image with the updated pixel value by a preset angle to obtain a reversely rotated image;
and 8, after the reverse rotation image is obtained, updating the pixel value corresponding to each pixel block in the reverse rotation image based on the pixel value of each pixel block in the rotation image with the updated pixel value, and the coordinates of each pixel block in the reverse rotation image and the coordinates of each pixel block in the rotation image.
And 9, if the distortion degree of the reverse rotation image meets the preset requirement, carrying out weighted summation on the pixel values of the pixel blocks at the corresponding positions in the reverse rotation image and the original image to obtain the anti-aliasing image.
And step 10, if the distortion degree of the reverse rotation image does not meet the preset requirement, taking the reverse rotation image as an angle adjustment object, returning to the step of rotating the angle adjustment object by a preset angle along the preset direction, and continuing to execute until the obtained distortion degree of the reverse rotation image meets the preset requirement.
In this embodiment, the anisotropic method is adopted to perform antialiasing, and compared with the traditional isotropic antialiasing method, such as bilinear interpolation algorithm, bicubic interpolation algorithm, etc., the antialiasing effect of this embodiment is better; according to the method, the step of processing the image resolution is not increased by rotating the anti-aliasing method, only the pixel values of a plurality of adjacent reference pixel blocks in the original image are used, anti-aliasing processing is carried out on the original image in the process of multiple rotations, the calculated amount is less compared with that of the traditional method, and the operation algorithm is simpler; in addition, in the embodiment, the coordinates of the pixel block before rotation are reversely searched based on the coordinates of the pixel block after rotation in a reverse table searching mode, so that hardware storage resources can be saved.
It should be understood that, although the steps in the flowcharts related to the embodiments described above are sequentially shown as indicated by arrows, these steps are not necessarily sequentially performed in the order indicated by the arrows. The steps are not strictly limited to the order of execution unless explicitly recited herein, and the steps may be executed in other orders. Moreover, at least some of the steps in the flowcharts described in the above embodiments may include steps or stages, which are not necessarily performed at the same time, but may be performed at different times, and the order of the steps or stages is not necessarily performed sequentially, but may be performed alternately or alternately with at least some of the other steps or stages.
Based on the same inventive concept, the embodiments of the present application also provide an image rotation antialiasing apparatus for implementing the above-mentioned related image rotation antialiasing method. The implementation of the solution provided by the device is similar to that described in the above method, so the specific limitations of the embodiment of the image rotation antialiasing device or embodiments provided below may be referred to above as limitations of the image rotation antialiasing method, and will not be described in detail herein.
In one embodiment, as shown in fig. 19, there is provided an image rotation antialiasing apparatus comprising: a rotation module 100, a first anti-aliasing module 200, a counter-rotation module 300, and a second anti-aliasing module 400, wherein:
the rotation module 100 is configured to take an original image as an angle adjustment object, rotate the angle adjustment object by a preset angle along a preset direction, and obtain a rotation image;
the first antialiasing module 200 is configured to update a pixel value corresponding to each pixel block in the rotated image based on a pixel value of each pixel block in the angle adjustment object, and a coordinate of each pixel block in the rotated image in a graphics coordinate system, and a coordinate of each pixel block in the angle adjustment object in the graphics coordinate system;
The reverse rotation module 300 is configured to reversely rotate the rotated image with the updated pixel value by a preset angle to obtain a reversely rotated image;
and the second antialiasing module 400 performs weighted summation on the pixel values of the pixel blocks at the corresponding positions in the reverse rotation image and the original image to obtain an antialiased image when the distortion degree of the reverse rotation image meets the preset requirement.
In one embodiment, the rotation module 100 is further configured to: taking the image center of the angle adjustment object as an origin, rotating the angle adjustment object by a preset angle along a preset direction, and obtaining a rotating image; wherein, the position information of each pixel block in the rotating image in the graphic coordinate system is stored in the appointed storage space of the memory.
In one embodiment, the first antialiasing module 200 is further configured to determine, for each pixel block in the rotated image, original information and reference information corresponding to the current pixel block in the rotated image; the original information comprises coordinates and pixel values of the corresponding original pixel blocks in the image coordinate system in the angle adjustment object before the current pixel block rotates; the reference information includes coordinates and pixel values of a plurality of reference pixel blocks adjacent to the original pixel block in a graphic coordinate system; the original pixel block is a position mapping pixel block of the current pixel block in an angle adjustment object; the reference pixel block is a pixel block adjacent to the original pixel block in the angle adjustment object;
Determining a distance between a current pixel block and each reference pixel block in a graph coordinate system based on coordinates of the current pixel block and coordinates of a plurality of reference pixel blocks in the rotated image;
and updating the pixel value corresponding to the current pixel block based on the pixel value corresponding to each reference pixel block and the distance between the current pixel block and each reference pixel block, and obtaining the updated pixel value of each pixel block in the rotating image.
In one embodiment, the first antialiasing module 200 is further configured to read the coordinates of the current pixel block in the rotated image from the memory, determine the coordinates of the original pixel block corresponding to the current pixel block before rotation, and the coordinates of the plurality of reference pixel blocks adjacent to the original pixel block, based on the position mapping relationship between each pixel block before rotation and after rotation in the rotated image and the coordinates of the current pixel block;
and inquiring the pixel value corresponding to the original pixel block and the pixel value corresponding to each reference pixel block in the memory according to the coordinates of the original pixel block and the coordinates of each reference pixel block.
In one embodiment, the first antialiasing module 200 is further configured to determine a weight corresponding to each reference pixel block according to a distance between the current pixel block and each reference pixel block;
And carrying out weighted summation on the pixel values corresponding to the reference pixel blocks and the weights to obtain updated pixel values of the current pixel block.
In one embodiment, the reverse rotation module 300 is further configured to update the pixel values corresponding to the pixel blocks in the reverse rotation image based on the pixel values of the pixel blocks in the rotation image after the pixel values are updated and the coordinates of the pixel blocks in the reverse rotation image and the coordinates of the pixel blocks in the rotation image after the reverse rotation image is obtained.
In one embodiment, when the distortion degree of the reverse rotation image does not meet the preset requirement, the second antialiasing module 400 takes the reverse rotation image as the angle adjustment object, returns to the step of rotating the angle adjustment object by a preset angle along the preset direction, and continues to execute until the obtained distortion degree of the reverse rotation image meets the preset requirement.
The various modules in the image rotation antialiasing apparatus described above may be implemented in whole or in part by software, hardware, or a combination thereof. The above modules may be embedded in hardware or may be independent of a processor in the computer device, or may be stored in software in a memory in the computer device, so that the processor may call and execute operations corresponding to the above modules.
In one embodiment, a computer device is provided, which may be a terminal, and an internal structure diagram thereof may be as shown in fig. 20. The computer device includes a processor, a memory, an input/output interface, a communication interface, a display unit, and an input means. The processor, the memory and the input/output interface are connected through a system bus, and the communication interface, the display unit and the input device are connected to the system bus through the input/output interface. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The input/output interface of the computer device is used to exchange information between the processor and the external device. The communication interface of the computer device is used for carrying out wired or wireless communication with an external terminal, and the wireless mode can be realized through WIFI, a mobile cellular network, NFC (near field communication) or other technologies. The computer program is executed by a processor to implement an image rotation antialiasing method. The display unit of the computer device is used for forming a visual picture, and can be a display screen, a projection device or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer equipment can be a touch layer covered on the display screen, can also be a key, a track ball or a touch pad arranged on the shell of the computer equipment, and can also be an external keyboard, a touch pad or a mouse and the like.
It will be appreciated by those skilled in the art that the structure shown in fig. 20 is merely a block diagram of a portion of the structure associated with the present application and is not limiting of the computer device to which the present application applies, and that a particular computer device may include more or fewer components than shown, or may combine some of the components, or have a different arrangement of components.
In one embodiment, a computer device is provided, comprising a memory and a processor, the memory having stored therein a computer program, the processor implementing the steps of the above-described method embodiments when the computer program is executed.
In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored which, when executed by a processor, implements the steps of the method embodiments described above.
In an embodiment, a computer program product is provided, comprising a computer program which, when executed by a processor, implements the steps of the above-described method embodiments.
It should be noted that, the user information (including, but not limited to, user equipment information, user personal information, etc.) and the data (including, but not limited to, data for analysis, stored data, presented data, etc.) referred to in the present application are information and data authorized by the user or sufficiently authorized by each party, and the collection, use and processing of the related data are required to comply with the related laws and regulations and standards of the related countries and regions.
Those skilled in the art will appreciate that implementing all or part of the above described methods may be accomplished by way of a computer program stored on a non-transitory computer readable storage medium, which when executed, may comprise the steps of the embodiments of the methods described above. Any reference to memory, database, or other medium used in the various embodiments provided herein may include at least one of non-volatile and volatile memory. The nonvolatile memory may include Read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high density embedded nonvolatile memory, resistive random access memory (ReRAM), magnetic random access memory (Magnetoresistive RandomAccess Memory, MRAM), ferroelectric memory (Ferroelectric RandomAccess Memory, FRAM), phase change memory (Phase Change Memory, PCM), graphene memory, and the like. Volatile memory can include random access memory (RandomAccess Memory, RAM) or external cache memory, and the like. By way of illustration, and not limitation, RAM can be in the form of a variety of forms, such as static random access memory (Static RandomAccess Memory, SRAM) or dynamic random access memory (Dynamic RandomAccess Memory, DRAM), and the like. The databases referred to in the various embodiments provided herein may include at least one of relational databases and non-relational databases. The non-relational database may include, but is not limited to, a blockchain-based distributed database, and the like. The processors referred to in the embodiments provided herein may be general purpose processors, central processing units, graphics processors, digital signal processors, programmable logic units, quantum computing-based data processing logic units, etc., without being limited thereto.
The technical features of the above embodiments may be arbitrarily combined, and all possible combinations of the technical features in the above embodiments are not described for brevity of description, however, as long as there is no contradiction between the combinations of the technical features, they should be considered as the scope of the description.
The above examples only represent a few embodiments of the present application, which are described in more detail and are not to be construed as limiting the scope of the present application. It should be noted that it would be apparent to those skilled in the art that various modifications and improvements could be made without departing from the spirit of the present application, which would be within the scope of the present application. Accordingly, the scope of protection of the present application shall be subject to the appended claims.

Claims (10)

1. A method of image rotation antialiasing, the method comprising:
taking the original image as an angle adjustment object, and rotating the angle adjustment object by a preset angle along a preset direction to obtain a rotating image;
updating the pixel value corresponding to each pixel block in the rotating image based on the pixel value of each pixel block in the angle adjustment object, the coordinate of each pixel block in the rotating image in a graph coordinate system and the coordinate of each pixel block in the angle adjustment object in the graph coordinate system;
Reversely rotating the rotation image with the updated pixel value by a preset angle to obtain a reversely rotated image;
and if the distortion degree of the reverse rotation image meets the preset requirement, carrying out weighted summation on the pixel values of the pixel blocks at the corresponding positions in the reverse rotation image and the original image to obtain the anti-aliasing image.
2. The method according to claim 1, wherein the method further comprises:
and if the distortion degree of the reverse rotation image does not meet the preset requirement, taking the reverse rotation image as an angle adjustment object, returning to the step of rotating the angle adjustment object by a preset angle along the preset direction, and continuing to execute until the obtained distortion degree of the reverse rotation image meets the preset requirement.
3. The method according to claim 1, wherein rotating the angle adjustment object by a preset angle in a preset direction to obtain a rotated image includes:
taking the image center of the angle adjustment object as an origin, rotating the angle adjustment object by a preset angle along a preset direction, and obtaining a rotating image; and the position information of each pixel block in the rotating image in the graphic coordinate system is stored in a designated storage space of a memory.
4. The method according to claim 1, wherein updating the pixel value corresponding to each pixel block in the rotated image based on the pixel value of each pixel block in the angle adjustment object and the coordinates of each pixel block in the rotated image in the graphics coordinate system and the coordinates of each pixel block in the angle adjustment object in the graphics coordinate system, comprises:
for each pixel block in the rotated image, determining original information and reference information corresponding to the current pixel block in the rotated image; the original information comprises coordinates and pixel values of the corresponding original pixel blocks in the image coordinate system in the angle adjustment object before the current pixel block rotates; the reference information includes coordinates and pixel values of a plurality of reference pixel blocks adjacent to the original pixel block in a graphic coordinate system; the original pixel block is a position mapping pixel block of the current pixel block at an angle adjustment object; the reference pixel block is a pixel block adjacent to the original pixel block in the angle adjustment object;
determining a distance between a current pixel block and each reference pixel block in the graphic coordinate system based on coordinates of the current pixel block and coordinates of a plurality of reference pixel blocks in the rotated image;
Updating the pixel value corresponding to the current pixel block based on the pixel value corresponding to each reference pixel block and the distance between the current pixel block and each reference pixel block, and obtaining the updated pixel value of each pixel block in the rotating image.
5. The method of claim 4, wherein determining the original information and the reference information corresponding to the current pixel block in the rotated image comprises:
reading the coordinates of a current pixel block in the rotating image from a memory, and determining the coordinates of an original pixel block corresponding to the current pixel block before rotation and the coordinates of a plurality of reference pixel blocks adjacent to the original pixel block based on the position mapping relation between the pixel blocks before rotation and after rotation in the rotating image and the coordinates of the current pixel block;
and inquiring the pixel value corresponding to the original pixel block and the pixel value corresponding to each reference pixel block in the memory according to the coordinates of the original pixel block and the coordinates of each reference pixel block.
6. The method of claim 4, wherein updating the pixel value corresponding to the current pixel block based on the pixel value corresponding to each reference pixel block and the distance between the current pixel block and each reference pixel block comprises:
Determining the weight corresponding to each reference pixel block according to the distance between the current pixel block and each reference pixel block;
and carrying out weighted summation on pixel values corresponding to each reference pixel block and weights to obtain updated pixel values of the current pixel block.
7. The method of claim 1, wherein the step of performing weighted summation of the pixel values of the pixel block at the corresponding position in the original image and the counter-rotated image, before obtaining the antialiased image, further comprises:
after the reverse rotation image is obtained, updating the pixel value corresponding to each pixel block in the reverse rotation image based on the pixel value of each pixel block in the rotation image after updating the pixel value, and the coordinates of each pixel block in the reverse rotation image and the coordinates of each pixel block in the rotation image.
8. An image rotation antialiasing apparatus, the apparatus comprising:
the rotating module is used for taking the original image as an angle adjustment object, rotating the angle adjustment object by a preset angle along a preset direction, and obtaining a rotating image;
the first antialiasing module is used for updating the pixel value corresponding to each pixel block in the rotating image based on the pixel value of each pixel block in the angle adjustment object, the coordinate of each pixel block in the rotating image in a graph coordinate system and the coordinate of each pixel block in the angle adjustment object in the graph coordinate system;
The reverse rotation module is used for reversely rotating the rotation image with the updated pixel value by a preset angle to obtain a reverse rotation image;
and the second antialiasing module performs weighted summation on the pixel values of the pixel blocks at the corresponding positions in the reverse rotation image and the original image when the distortion degree of the reverse rotation image meets the preset requirement, so as to obtain an antialiased image.
9. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor implements the steps of the method of any of claims 1 to 7 when the computer program is executed.
10. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the steps of the method of any of claims 1 to 7.
CN202310323775.1A 2023-03-30 2023-03-30 Image rotation antialiasing method, apparatus, computer device, and storage medium Pending CN116433515A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310323775.1A CN116433515A (en) 2023-03-30 2023-03-30 Image rotation antialiasing method, apparatus, computer device, and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310323775.1A CN116433515A (en) 2023-03-30 2023-03-30 Image rotation antialiasing method, apparatus, computer device, and storage medium

Publications (1)

Publication Number Publication Date
CN116433515A true CN116433515A (en) 2023-07-14

Family

ID=87086632

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310323775.1A Pending CN116433515A (en) 2023-03-30 2023-03-30 Image rotation antialiasing method, apparatus, computer device, and storage medium

Country Status (1)

Country Link
CN (1) CN116433515A (en)

Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130033514A1 (en) * 2002-08-28 2013-02-07 Round Rock Research, Llc Full-scene anti-aliasing method and system
CN103826068A (en) * 2014-03-03 2014-05-28 南京航空航天大学 Video image rotation method
CN104463803A (en) * 2014-12-11 2015-03-25 上海卓悠网络科技有限公司 Method and device for eliminating image saw teeth
CN109064483A (en) * 2018-08-29 2018-12-21 广州市保伦电子有限公司 Picture antialiasing method, apparatus, single-chip microcontroller and the storage medium of LCD screen
CN109146794A (en) * 2018-09-29 2019-01-04 哈尔滨工业大学 A kind of light field image rotation error bearing calibration
CN109496326A (en) * 2017-12-29 2019-03-19 深圳配天智能技术研究院有限公司 A kind of image processing method, equipment and system
CN110300990A (en) * 2017-03-01 2019-10-01 索尼互动娱乐股份有限公司 It is carried out in the image just drawn anti-aliasing
CN111369446A (en) * 2018-12-26 2020-07-03 杭州海康威视数字技术股份有限公司 Image rotation method and device
CN113255656A (en) * 2020-12-18 2021-08-13 深圳怡化时代智能自动化系统有限公司 Image rotation method, device, equipment and storage medium
CN115187469A (en) * 2022-06-02 2022-10-14 深圳市纵维立方科技有限公司 Image processing method and device in 3D printing, storage medium and terminal
CN115496790A (en) * 2022-09-16 2022-12-20 北京邮电大学 Large-baseline light field video depth estimation method

Patent Citations (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130033514A1 (en) * 2002-08-28 2013-02-07 Round Rock Research, Llc Full-scene anti-aliasing method and system
CN103826068A (en) * 2014-03-03 2014-05-28 南京航空航天大学 Video image rotation method
CN104463803A (en) * 2014-12-11 2015-03-25 上海卓悠网络科技有限公司 Method and device for eliminating image saw teeth
CN110300990A (en) * 2017-03-01 2019-10-01 索尼互动娱乐股份有限公司 It is carried out in the image just drawn anti-aliasing
CN109496326A (en) * 2017-12-29 2019-03-19 深圳配天智能技术研究院有限公司 A kind of image processing method, equipment and system
WO2019127503A1 (en) * 2017-12-29 2019-07-04 深圳配天智能技术研究院有限公司 Image processing method, device and system
CN109064483A (en) * 2018-08-29 2018-12-21 广州市保伦电子有限公司 Picture antialiasing method, apparatus, single-chip microcontroller and the storage medium of LCD screen
CN109146794A (en) * 2018-09-29 2019-01-04 哈尔滨工业大学 A kind of light field image rotation error bearing calibration
CN111369446A (en) * 2018-12-26 2020-07-03 杭州海康威视数字技术股份有限公司 Image rotation method and device
CN113255656A (en) * 2020-12-18 2021-08-13 深圳怡化时代智能自动化系统有限公司 Image rotation method, device, equipment and storage medium
CN115187469A (en) * 2022-06-02 2022-10-14 深圳市纵维立方科技有限公司 Image processing method and device in 3D printing, storage medium and terminal
CN115496790A (en) * 2022-09-16 2022-12-20 北京邮电大学 Large-baseline light field video depth estimation method

Non-Patent Citations (5)

* Cited by examiner, † Cited by third party
Title
DUCK JIN CHUNG 等: "An anti-aliasing two-pass image rotation", IMAGE AND VIDEO PROCESSING, vol. 2666, 13 March 1996 (1996-03-13), pages 54 - 63 *
SHENGJU QIAN 等: "Blending Anti-Aliasing into Vision Transformer", NEURIPS 2021, 31 December 2021 (2021-12-31), pages 1 - 14 *
王思国 等: "一种改进的图像旋转算法", 沈阳理工大学学报, vol. 28, no. 05, 15 October 2009 (2009-10-15), pages 22 - 25 *
邵鹏 等: "一种后处理式的改进抗锯齿算法", 计算机科学, no. 2, 15 November 2018 (2018-11-15), pages 228 - 231 *
陶德元 等: "消除图像旋转失真的方法", 数据采集与处 理, vol. 6, no. 4, 31 December 1991 (1991-12-31), pages 34 - 38 *

Similar Documents

Publication Publication Date Title
JP4327105B2 (en) Drawing method, image generation apparatus, and electronic information device
US20230053462A1 (en) Image rendering method and apparatus, device, medium, and computer program product
KR101862182B1 (en) Varying effective resolution by screen location by altering rasterization parameters
US7348996B2 (en) Method of and system for pixel sampling
US7106322B2 (en) Dynamically adjusting a sample-to-pixel filter to compensate for the effects of negative lobes
US6850236B2 (en) Dynamically adjusting a sample-to-pixel filter in response to user input and/or sensor input
US7576751B2 (en) Pixel center position displacement
US20040207642A1 (en) Determining a coverage mask for a pixel
US8520007B2 (en) Graphic drawing device and graphic drawing method
US20080001961A1 (en) High Dynamic Range Texture Filtering
US7679620B2 (en) Image processing using saltating samples
CN115330986B (en) Method and system for processing graphics in block rendering mode
US20070097145A1 (en) Method and system for supersampling rasterization of image data
JP4456003B2 (en) Low cost supersampling rasterization
JP4801088B2 (en) Pixel sampling method and apparatus
JP2004310750A (en) High quality anti-aliasing
CN116433515A (en) Image rotation antialiasing method, apparatus, computer device, and storage medium
WO1999045502A1 (en) Subsampled texture edge antialiasing
US7170528B1 (en) Fast glyph rendering for vector based fonts
Lengyel Transition cells for dynamic multiresolution marching cubes
JP4766576B2 (en) Drawing method, image generation apparatus, and electronic information device
JP2023538828A (en) Antialiasing for distance field graphics rendering
CN116594582B (en) Image display method, apparatus, computer device and storage medium
WO2023208385A1 (en) A soft shadow algorithm with contact hardening effect for mobile gpu
CN116645428A (en) Image display method, device, computer equipment and storage medium

Legal Events

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