How to measure the rotation of a image in MATLAB?

前端 未结 3 873
Happy的楠姐
Happy的楠姐 2021-01-06 06:42

I have two images. One is the original, and the another is rotated.

\"Original

Now, I need to d

3条回答
  •  没有蜡笔的小新
    2021-01-06 07:09

    I would take a variant to the above mentioned approach:

    % Crude binarization method to knock out background and retain foreground
    % features. Note one looses the cube in the middle
    im = im > 1
    

    Enter image description here

    Then I would get the 2D autocorrelation:

    acf = normxcorr2(im, im);
    

    Enter image description here

    From this result, one can easily detect the peaks, and as rotation carries into the autocorrelation function (ACF) domain, one can ascertain the rotation by matching the peaks between the original ACF and the ACF from the rotated image, for example using the so-called Hungarian algorithm.

提交回复
热议问题