从一篇论文里面看到了zernike矩,一直不懂矩是个什么东西,在网上找了一些资料,记录一下
在网上看到的一篇博客里面,理论部分归纳得很好
https://www.cnblogs.com/ronny/p/3985810.html

zernike矩的matlab 代码来自https://www.mathworks.com/matlabcentral/fileexchange/38900-zernike-moments
具体代码如下:
Zernikmoment(p,n,m)的代码

function [Z, A, Phi] = Zernikmoment(p,n,m)
% -------------------------------------------------------------------------
% Copyright C 2014 Amir Tahmasbi
% Texas A&M University
% amir.tahmasbi@tamu.edu
% http://people.tamu.edu/~amir.tahmasbi/index.html
%
% License Agreement: To acknowledge the use of the code please cite the
%                    following papers:
%
% [1] A. Tahmasbi, F. Saki, S. B. Shokouhi,
%     Classification of Benign and Malignant Masses Based on Zernike Moments,
%     Comput. Biol. Med., vol. 41, no. 8, pp. 726-735, 2011.
%
% [2] F. Saki, A. Tahmasbi, H. Soltanian-Zadeh, S. B. Shokouhi,
%     Fast opposite weight learning rules with application in breast cancer
%     diagnosis, Comput. Biol. Med., vol. 43, no. 1, pp. 32-41, 2013.
%
% -------------------------------------------------------------------------
% Function to find the Zernike moments for an N x N binary ROI
%
% [Z, A, Phi] = Zernikmoment(p,n,m)
% where
%   p = input image N x N matrix (N should be an even number)
%   n = The order of Zernike moment (scalar)
%   m = The repetition number of Zernike moment (scalar)
% and
%   Z = Complex Zernike moment
%   A = Amplitude of the moment
%   Phi = phase (angle) of the mement (in degrees)
%
% Example:
%   1- calculate the Zernike moment (n,m) for an oval shape,
%   2- rotate the oval shape around its centeroid,
%   3- calculate the Zernike moment (n,m) again,
%   4- the amplitude of the moment (A) should be the same for both images
%   5- the phase (Phi) should be equal to the angle of rotation
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 (in degrees)

其中需要调用radialpoly(r,n,m),代码如下
radialpoly(r,n,m)

function rad = radialpoly(r,n,m)
% -------------------------------------------------------------------------
% Copyright C 2014 Amir Tahmasbi
% Texas A&M University
% amir.tahmasbi@tamu.edu
% http://people.tamu.edu/~amir.tahmasbi/index.html
%
% License Agreement: To acknowledge the use of the code please cite the
%                    following papers:
%
% [1] A. Tahmasbi, F. Saki, S. B. Shokouhi,
%     Classification of Benign and Malignant Masses Based on Zernike Moments,
%     Comput. Biol. Med., vol. 41, no. 8, pp. 726-735, 2011.
%
% [2] F. Saki, A. Tahmasbi, H. Soltanian-Zadeh, S. B. Shokouhi,
%     Fast opposite weight learning rules with application in breast cancer
%     diagnosis, Comput. Biol. Med., vol. 43, no. 1, pp. 32-41, 2013.
%
% -------------------------------------------------------------------------
% Function to compute Zernike Polynomials:
%
% f = radialpoly(r,n,m)
% where
%   r = radius
%   n = the order of Zernike polynomial
%   m = the repetition of Zernike moment
rad = zeros(size(r));                     % Initilization
for s = 0:(n-abs(m))/2c = (-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

测试zernike矩的代码如下
Zernike_main.m

% -------------------------------------------------------------------------
% Copyright C 2014 Amir Tahmasbi
% Texas A&M University
% amir.tahmasbi@tamu.edu
% http://people.tamu.edu/~amir.tahmasbi/index.html
%
% License Agreement: To acknowledge the use of the code please cite the
%                    following papers:
%
% [1] A. Tahmasbi, F. Saki, S. B. Shokouhi,
%     Classification of Benign and Malignant Masses Based on Zernike Moments,
%     Comput. Biol. Med., vol. 41, no. 8, pp. 726-735, 2011.
%
% [2] F. Saki, A. Tahmasbi, H. Soltanian-Zadeh, S. B. Shokouhi,
%     Fast opposite weight learning rules with application in breast cancer
%     diagnosis, Comput. Biol. Med., vol. 43, no. 1, pp. 32-41, 2013.
%
% -------------------------------------------------------------------------
% A demo of how to use the Zernike moment function.
%
% Example:
%   1- calculate the Zernike moment (n,m) for an oval shape,
%   2- rotate the oval shape around its centeroid,
%   3- calculate the Zernike moment (n,m) again,
%   4- the amplitude of the moment (A) should be the same for both images
%   5- the phase (Phi) should be equal to the angle of rotation
clc; clear all; close all;
n = 4; m = 2;           % Define the order and the repetition of the moment
disp('------------------------------------------------');
disp(['Calculating Zernike moments ..., n = ' num2str(n) ', m = ' num2str(m)]);
%--------------------------------------------------------------------------
% row 1
p = rgb2gray(imread('Oval_H.png'));
figure(1);subplot(2,3,1);imshow(p);
title('Horizontal oval');
p = logical(not(p));
tic
[~, AOH, PhiOH] = Zernikmoment(p,n,m);      % Call Zernikemoment fuction
Elapsed_time = toc;
xlabel({['A = ' num2str(AOH)]; ['\phi = ' num2str(PhiOH)]});
p = rgb2gray(imread('Oval_45.png'));
figure(1);subplot(2,3,2);imshow(p);
title('-45 degree oval');
p = logical(not(p));
[~, AOH, PhiOH] = Zernikmoment(p,n,m);      % Call Zernikemoment fuction
xlabel({['A = ' num2str(AOH)]; ['\phi = ' num2str(PhiOH)]});
p = rgb2gray(imread('Oval_V.png'));
figure(1);subplot(2,3,3);imshow(p);
title('Vertical oval');
p = logical(not(p));
[~, AOH, PhiOH] = Zernikmoment(p,n,m);      % Call Zernikemoment fuction
xlabel({['A = ' num2str(AOH)]; ['\phi = ' num2str(PhiOH)]});
%--------------------------------------------------------------------------
% row 2
p = rgb2gray(imread('shape_0.png'));
figure(1);subplot(2,3,4);imshow(p);
title('Horizontal shape');
p = logical(not(p));
[~, AOH, PhiOH] = Zernikmoment(p,n,m);      % Call Zernikemoment fuction
xlabel({['A = ' num2str(AOH)]; ['\phi = ' num2str(PhiOH)]});
p = rgb2gray(imread('shape_90.png'));
figure(1);subplot(2,3,5);imshow(p);
title('Vertical shape');
p = logical(not(p));
[~, AOV, PhiOV] = Zernikmoment(p,n,m);      % Call Zernikemoment fuction
xlabel({['A = ' num2str(AOV)]; ['\phi = ' num2str(PhiOV)]});
p = rgb2gray(imread('Rectangular_H.png'));
figure(1);subplot(2,3,6);imshow(p);
title('Horizontal Rectangle');
p = logical(not(p));
[~, AOH, PhiOH] = Zernikmoment(p,n,m);      % Call Zernikemoment fuction
xlabel({['A = ' num2str(AOH)]; ['\phi = ' num2str(PhiOH)]});
%--------------------------------------------------------------------------
% show the elapsed time
disp('Calculation is complete.');
disp(['The elapsed time per image is ' num2str(Elapsed_time) ' seconds']);

matlab zernike矩相关推荐

  1. 基于OTSU最大类间方差法的ROI分割、提取图像中的形状特征--面积、周长、离心率、zernike矩

    分享一下最近学习的图像分类方面知识,整体的思路如下(之前的汇报ppt里截的) 把这个过程拆分几个部分共同学习一下吧 1.Otsu法原理 最大类间方差法OTSU是一种自适应的全局阈值确定的方法,根据灰度 ...

  2. 模板匹配之zernike矩

    zernike矩具有旋转不变性,广泛用于目标识别模板匹配,抗噪能力强. zernike矩的原理就不过多赘述,上代码. //求n的阶乘long TemplateMatch::factorial(int ...

  3. 图像形状特征(七)--Zernike矩

    原文:http://blog.csdn.net/wrj19860202/article/details/6334275 Zernike在1934年引入了一组定义在单位圆 上的复值函数集{ },{ }具 ...

  4. 【数学建模】基于matlab zernike泽尼克多项式仿真【含Matlab源码 1953期】

    一.获取代码方式 获取代码方式1: 完整代码已上传我的资源:[数学建模]基于matlab zernike泽尼克多项式仿真[含Matlab源码 1953期] 点击上面蓝色字体,直接付费下载,即可. 获取 ...

  5. 【图像处理】基于Zernike矩的亚像素边缘检测理论及MATLAB实现

    目录 1 边缘检测理论 2 MATLAB实现 代码和图片下载 1 边缘检测理论 [参考文献]:亚像素边缘检测技术研究_张美静 2 MATLAB实现 function zernike7(I)I=imre ...

  6. 泽尼克多项式 matlab,zernike多项式 ---matlab程序 ---arrayfun.m函数

    贴一段zernike程序 function z = zernfun(n,m,r,theta,nflag) %ZERNFUN Zernike functions of order N and frequ ...

  7. matlab 画 矩阵点,在MATLAB中绘制矩阵中点之间的线

    3 个答案: 答案 0 :(得分:1) 这适用于我的数据结构: data = [ 0, 0, 1, 0;... 1, 0, 1, 1;... 1, 1, 0, 1;... 0, 1, 0, 0 ... ...

  8. matlab筛选矩阵列,【转载】[Matlab]在矩阵中寻找满足条件的元素

    参见张志涌精通matlab >> A=randn(3,4) A = -0.5883    0.1139   -0.0956   -1.3362 2.1832    1.0668   -0. ...

  9. matlab hu矩特征和svm,基于融合Hu矩和区域矩特征的多车牌定位

    0引言目前主要有以下几类车牌定位[1]算法:1基于灰度域的纹理特征方法[2-4].此类算法复杂度较高,难以满足实时定位的需求;2基于彩色空间的彩色图像处理方法[5,6].该类算法基于图像的彩色信息,其 ...

  10. matlab 切比雪夫矩源代码,matlab实现快速切比雪夫微分

    Fast Chebyshev differentiation fchd(V) computes the first derivative of the data in V located along ...

最新文章

  1. 推荐系统遇上深度学习,9篇阿里推荐论文汇总!
  2. expec不管异常 try_python3基础之异常处理(通俗易懂)
  3. Mybatis 查询小技巧
  4. iview实现国际化
  5. CTF题目中遇到的PHP考点总结(一)
  6. python的代码有哪些_Python有哪些有趣的代码呢,这些代码让
  7. 统计 表格_电商运营表格合集,运营统计绩效策划,全套excel表拿来就用
  8. 手动编译php,手动编译安装php7的方式
  9. 为什么awt_为AWT的机器人创建DSL
  10. Cerberus 银行木马开发团队解散,源代码5万美元起拍
  11. MPEG-PS封装格式
  12. centos通过yum的方式快速安装jdk1.8
  13. linux oracle hostname,How to Change hostname in Oracle Linux 7
  14. 关于微积分学的基本定理
  15. access2016与mysql_Access 2016数据库应用与开发
  16. EPLAN入门学习笔记(一)——项目创建与基本使用方法
  17. uniapp 金额输入框
  18. C# 批量图片打包下载
  19. 浪潮服务器加速计算系统,超强AI计算系统囊括浪潮人工智能服务器
  20. 来,我们谈谈怎么选购一台笔记本

热门文章

  1. php动态页面加载慢,小结:PHP动态网页程序优化及高效提速问题
  2. 【免费-LOGO制作】——U钙网
  3. WIN10如果将电脑网络分享给iphone
  4. mysql time over_mysql启动失败错误mysqld.service holdoff time over, scheduling restart.
  5. 网页另存word分页
  6. 记自己开发的淘宝客优惠券
  7. 分类预测 | Matlab实现SSA-SVM麻雀算法优化支持向量机多特征分类预测
  8. msi z170 网卡 linux,麻雀虽小五脏俱全:msi 微星 发布 Z170I Gaming Pro AC Mini-ITX主板...
  9. OneDrive 开机启动设置失效如何处理?
  10. Python——贪吃蛇游戏