Accurate of Digital Image Rotation Using Matlab
Accurate of Digital Image Rotation Using Matlab
Abstract
Image rotation is one of main pre-processing steps for image processing or image pattern
recognition. This paper proposes a fast source code of MATLAB for rotating images while
preserving their quality. The new approach rotates images based on vertical or horizontal
lines in the original image and their rotated equation in the target image. It is implemented
with a rotation matrix multiplication. Therefore, there has been a need for a high speed
image rotation source code without two major time-consuming operations.
Keywords : High speed rotation operation, image rotation, transform matrix, image
processing.
I. Introduction
Recently, image pattern recognition technology has been applied in a number of ways in
various areas. The preprocessing step is essential in the technology. The rotation is one of
the major pre-processing methods. It is implemented with a rotation matrix multiplication,
easily. Highly accurate image rotation is essential for certain image processing tasks such
as feature extraction and matching. Furthermore, in many applications, especially real-
time systems, a high speed of rotation is important. However, it requires lots of floating
point arithmetic operations and trigonometric function calculations, so it takes long
execution time. Hence, it is necessary and advantageous to define a method that provides
both high accuracy and fast execution. Image rotation can be described as the movement
of an image around a fixed point.
(1)
Fig.1
Determining the rotated point directly using a single function such as (1) is a one-pass
technique, whereas calculating the rotated point using multiple functions such as (2), (3),
and (4) is a multi-pass technique. Compared with multi-pass methods, one-pass methods
are simple and usually more accurate. However, although one-pass methods are accurate,
they are still inefficient because multiple high-level calculations and computations are
required. As presented in (1), four floating-point multiplications and two floating-point
additions are required to calculate each rotated pixel. For an image of many pixels, the
one-pass method can actually take longer than multi-pass methods.
1
(2)
(3)
(4)
if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT
2
movegui(hObject,'center');
% Update handles structure
guidata(hObject, handles);
3
% Hints: get(hObject,'Value') returns position of slider
% get(hObject,'Min') and get(hObject,'Max') to determine
range of slider
nilai_slider = get(handles.slider1,'Value');
handles.nilai_slider = round(nilai_slider);
set(handles.edit1,'String',handles.nilai_slider);
hasil =
imrotate(handles.data1,handles.arah*handles.nilai_slider,...
'bilinear','crop');
handles.hasil = hasil;
guidata(hObject,handles);
axes(handles.axes2);
imshow(hasil,[]);
4
function pushbutton1_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton1 (see GCBO)
% eventdata reserved - to be defined in a future version of
MATLAB
% handles structure with handles and user data (see GUIDATA)
[nama_file,nama_path] =
uigetfile({'*.jpg';'*.bmp';'*.png';'*.tif'},...
'Buka Gambar');
if ~isequal(nama_file,0);
handles.data1 = imread(fullfile(nama_path,nama_file));
guidata(hObject,handles);
axes(handles.axes1);
imshow(handles.data1,[]);
axes(handles.axes2);
imshow(handles.data1,[]);
else
return
end
Fig. 2
After the image is uploaded, user must select the desired rotation direction. And sliding
the slider up to the slope of the desired image. The degree of rotation of the image can be
seen in the box degree of rotation description.
5
Fig. a Fig. b
Fig. c
The image-rotation methods are evaluated based on two measures: accuracy and speed. A
high accuracy of image rotation is fundamental for follow-up processing such as feature
extraction and feature matching.
The first image is the original image which has not received rotation treatment (Fig.a),
samples with Bird, where in the images are directly rotated by 32 degrees in a negative
direction (Fig.b), samples with Bird, where in the images are directly rotated by 32
degrees in a positive direction (Fig.c)
V. Conclusion
In this paper, the rotation image correction source code is created, which is based on the
accuracy of the rotation degree of the image the user wants. First, the source code is
verified in MATLAB, and finally implemented in c ++, and applied to an image.
Compared with the conventional rotational correction, through the rotation angle obtained
by calculating the correlation coefficient, the source code in this paper greatly reduces the
time complexity, and increases the degree of rotational accuracy can be seen by
description box.
References
[1] Nasr addin Ahmed and Aznul Qalid, “Automatic Rotation Recovery Algorithm for
Accurate Digital Image and Video Watermarks Extraction”, International Journal of
Advanced Computer Science and Applications, Vol. 7, No. 11, 2016.
[2] S. Suchitra, S.K. Lam, C.T. Clarke and T. Srikanthan, “Accelerating rotation of high-
resolution images”, IEE Proc.-Vis. Image Signal Process., Vol. 153, No. 6, December
2006.
6
[3] Kunyan Li, and Tian Dan, “Fast Rotation and Correction of image algorithm Based on
Local Feature”, International Workshop on Microwave and Millimeter Wave Circuits
and System Technology 978-1-4673-5504-9/13/$31.00 ©2013 IEEE.
[4] Zhongda Yu, Junyu Dong, Zhiqiang Wei and Jianxiang Shen, “A Fast Image Rotation
Algorithm for Optical Character Recognition of Chinese Documents”, 0-7803-9584-
0/06/$20.00(2006 IEEE.
[5] Fuming LI and Zhijia ZHANG, “Angle Correction Algorithm for Image Rotation
Based on Key Point Detection”, Journal of Computational Information Systems 9: 4
(2013) 1307–1314.
[6] Weimin Wei, Shuozhong Wang, Xinpeng Zhang, and Zhenjun Tang, “Estimation of
Image Rotation Angle Using Interpolation-Related Spectral Signatures With
Application to Blind Detection of Image Forgery”, IEEE TRANSACTIONS ON
INFORMATION FORENSICS AND SECURITY, VOL. 5, NO. 3, SEPTEMBER
2010.
[7] Valery Starovoitov and Dmitry Samal, “Comparison of rotation algorithms for digital
images”, SPIE Conference on Vision Geometry VIII • Denver, Colorado • July 1999.
[8] G. Costantini, D. Casali and R. Perfetti, “Cellular neural network template for rotation
of grey-scale images”, ELECTRONICS LETTERS 11th December 2003 Vol. 39 No.
25.
[9] Ruohan Qian, Weihai Li, Nenghai Yu, and Bin Liu, “High Precision Image Rotation
Angle Estimation with Periodicity of Pixel Variance”, 2013 Seventh International
Conference on Image and Graphics.
[10] Amir Hossein, Md Jan Nordin, and Seyed Mostafa, “Double Line Image Rotation”,
IEEE TRANSACTIONS ON IMAGE PROCESSING, VOL. 24, NO. 11,
NOVEMBER 2015.