RELATED APPLICATION

The present application is based on and claims the priority to the Chinese Patent Application No. 202010333520.X, filed on Apr. 24, 2020, the entire contents of which are hereby incorporated by reference.

TECHNICAL FIELD

The present application relates to the field of computer software technologies, including an image processing method, apparatus, terminal device, and storage medium.

BACKGROUND

Before an image is displayed, image processing operations may be required to perform on the image. For an image with a rectangular shape, for example, considering that when the image with the rectangular shape is displayed by a terminal device with a rounded screen, a phenomenon that a right angle of the image does not match with the rounded screen may appear, thus before displaying the image with the rectangular shape, it is required to perform a rounded-corner processing on the image to make the displayed image shape match the rounded screen. When the rounded-corner processing is performed on the image with the rectangular shape, it is necessary to perform a corresponding operation on each pixel in the image to determine whether the pixel is within the round corner to be matched, so as to determine whether to perform the corresponding rounded-corner processing on the pixel. Therefore, this method requires numerous calculations, and greatly consumes a graphics processing unit (GPU), which also affects overall performances of the device.

SUMMARY

The present application proposes an image processing method, apparatus, terminal device, and storage medium that can solve problems in the related art, such as large amounts of calculations required, greatly consuming GPU, and affecting overall performances of the device, when the image processing is performed on rectangular images.

A first aspect of the present application provides an image processing method that can be applied to an image having a rectangular shape. The method can include dividing the image into a plurality of areas based on right angles of the image, and establishing a corresponding rectangular coordinate system for the right angle within each of the plurality of areas. Straight lines which are parallel to rectangular sides constituting the right angle and are at a first distance and a second distance from the rectangular sides respectively are taken as a first axis and a second axis of the rectangular coordinate system. Further, an intersection of the first axis and the second axis is taken as an origin of the rectangular coordinate system, in individual quadrants of the rectangular coordinate system, and a quadrant where the right angle is located is taken as a first quadrant of the corresponding rectangular coordinate system. The method can further include determining whether a pixel in the image is located in the first quadrant of the rectangular coordinate system, and, if it is determined that the pixel is located in the first quadrant of the rectangular coordinate system, performing an operation on the pixel, otherwise, performing no operation on the pixel.

A second aspect of the present application can provide an image processing apparatus that is applied to an image having a rectangular shape. The apparatus can include a rectangular coordinate system establishing module that is configured to divide the image into a plurality of areas based on right angles of the image, and establish a corresponding rectangular coordinate system for the right angle within each of the plurality of areas. Straight lines which are parallel to rectangular sides constituting the right angle and are at a first distance and a second distance from the rectangular sides respectively are taken as a first axis and a second axis of the rectangular coordinate system. Further, an intersection of the first axis and the second axis is taken as an origin of the rectangular coordinate system, in individual quadrants of the rectangular coordinate system, and a quadrant where the right angle is located is taken as a first quadrant of the corresponding rectangular coordinate system. The apparatus can further include a determining module that is configured to determine whether a pixel in the image is located in the first quadrant of the rectangular coordinate system, and an operation module that is configured to, if it is determined that the pixel is located in the first quadrant of the rectangular coordinate system, perform an operation on the pixel, otherwise, perform no operation on the pixel.

A third aspect of the present application provides a terminal device, including a memory, a processor, and a computer program stored on the memory and executable on the processor. The processor implements the method described in any of the embodiments above when executing the program.

A fourth aspect of the present application provides a computer storage medium on which a computer program is stored, wherein when the program is executed by a processor, the method described in any of the embodiments above is implemented.

