Hardware Implementation of Image Rotation Algorithm

Research Article
Open access

Hardware Implementation of Image Rotation Algorithm

Ronghan Li 1*
  • 1 College of Electronic and Information Engineering, Shenzhen University, 518060 Shenzhen, China    
  • *corresponding author 2021280268@email.szu.edu.cn
Published on 3 January 2025 | https://doi.org/10.54254/2755-2721/2025.19402
ACE Vol.120
ISSN (Print): 2755-273X
ISSN (Online): 2755-2721
ISBN (Print): 978-1-83558-809-3
ISBN (Online): 978-1-83558-810-9

Abstract

Nowadays, the image rotation algorithm is widely used in many fields, and the integrated circuit technology is rapidly advancing. This paper systematically introduces the interpolation algorithm and spatial transformation technique in image rotation processing. Starting from the basic neighboring interpolation and mean interpolation, this paper analyzes the common nearest neighbor interpolation, bilinear interpolation and bicubic interpolation step by step, and further introduces the improved bilinear interpolation and spline interpolation. At the same time, the realization feasibility and performance of each interpolation algorithm are evaluated in detail. In the aspect of spatial transformation, the direct method, three-step method and accumulation method are emphasized, and it is pointed out that the function accumulation method is excellent in image rotation. This paper aims to analyze the advantages and disadvantages of different image rotation algorithms for scholars. Upon completion of our study, we have reached the conclusion that the function accumulation method stands out as a relatively superior approach.

Keywords:

Image rotation, Interpolation algorithm, Spatial Transformation Technique

Li,R. (2025). Hardware Implementation of Image Rotation Algorithm. Applied and Computational Engineering,120,152-157.
Export citation

1. Introduction

In recent years, with the development of electronic products and various disciplines, image-processing technology has penetrated every aspect of people's lives and work. Image rotation, as a common technology in image processing, has been widely used in transportation, entertainment, medicine and other fields. In traffic, image rotation facilitates the analysis of video images by traffic monitoring systems, thus promoting the development of visualization and intelligent transportation system applications [1]. In terms of entertainment life, in AR applications, a more realistic three-dimensional effect can be obtained by rotating the image. In the medical field, by rotating the medical image, the direction and Angle of the image (including X-rays, ultrasound, magnetic resonance imaging, etc.) can be adjusted to facilitate the doctor's diagnosis and so on. At the same time, with the development of digital signal processing and integrated circuit technology, such as the mature application of high-speed DSP and large-scale FPGA, the realization of image rotation by digital image processing method has become an indispensable part of image processing system, and has been increasingly widely used.

Image rotation consists of two basic operations: spatial transformation and grayscale interpolation. The application system of image processing requires high algorithm efficiency and precision and is also very time-consuming. Reasonable spatial transformation and interpolation algorithm have great significance and application value for improving the overall efficiency of image rotation algorithm and reducing the difficulty of hardware implementation.

Common interpolation methods include: mean interpolation, nearest neighbor interpolation, weighted coefficient based nearest neighbor interpolation, bilinear interpolation, bicubic interpolation, spline interpolation, Lanczos interpolation and so on. Common spatial transformation methods include: direct method, three-step method, accumulation method, affine transformation method, Fourier transform method, wavelet transform method and so on. This paper focuses on the advantages and disadvantages of various algorithms in image rotation.

2. Interpolation algorithm used in image rotation

When the image is rotated, because the pixels in the rotation are no longer integers, the interpolation operation must be performed on the pixels after rotation. It is generally believed that the key factor of image rotation efficiency is the complexity of the interpolation operation. In the following paper, several interpolation algorithms for image rotation are introduced.

2.1. Proximity interpolation algorithm and mean interpolation algorithm

Xu Pengfei said that when the image is rotated vertically or horizontally, there is little difference between the rotated image and the original image, which basically meets people's needs [2]. However, if the rotation Angle of the image is arbitrarily set, pixel superposition or pixel blank space will appear in the rotated image due to the approximate calculation of pixels in the original image through the rotation formula. In order to avoid such visual deviation, he adopted two relatively simple algorithms: proximity interpolation algorithm and mean interpolation algorithm. He approximates the pixels of the original image by removing the superimposed pixels and filling in the blank pixels by calculating adjacent pixels. Among them, proximity interpolation algorithm searches the blank pixel point first, and then copy the adjacent pixel point to the blank pixel. The mean value interpolation algorithm is to find the pixel blank points by searching, and then fill the pixel blank by the mean value of some or all adjacent pixels. Both algorithms are larger and closer to the original pixel from both the visual point of view and the real image. Finally, he also verified through experimental comparison that if the image rotated without an interpolation algorithm would lose a large number of image pixels in the original image, resulting in the deviation of the visual effect of the image, and the interpolation algorithm can achieve people's visual effect well. Therefore, he affirmed the necessity of interpolation operation in image rotation.

2.2. Nearest neighbor interpolation, bilinear interpolation and bicubic interpolation

Hao Ruijie introduced three common interpolation algorithms in image rotation, which are nearest neighbor interpolation, bilinear interpolation, and bicubic interpolation [3]. Among them, the nearest neighbor interpolation method: is the gray value of the nearest integer coordinate point in the four points adjacent to the floating point coordinate, and the approximate value is assigned to the gray value of the pixel on the target image. Bilinear interpolation method: It takes the gray value of the pixel to be found as the gray value of the four points adjacent to it in two directions of the row and column linear interpolation. Double cubic interpolation method: The gray value of the sixteen points adjacent to the pixel point is calculated for cubic interpolation calculation to find the gray value of the point.

Through the simulation experiment of rotation of the same image using three interpolation algorithms, she concluded that after image rotation using the nearest neighbor interpolation method, there will be significant jagged texture on the image surface, especially when the gray value difference between adjacent pixels is significant, which will cause large errors and seriously damage the overall quality of the image. In contrast, the quality of images processed by bilinear interpolation is significantly improved, and the texture performance is clearer. As for the double cubic interpolation method, it can present the most delicate image details after the image rotation, and achieve the best visual effect, so it is usually applied to the scene with high requirements for image quality.

In addition, Yin Xue et al. also proposed that the bilinear interpolation algorithm is used to achieve image rotation, which can solve the problem of image quality damage and discontinuous gray values after processing by the nearest neighbor interpolation method[4]. They proved through experiments that the image rotation realized by bilinear interpolation algorithm has the characteristics of a simple algorithm, fast operation speed, and can guarantee the quality of the image to a certain extent. However, the algorithm has the property of low-pass filter, which damages the high-frequency component, so the image contour may become blurred to a certain extent, especially the edge of the image becomes more blurred after several consecutive rotation. In addition, they innovatively proposed that the image is reduced by a certain proportion before rotation, which can solve the problem of pixel loss and data overflow to a certain extent.

2.3. Improved bilinear interpolation method

Cao Dianguo pointed out the disadvantages of the commonly used methods and proposed an improved bilinear interpolation method[5]. The nearest neighbor interpolation algorithm has simple operation and high operation speed, but the interpolation effect is poor, the quality of the generated image is poor, and the obvious block effect or image blur is easy to appears. The spline interpolation method has high accuracy, and the image quality after interpolation is significantly improved, but the calculation process of spline interpolation is complicated and the execution time is long, so it is difficult to implement hardware.

Image transformation is the process of transforming an image from one space coordinate system to another space coordinate system. Because Fourier transform only has the characteristics of translation, rotation and scaling, but the conversion effect of visible and infrared images is not good. So they use affine transformation to realize the rotation transformation of the image.

Gray-level interpolation technology mainly solves the problem of pixel gray-level assignment. After determining the spatial transformation parameters between the original image and the rotating image, it is necessary to assign the pixel gray level in the rotating image. They use the method of reverse mapping to achieve the assignment, but in the process of reverse mapping, because each pixel is mapped to a new position. The new position coordinate may not be an integer, and for digital images, its pixel value is only defined at the coordinate of the integer. Therefore, the pixel value at the non-integer position must be calculated by the pixel value at some of its surrounding integer coordinates, that is, gray interpolation. There are many kinds of interpolation calculation methods, and the compromise method, bilinear interpolation method, is adopted in the experiment. Due to rotation, part of the image may exceed the boundary. So they proposed a method to control the region beyond the scope of the image by taking the mode operation, so that the region beyond the original image is filled by some parts of the original image, which can better display the boundary change of the image rotation.

Finally, they propose an improved bilinear interpolation algorithm within the framework of affine transformations. Also without changing the size of the output image, a novel control method is implemented for the region beyond the boundary of the original image by using the mode-taking operation, which effectively shows the rotation boundary details and rotation position of the image. In addition, the algorithm can realize the function of traditional bilinear interpolation by flexibly adjusting the operation parameters, that is, set all gray values beyond the boundary region to 0. It is worth mentioning that their new algorithm can support any Angle rotation of the image in the range of 0° to 360°.

A. H. Ashtari and M. J. Nordin also proposed an improvement of the bilinear algorithm. In order to avoid the uneven distance between rotating pixels in the target image, the linear coordinates in the target image are used for rotation based on the linear equation and linear rotation[6]. According to the rotation Angle, the vertical or horizontal line of the original image is used to calculate the size of the target image, the baseline and the starting line equation, and all the corresponding pixels of the baseline and the starting line are extracted. This method has the characteristics of fast execution and good accuracy, while the image information is perfectly preserved, and the rotated image can be used as the basis for other pattern recognition tasks and problems.

2.4. Spline interpolation algorithm

Li Kaiyu proposed the current commonly used algorithms: nearest neighbor interpolation or linear interpolation. The interpolation algorithm is simple and has high operation speed, but the interpolation effect is poor, the generated image quality is not good, and there will be an obvious block effect or image blur[7]. Therefore, they put forward the method of B-spline interpolation, which can significantly improve the image quality after interpolation. However, the calculation process of B-spline interpolation is complicated, the execution time is long, and it is difficult to implement hardware. Therefore, digital filtering technology is introduced into the image interpolation operation, and a fast B-spline interpolation method based on IIR and FIR digital filters is proposed to process image signals. In addition, the rotation operation of the image in two-dimensional space is decomposed into a translation operation in three-step one-dimensional space, which simplifies the processing of image data. Finally, three B-spline interpolation operations are successfully implemented using FPGA, and the obtained image processing quality is high, the operation speed is fast, and the refresh rate is 50 times/s.

With the help of their method, by cleverly converting the interpolation operation of the image into the step of implementing digital filtering on the digital signal, this change not only makes it possible to realize the hardware of the image interpolation, but also greatly accelerates the processing process, including high-speed processing and even real-time processing, because the speed of hardware processing data is much faster than that of software. It brings significant performance improvement and advantages to the field of image processing.

In addition, R. Nayak and D. Patra proposed an adaptive P-spline which is superior to B-spline, while L. Maticu Iovan implemented the cubic spline interpolation algorithm on digital signal processor systems, although they did not combine image rotation processing. However, the prospect of these methods in image rotation is also bright, and scholars can try them in the future[8][9].

3. Spatial transformation algorithm in image rotation

It is generally believed that the complexity of interpolation operation is the key factor determining image rotation efficiency. However, upon further investigation, it was found that when using commonly used interpolation methods, the time cost of space transformation exceeds that of interpolation operation. By optimizing the efficiency of spatial transformation, the overall efficiency of image rotation can be greatly improved.

Wang Binhai, discusses the application of direct method, three-step method and accumulation method in image rotation [10]. The direct method is a direct coordinate transformation through the traditional rotation matrix method. By decomposing the traditional image rotation matrix, the three-step method decomposes the rotation operation of the image in two-dimensional space into the translation operation in three-dimensional one-dimensional space, so that the two-dimensional interpolation operation used for image rotation operation is simplified to the one-dimensional interpolation operation in one-dimensional space. In the process of image rotation transformation, the method of accumulation calculation is used to avoid repeated multiplication calculation.

Through experiments, they conclude that direct method, cumulative method and three-step method have their own advantages and disadvantages.

The direct method has higher accuracy, but because it does not make full use of the correlation between adjacent pixels to calculate the spatial transformation coordinates of each pixel, it needs to complete four complement multiplication operations and two complement addition operations, resulting in greater computational complexity and low efficiency of the algorithm. In contrast, the accumulation rule fully explores the correlation between adjacent pixels and only relies on addition operations in the coordinate transformation process, which greatly improves the computational efficiency. Although the computational cost is mainly concentrated on the gray interpolation algorithm, it is still better than the direct method on the whole, especially in the processing of large-scale image data.

As for the three-step method, each step of the transformation follows the translation principle, which means that after the coordinate transformation, there is no need to recalculate the gray value of each point, thus avoiding interpolation calculations, effectively reducing the number of floating point operations, and improving the efficiency of the operation. However, the three-step method also faces a challenge, that is, it needs to be performed in columns, which violates the principle of locality of the program to some extent, resulting in performance bottlenecks when dealing with large data sets, which limits its application scenarios. To sum up, direct method, cumulative method and three-step method each have their unique advantages and limitations, and which method to choose should be determined according to specific application scenarios and needs.

Additionally, they compared the calculation time of algorithms using the nearest neighbor interpolation method and bilinear interpolation method. Their conclusion was that the time overhead of the accumulation method is significantly lower. Furthermore, this accumulation method demonstrates higher efficiency compared to the one utilizing the direct integer function. Therefore, the accumulation method is the image rotation algorithm with the best computational efficiency. According to the different interpolation algorithms, the accumulation method can be divided into the accumulation method using the round function and the accumulation method using the direct integer function. Although the latter has lower overhead, it has a large error in gray interpolation, which makes the edge of the graph appear obviously jagged. Therefore, the function accumulation method is a better choice for the image rotation algorithm.

4. Conclusion

Various interpolation algorithms and spatial transformation methods used in image rotation processing are described in detail in this paper. Beginning with basic neighboring interpolation and mean interpolation, the discussion covers three common algorithms including nearest neighbor interpolation, bilinear interpolation, and bicubic interpolation. It then proceeds to an improved version of bilinear interpolation and introduces spline interpolation. Each algorithm's feasibility of implementation and performance is thoroughly analyzed, highlighting that different algorithms are suited for distinct application scenarios. In the introduction of the spatial transformation method, three basic and commonly used methods are emphasized: direct method, three-step method and accumulation method, and the conclusion is drawn that the spatial transformation strategy using the function accumulation method is particularly good in the image rotation algorithm. Image rotation algorithms have a wide range of applications in many fields. With the rapid development of digital signal processing and integrated circuit technology, and their expanding application scope, future research can focus on further optimizing various interpolation and spatial transformation methods. Additionally, exploring the feasibility and potential of these algorithms in hardware implementation is an important direction for future research.


References

[1]. Tan, Z., Zhang, Y., & Song, J. (2012). A regional rotation algorithm of video images. In 2012 5th International Congress on Image and Signal Processing, pp. 169-172.

[2]. Xu, P.-F. (2015). Interpolation algorithm in the application of image rotation. Computer Knowledge and Technology, 11(34), 160-161.

[3]. Hao, R.-J., & Wan, X.-H. (2014). Interpolation algorithm in the application of image rotation. Journal of Yuncheng University, 32(02), 86-88.

[4]. Yin, X., Liu, S., Yuan, C., et al. (2020). Application of bilinear interpolation algorithm based on DSP in image rotation. Ship Electronic Engineering, 40(03), 97-100.

[5]. Cao, D., Chen, H., & Li, P. (2010). Application of bilinear interpolation algorithm based on MATLAB in image rotation. China Printing and Packaging Research, 2(04), 74-78.

[6]. Ashtari, A. H., Nordin, M. J., & Mousavi Kahaki, S. M. (2015). Double line image rotation. IEEE Transactions on Image Processing, 24(11), 3370-3385.

[7]. Li, K., Zhang, H., & Jing, Y. (2004). Application of B-spline interpolation based on digital filter in image rotation. Journal of Nanjing University of Aeronautics and Astronautics, (05), 633-638.

[8]. Nayak, R., & Patra, D. (2015). Image interpolation using adaptive P-spline. In 2015 Annual IEEE India Conference (INDICON), pp. 1-6.

[9]. Matiu-Iovan, L. (2013). A cubic spline interpolation algorithm implemented on a system with digital signal processor. In 2013 Signal Processing: Algorithms, Architectures, Arrangements, and Applications (SPA), pp. 343-348.

[10]. Wang, B., Xu, Z., Chen, X., et al. (2011). Analysis and comparison of image rotation algorithms. Optics and Optoelectronics Technology, 9(02), 46-49.


Cite this article

Li,R. (2025). Hardware Implementation of Image Rotation Algorithm. Applied and Computational Engineering,120,152-157.

Data availability

The datasets used and/or analyzed during the current study will be available from the authors upon reasonable request.

Disclaimer/Publisher's Note

The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of EWA Publishing and/or the editor(s). EWA Publishing and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

About volume

Volume title: Proceedings of the 5th International Conference on Signal Processing and Machine Learning

ISBN:978-1-83558-809-3(Print) / 978-1-83558-810-9(Online)
Editor:Stavros Shiaeles
Conference website: https://2025.confspml.org/
Conference date: 12 January 2025
Series: Applied and Computational Engineering
Volume number: Vol.120
ISSN:2755-2721(Print) / 2755-273X(Online)

© 2024 by the author(s). Licensee EWA Publishing, Oxford, UK. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license. Authors who publish this series agree to the following terms:
1. Authors retain copyright and grant the series right of first publication with the work simultaneously licensed under a Creative Commons Attribution License that allows others to share the work with an acknowledgment of the work's authorship and initial publication in this series.
2. Authors are able to enter into separate, additional contractual arrangements for the non-exclusive distribution of the series's published version of the work (e.g., post it to an institutional repository or publish it in a book), with an acknowledgment of its initial publication in this series.
3. Authors are permitted and encouraged to post their work online (e.g., in institutional repositories or on their website) prior to and during the submission process, as it can lead to productive exchanges, as well as earlier and greater citation of published work (See Open access policy for details).

References

[1]. Tan, Z., Zhang, Y., & Song, J. (2012). A regional rotation algorithm of video images. In 2012 5th International Congress on Image and Signal Processing, pp. 169-172.

[2]. Xu, P.-F. (2015). Interpolation algorithm in the application of image rotation. Computer Knowledge and Technology, 11(34), 160-161.

[3]. Hao, R.-J., & Wan, X.-H. (2014). Interpolation algorithm in the application of image rotation. Journal of Yuncheng University, 32(02), 86-88.

[4]. Yin, X., Liu, S., Yuan, C., et al. (2020). Application of bilinear interpolation algorithm based on DSP in image rotation. Ship Electronic Engineering, 40(03), 97-100.

[5]. Cao, D., Chen, H., & Li, P. (2010). Application of bilinear interpolation algorithm based on MATLAB in image rotation. China Printing and Packaging Research, 2(04), 74-78.

[6]. Ashtari, A. H., Nordin, M. J., & Mousavi Kahaki, S. M. (2015). Double line image rotation. IEEE Transactions on Image Processing, 24(11), 3370-3385.

[7]. Li, K., Zhang, H., & Jing, Y. (2004). Application of B-spline interpolation based on digital filter in image rotation. Journal of Nanjing University of Aeronautics and Astronautics, (05), 633-638.

[8]. Nayak, R., & Patra, D. (2015). Image interpolation using adaptive P-spline. In 2015 Annual IEEE India Conference (INDICON), pp. 1-6.

[9]. Matiu-Iovan, L. (2013). A cubic spline interpolation algorithm implemented on a system with digital signal processor. In 2013 Signal Processing: Algorithms, Architectures, Arrangements, and Applications (SPA), pp. 343-348.

[10]. Wang, B., Xu, Z., Chen, X., et al. (2011). Analysis and comparison of image rotation algorithms. Optics and Optoelectronics Technology, 9(02), 46-49.