Image rotation device and rotation method
By using hardware rotation and scaling units under software control, lossless rotation and stretching of images are achieved, solving the problems of low rotation efficiency and limited functionality in existing technologies, and realizing efficient and smooth image rotation and scaling.
Patent Information
- Application Number
- CN202210062664.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-01-19
- Publication Date
- 2025-12-02
- Estimated Expiration
- 2042-01-19
AI Technical Summary
In existing technologies, CPU rotation is inefficient and cannot meet complex rotation requirements, while 2D rotation has limited functionality and cannot perform stretching.
Image rotation is achieved by using hardware rotation and scaling units under the control of software units. It supports lossless rotation and stretching rotation, and the rotation and scaling of images are realized through hardware modules.
It improves rotation efficiency, avoids stuttering, meets complex rotation requirements, saves CPU resources, and simplifies software programming.
Smart Images

Figure CN114418864B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image processing, and more specifically, to an image rotation device and rotation method. Background Technology
[0002] Image rotation is mostly implemented using CPU rotation or 2D rotation. Both methods have drawbacks. CPU rotation processes the image rotation using the CPU. Specifically, it involves creating two framebuffers: one stores the pixel data of the image before rotation (the original image), and the other stores the pixel data of the image after rotation (the rotated image). The CPU retrieves pixel data from the first framebuffer and places it into the corresponding position in the second framebuffer according to the rotation requirements. The advantage of CPU rotation is that it only requires the CPU, making the hardware simple. However, CPU processing efficiency is low, and stuttering can occur when processing large images. Software implementation requires complex software programming and cannot handle complex rotation requirements. 2D rotation is performed using a 2D module. Specifically, the original image is input to the hardware 2D module, which rotates the original image according to the programmed instructions. The advantage of 2D rotation is its higher efficiency than CPU rotation. However, the disadvantage of 2D rotation is its limited functionality, unable to handle complex requirements, such as stretching the rotated image. Summary of the Invention
[0003] To address the shortcomings and improvement needs of existing technologies, this invention provides an image rotation device and method that achieves image rotation through a hardware rotation unit and a hardware scaling unit, supporting lossless rotation and stretching rotation.
[0004] According to a first aspect of the present invention, an image rotation device is provided. The device includes a hardware rotation unit, a hardware scaling unit, and a software unit. The hardware rotation unit and the hardware scaling unit, under the control of the software unit, perform rotation processing on an original image and output a processed image. The rotation processing includes lossless rotation processing and stretching rotation processing. During lossless rotation processing, the hardware rotation unit rotates the pixels of the original image at the same angle, so that the relative positions of the pixels in the original image remain unchanged, thereby obtaining a lossless rotated image. During stretching rotation processing, the hardware scaling unit stretches or compresses the lossless rotated image, so that the size of the stretched or compressed lossless rotated image is the same as the size of the original image.
[0005] A further technical solution of the present invention is: the hardware rotation unit includes a rotation module and a rotation control module, the rotation module is used to perform lossless rotation processing on the original image, the rotation control module is used to configure the rotation module, and the software unit configures the rotation module through the rotation control module.
[0006] A further technical solution of the present invention is: the hardware scaling unit includes a scaling module and a scaling control module, the scaling module is used to stretch and rotate the lossless rotated image, the scaling control module is used to configure the scaling module, and the software unit configures the scaling module through the scaling control module.
[0007] A further technical solution of the present invention is: when performing the lossless rotation processing, the software unit configures rotation parameters through the rotation control module, the rotation parameters including rotation angle parameters and lossless rotation image parameters.
[0008] A further technical solution of the present invention is: when performing the stretching and rotation process, the software unit configures scaling parameters through the scaling control module, the scaling parameters including lossless rotation image parameters before scaling and lossless rotation image parameters after scaling.
[0009] A further technical solution of the present invention is that the device further includes a storage unit, which is used to store the original image and the output image after rotation processing.
[0010] A second aspect of the present invention provides an image rotation method, comprising the following steps:
[0011] The original image is rotated using a hardware rotation unit and a hardware scaling unit under the control of a software unit, and the processed image is output. The rotation processing includes lossless rotation processing and stretching rotation processing. During lossless rotation processing, the hardware rotation unit rotates the pixels of the original image by the same angle, so that the relative positions of the pixels in the original image remain unchanged, resulting in a lossless rotated image. During stretching rotation processing, the hardware scaling unit stretches or compresses the lossless rotated image so that the size of the stretched or compressed lossless rotated image is the same as the size of the original image.
[0012] A third aspect of the present invention provides an image forming apparatus, including the image rotation device described above.
[0013] The image rotation device and rotation method provided by this invention have the following advantages:
[0014] Rotation is achieved through hardware rotation and hardware scaling units, resulting in higher rotation efficiency, faster fulfillment of rotation needs, smoother image display, and avoidance of stuttering.
[0015] The rotation process reduces CPU involvement, resulting in low CPU utilization and saving CPU resources.
[0016] It can perform complex rotation functions (including non-destructive rotation and stretching rotation) to meet diverse user needs;
[0017] The image rotation device provides complete hardware and software units, avoiding complex software programming and enabling rapid promotion and application. Attached Figure Description
[0018] Figure 1 This is a schematic diagram of an image rotation device structure according to an embodiment of the present invention;
[0019] Figure 2 This is an original image from an embodiment of the present invention;
[0020] Figure 3 This is an image showing the result of lossless rotation processing of the original image in an embodiment of the present invention.
[0021] Figure 4 This is an image showing the result of stretching and rotating the original image in an embodiment of the present invention.
[0022] Figure 5 This is a schematic diagram of an image rotation method according to an embodiment of the present invention. Detailed Implementation
[0023] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention. Furthermore, the technical features involved in the various embodiments of this invention described below can be combined with each other as long as they do not conflict with each other.
[0024] Based on Embodiment 1 of the present invention
[0025] See Example 1 Figure 1This is a schematic diagram of the image rotation device provided by the present invention. The device includes a hardware rotation unit 101, a hardware scaling unit 102, and a software unit 103. Under the control of the software unit 103, the hardware rotation unit 101 and the hardware scaling unit 102 perform rotation processing on the original image and output the processed image. The rotation processing includes lossless rotation processing and stretching rotation processing. When performing lossless rotation processing, the hardware rotation unit 101 rotates the pixels of the original image at the same angle so that the relative positions of the pixels of the original image remain unchanged, thus obtaining a lossless rotated image. When performing stretching rotation processing, the hardware scaling unit 102 stretches or compresses the lossless rotated image so that the size of the stretched or compressed lossless rotated image is the same as the size of the original image.
[0026] The hardware rotation unit 101 includes a rotation module 1012 and a rotation control module 1011. The rotation module 1012 is used to rotate the original image, and the rotation control module 1011 is used to configure the rotation module 1012. The software unit 103 configures the rotation module 1012 through the rotation control module 1011.
[0027] The hardware scaling unit 102 includes a scaling module 1022 and a scaling control module 1021. The scaling module 1022 is used to stretch and rotate the lossless rotated image. The scaling control module 1021 is used to configure the scaling module 1022. The software unit 103 configures the scaling module 1022 through the scaling control module 1021.
[0028] Furthermore, when performing the lossless rotation, the software unit 103 configures rotation parameters through the rotation control module 1011. The rotation parameters include, but are not limited to, rotation angle parameters and lossless rotation image parameters. When performing stretching rotation processing, the software unit 103 configures scaling parameters through the scaling control module 1021. The scaling parameters include, but are not limited to, lossless rotation image parameters before scaling and lossless rotation image parameters after scaling.
[0029] The image rotation device also includes a storage unit for storing the original image and the output image after rotation processing.
[0030] In specific implementation, the device includes a hardware rotation unit 101, a hardware scaling unit 102, and a software unit 103. The rotation processing includes lossless rotation processing and stretching rotation processing. The hardware rotation unit 101 performs lossless rotation processing of the image, the hardware scaling unit 102 performs stretching rotation processing of the image, and the software unit 103 controls the hardware rotation unit 101 and hardware scaling unit 102 to process the image. Under the control of the software unit 103, the original image is processed by the hardware rotation unit 101 and hardware scaling unit 102 to output a processed rotated image. When lossless rotation is required, the software unit 103 controls the hardware rotation unit 101 to perform rotation processing on the original image to obtain a lossless rotated image, thus achieving lossless rotation. Specifically, the pixels of the original image are rotated at the same angle to keep the relative positions of the image pixels unchanged, achieving lossless rotation. When stretching rotation is required, the software unit 103 controls the hardware scaling unit 102 to stretch or compress the lossless rotated image, achieving stretching rotation. Specifically, the lossless rotated image is stretched or compressed so that the size of the stretched or compressed image is the same as the size of the original image. When image processing is required, the software unit 103 controls the hardware rotation unit 101 and the hardware scaling unit 102 to perform rotation processing on the image.
[0031] In specific implementation, the hardware rotation unit 101 includes a rotation module 1012 and a rotation control module 1011. The rotation module 1012 performs lossless rotation processing of the image. The rotation control module 1011 is used to configure the rotation module 1012; the software unit 103 can configure the functions of the rotation module 1012 through the rotation control module 1011. The hardware scaling unit 102 includes a scaling module 1022 and a scaling control module 1021. The scaling module 1022 performs stretching and rotation processing of the image. The scaling control module 1021 is used to configure the scaling module 1022; the software unit 103 can configure the functions of the scaling module 1022 through the scaling control module 1021. The software unit 103 configures the rotation module 1012 of the hardware rotation unit 101 and the scaling module 1022 of the hardware scaling unit 102 as needed to complete the rotation of the original image. When lossless rotation is required, the software unit 103 configures the rotation parameters through the rotation control module 1011. These rotation parameters include, but are not limited to, rotation angle parameters and lossless rotation image parameters. The rotation angles include, but are not limited to, 90 degrees, 180 degrees, 270 degrees, and 0 degrees. The original image, after processing by the hardware rotation unit 101, can achieve lossless rotation at a certain angle. Specifically, based on the rotation angle parameters and image parameters, the hardware rotation unit 101 processes the original image data in the storage unit, rearranging the original image data in the storage unit so that the pixels of the image rotate at the same angle, keeping the relative positions of the image pixels unchanged, thus generating a lossless rotated image. When stretching rotation is required, based on the generated lossless rotated image, the software unit 103 configures the scaling parameters through the scaling control module 1021. The scaling parameters include, but are not limited to, the lossless rotated image parameters before scaling and the lossless rotated image parameters after scaling. The lossless rotated image, after processing by the hardware scaling unit 102, can achieve stretching rotation. Specifically, based on the image parameters before scaling and the image parameters after scaling, the hardware scaling unit 102 processes the lossless rotation image data in the storage unit to realize the rearrangement of the lossless rotation image data in the storage unit, so that the lossless rotation image is stretched or compressed, and the size of the stretched or compressed lossless rotation image is the same as the size of the original image, so as to generate a stretched rotation image.
[0032] Furthermore, the device also includes a storage unit for storing the original image and the rotated image.
[0033] refer to Figures 2-4 This is an example based on Embodiment 1 of the present invention. Figure 2 For the original image, Figure 3 It is an image that has undergone lossless rotation processing, which means rotating all pixels of the original image 90 degrees counterclockwise while keeping the relative positions of all pixels unchanged. Figure 4It is an image that has undergone stretching and rotation processing, that is, stretching and compressing the image after lossless rotation, while keeping the image size the same as the original image size.
[0034] Based on Embodiment 2 of the present invention
[0035] Example 2 is an image rotation method implemented based on the image rotation device of Example 1. It utilizes a hardware rotation unit and a hardware scaling unit under the control of a software unit to rotate the original image and output the processed image. The rotation processing includes lossless rotation processing and stretching rotation processing. During lossless rotation processing, the hardware rotation unit rotates the pixels of the original image at the same angle, keeping the relative positions of the pixels unchanged, thus obtaining a lossless rotated image. During stretching rotation processing, the hardware scaling unit stretches or compresses the lossless rotated image, making the size of the stretched or compressed lossless rotated image the same as the size of the original image.
[0036] The specific implementation steps are as follows: Figure 5 As shown, the software unit executes the initial step, and the control rotation module in the hardware rotation unit judges the rotation model. If it is judged to be a lossless rotation process, the rotation module in the hardware rotation unit performs lossless rotation processing on the original image. If it is judged to be a stretching rotation process, the scaling control module in the hardware scaling unit controls the scaling module to perform stretching rotation processing. Other specific working processes of the image rotation method refer to the description of the above-described image rotation device embodiment 1, and will not be repeated here.
[0037] Based on Embodiment 3 of the present invention
[0038] Example 3 provides an image forming apparatus, including the image rotation device described in Example 1. In this example, the hardware rotation module and hardware scaling module of the image rotation device can be integrated into one of a GPU chip, GPGPU chip, CPU chip, FPGA, or CPLD, as part of the image forming apparatus. The software unit can be a computer-executable program stored in a computer memory, executing the method executed by the software unit in Example 1. The specific working process of the image forming apparatus is described in Example 1 of the image rotation device, and will not be repeated here.
[0039] As can be seen from the above embodiments, the image rotation device and rotation method provided by the present invention achieve rotation through a hardware rotation unit and a hardware scaling unit, resulting in higher rotation efficiency, faster fulfillment of rotation needs, smoother image display, and avoidance of stuttering; the rotation process reduces CPU involvement, thus reducing CPU usage and saving CPU resources; it can realize complex rotation functions (including lossless rotation and stretching rotation) to meet diverse user needs; the image rotation device provides complete hardware and software units, avoiding complex software programming and enabling rapid promotion and application.
[0040] In this document, the terms “comprising,” “including,” or any other variations thereof are intended to cover non-exclusive inclusion, such that a step or method that comprises a list of elements includes not only those elements but also other elements not expressly listed or inherent to such a step or method.
[0041] The above description, in conjunction with specific preferred embodiments, provides a further detailed explanation of the present invention. It should not be construed that the specific implementation of the present invention is limited to these descriptions. For those skilled in the art, various simple deductions or substitutions can be made without departing from the concept of the present invention, and all such modifications and substitutions should be considered within the scope of protection of the present invention.
Claims
1. An image rotation device, characterized in that, The device includes a hardware rotation unit, a hardware scaling unit, and a software unit. Under the control of the software unit, the hardware rotation unit and the hardware scaling unit perform rotation processing on the original image and output a processed image. The rotation processing includes lossless rotation processing and stretching rotation processing. During lossless rotation processing, the hardware rotation unit rotates the pixels of the original image at the same angle, keeping the relative positions of the pixels unchanged, thus obtaining a lossless rotated image. During stretching rotation processing, the hardware scaling unit stretches or compresses the lossless rotated image, making the size of the stretched or compressed lossless rotated image the same as the size of the original image. The hardware rotation unit and the hardware scaling unit are connected. The hardware rotation unit includes a rotation module and a rotation control module. The rotation module is used to perform lossless rotation processing on the original image, and the rotation control module is used to configure the rotation module. The software unit configures the rotation module through the rotation control module.
2. The image rotation device according to claim 1, characterized in that, The hardware scaling unit includes a scaling module and a scaling control module. The scaling module is used to stretch and rotate the lossless rotated image. The scaling control module is used to configure the scaling module. The software unit configures the scaling module through the scaling control module.
3. The image rotation device according to claim 1, characterized in that, When performing the non-destructive rotation process, the software unit configures rotation parameters through the rotation control module. The rotation parameters include rotation angle parameters and non-destructive rotation image parameters.
4. The image rotation device according to claim 2, characterized in that, When performing the stretching and rotation process, the software unit configures scaling parameters through the scaling control module. The scaling parameters include non-destructive rotation image parameters before scaling and non-destructive rotation image parameters after scaling.
5. The image rotation device according to claim 1, characterized in that, The device also includes a storage unit for storing the original image and the output image after rotation processing.
6. An image rotation method, characterized in that, Includes the following steps: The original image is rotated using a hardware rotation unit and a hardware scaling unit under the control of a software unit, and the processed image is output. The rotation processing includes lossless rotation and stretching rotation. During lossless rotation, the hardware rotation unit rotates the pixels of the original image by the same angle, keeping the relative positions of the pixels unchanged, thus obtaining a lossless rotated image. During stretching rotation, the hardware scaling unit stretches or compresses the lossless rotated image, making the size of the stretched or compressed lossless rotated image the same as the size of the original image. The hardware rotation unit and the hardware scaling unit are connected. The hardware rotation unit includes a rotation module and a rotation control module. The rotation module is used to perform lossless rotation processing on the original image, and the rotation control module is used to configure the rotation module. The software unit configures the rotation module through the rotation control module.
7. An image forming apparatus, characterized in that, Includes the image rotation device according to any one of claims 1-5.
Citation Information
Patent Citations
Simple image angle correction method
CN104809703A
Image data enhancement method and device, electronic equipment and storage medium
CN112927163A