hey can u help me that how can i make my zernike moment code, invariant to rotation.

4 件のコメント

Matt Kindig
Matt Kindig 2013 年 4 月 10 日
You haven't shown us any code!
tamanna
tamanna 2013 年 4 月 11 日
編集済み: Walter Roberson 2013 年 4 月 11 日
n=4;
m=2
p = rgb2gray(imread('C:\Users\hp\Desktop\2.JPG'));
N = size(p,1);
[ZOH AOH PhiOH] = Zernikmoment(p,n,m);
function [Z A Phi] = Zernikmoment(p,n,m)
N = size(p,1);
x = 1:N; y = x;
[X,Y] = meshgrid(x,y);
R = sqrt((2.*X-N-1).^2+(2.*Y-N-1).^2)/N;
Theta = atan2((N-1-2.*Y+2),(2.*X-N+1-2));
R = (R<=1).*R;
Rad = radialpoly(R,n,m); % get the radial polynomial
Product = p(x,y).*Rad.*exp(-1i*m*Theta);
Z = sum(Product(:)); % calculate the moments
cnt = nnz(R)+1; % count the number of pixels inside the unit circle
Z = (n+1)*Z/cnt; % normalize the amplitude of moments
A = abs(Z); % calculate the amplitude of the moment
Phi = angle(Z)*180/pi; % calculate the phase of the mement
function rad = radialpoly(r,n,m)
rad = zeros(size(r)); % Initilization
for s = 0:(n-abs(m))/2
c = (-1)^s*factorial(n-s)/(factorial(s)*factorial((n+abs(m))/2-s)*factorial((n-abs(m))/2-s));
rad = rad + c*r.^(n-2*s);
end
this code work well with 0, 90 and 180 degree but not with 30 or 45 degree.
Walter Roberson
Walter Roberson 2013 年 4 月 11 日
What should be looked at to determine whether it is doing well or not?
tamanna
tamanna 2013 年 4 月 11 日
sir..it is doing well but i want to make my program rotation invariant. how should i do ??

サインインしてコメントする。

回答 (1 件)

arun anoop m
arun anoop m 2019 年 9 月 9 日

0 投票

How can i get angle and magnitude as output image instead features?
A = abs(Z); % calculate the amplitude of the moment
Phi = angle(Z)*180/pi; % calculate the phase of the mement
How to get ,
figure,imshow(A) ?
figure,imshow(Phi) ?

カテゴリ

ヘルプ センター および File Exchange で Geometric Transformation and Image Registration についてさらに検索

製品

タグ

質問済み:

2013 年 4 月 10 日

回答済み:

2019 年 9 月 9 日

Community Treasure Hunt

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

Start Hunting!

Translated by