b8a8ff2bc6
实现内容: - 网格划分:投影分析 + 自相关估周期 + 白顶帽去背景 + 质心提取 - 三种阈值分割:人工阈值、Otsu自动阈值、迭代阈值 - TV去噪(Chambolle投影算法) - 后处理:去小连通域 + 保留最大连通域 - 完整可视化:网格叠加、阈值对比、收敛曲线、分割结果 参考MATLAB代码:NewGridAndCV/demo_GriddingAndCV.m
30 lines
754 B
Matlab
30 lines
754 B
Matlab
function [x,y]=limits(a)
|
|
% LIMITS returns min & max values of matrix; else scalar value.
|
|
%
|
|
% [lo,hi]=LIMITS(a) returns LOw and HIgh values respectively.
|
|
%
|
|
% lim=LIMITS(a) returns 1x2 result, where lim = [lo hi] values
|
|
|
|
% Copyright 2004-2010 RBemis The MathWorks, Inc.
|
|
|
|
if nargin~=1 | nargout>2 %bogus syntax
|
|
error('usage: [lo,hi]=limits(a)')
|
|
end
|
|
|
|
siz=size(a);
|
|
|
|
if prod(siz)==1 %scalar
|
|
result=a; % value
|
|
else %matrix
|
|
result=[min(a(:)) max(a(:))]; % limits
|
|
end
|
|
|
|
if nargout==1 %composite result
|
|
x=result; % 1x2 vector
|
|
elseif nargout==2 %separate results
|
|
x=result(1); % two scalars
|
|
y=result(2);
|
|
else %no result
|
|
ans=result % display answer
|
|
end
|