3ca079a980
- 中文目录名改为英文:cDNA图像处理实例→examples,参考资料→references - web→app(Flask应用标准命名) - 输出目录平移到 data/output/simple/ 和 data/output/full/ - 输入图像统一到 data/input/ - 构建脚本移到 scripts/ - 源码文件改用 snake_case 命名 - 更新所有文件路径引用和文档
29 lines
739 B
Matlab
29 lines
739 B
Matlab
function KG = kappa(I)
|
|
% get curvature information of input image
|
|
% input: 2D image I
|
|
% output: curvature matrix KG
|
|
|
|
% Copyright (c) 2009,
|
|
% Yue Wu @ ECE Department, Tufts University
|
|
% All Rights Reserved
|
|
|
|
I = double(I);
|
|
[m,n] = size(I);
|
|
P = padarray(I,[1,1],1,'pre');
|
|
P = padarray(P,[1,1],1,'post');
|
|
|
|
% central difference
|
|
fy = P(3:end,2:n+1)-P(1:m,2:n+1);
|
|
fx = P(2:m+1,3:end)-P(2:m+1,1:n);
|
|
fyy = P(3:end,2:n+1)+P(1:m,2:n+1)-2*I;
|
|
fxx = P(2:m+1,3:end)+P(2:m+1,1:n)-2*I;
|
|
fxy = 0.25.*(P(3:end,3:end)-P(1:m,3:end)+P(3:end,1:n)-P(1:m,1:n));
|
|
G = (fx.^2+fy.^2).^(0.5);
|
|
K = (fxx.*fy.^2-2*fxy.*fx.*fy+fyy.*fx.^2)./((fx.^2+fy.^2+eps).^(1.5));
|
|
KG = K.*G;
|
|
KG(1,:) = eps;
|
|
KG(end,:) = eps;
|
|
KG(:,1) = eps;
|
|
KG(:,end) = eps;
|
|
KG = KG./max(max(abs(KG)));
|