feat: cDNA微阵列图像处理作业 - Python实现
实现内容: - 网格划分:投影分析 + 自相关估周期 + 白顶帽去背景 + 质心提取 - 三种阈值分割:人工阈值、Otsu自动阈值、迭代阈值 - TV去噪(Chambolle投影算法) - 后处理:去小连通域 + 保留最大连通域 - 完整可视化:网格叠加、阈值对比、收敛曲线、分割结果 参考MATLAB代码:NewGridAndCV/demo_GriddingAndCV.m
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
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)));
|
||||
Reference in New Issue
Block a user