필터 지우기
필터 지우기

Rotation angle between two images

조회 수: 2 (최근 30일)
laura kenny
laura kenny 2016년 7월 21일
답변: Michael Byrne 2017년 8월 14일
I would like to determine the angle of rotation between two images. Each image consists of clearly visible horizontal and vertical lines. This results in the magnitude plot of the fft having clearly defined vertical and horizontal energy components, which are orthogonal.
How can I determine the angle of the vertical and horizontal energy components, which will directly give me the rotation angle of the image, from unrotated state.
Here's my code to get the FFT of the image and plot the magnitude of the fft. Please help me determine the angle of the energy lines in the magnitude plot.
%Read in image and set to Black and White
BW = imread('BW.jpg');
BW = rgb2gray(BW);
%FFT of image
F = fft2(BW);
F = fftshift(F); % Center FFT
%Magnitude of FFT of image
F = abs(F); % Get the magnitude
F = log(F+1); % Use log, for perceptual scaling, and +1 since log(0) is undefined
F = mat2gray(F); % Use mat2gray to scale the image between 0 and 1
imshow(F,[]); % Display the result

답변 (1개)

Michael Byrne
Michael Byrne 2017년 8월 14일
One way this might be accomplished is to test the similarity of rotated images against the image in question for varying angles of rotation. In the context of the images you attached, you could rotate fft0.jpg using the function imrotate for angles between 0 and 359 degrees and use functions such as ssim, psnr, or immse to determine which angle of rotation produces the image most similar to fft45.jpg (which would be 45 degrees). You can find more info about these similarity functions here.

카테고리

Help CenterFile Exchange에서 Geometric Transformation and Image Registration에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by