✅作者简介:热爱科研的Matlab仿真开发者,修心和技术同步精进,matlab项目合作可私信。
个人主页:Matlab科研工作室
个人信条:格物致知。
更多Matlab仿真内容点击
智能优化算法 神经网络预测 雷达通信 无线传感器
信号处理 图像处理 路径规划 元胞自动机 无人机
基于快速链接 SCM 进行图像分割附matlab代码
% Reference:
% [2] K Zhan, J Teng, J Shi, Q Li, M Wang,
% "Feature linking model for image enhancement,"
% Neural Computation, 2016.
function GS = GrayStretch(I,Per)
[m,M] = FindingMm(I,Per);
GS = uint8((double(I)-m)./(M-m)*255);
end
function [minI,MaxI] = FindingMm(I,Per)
h = imhist(I);
All = sum(h);
ph = h./All;
mth_ceiling = BoundFinding(ph,Per);
Mph=fliplr(ph')';
Mth_floor = BoundFinding(Mph,Per);
Mth_floor = 256 - Mth_floor + 1;
ConstraintJudge = @(x,y) sum(h(x:y))/All >= Per;
Difference = zeros(256,256)+inf;
for m = mth_ceiling:-1:1
for M = Mth_floor:256
if (h(m) >0 )&&(h(M) > 0)
if ConstraintJudge(m,M)
Difference(m,M) = M - m;
end
end
end
end
minD = min(Difference(:));
[m, M] = find(Difference==minD);
minI = m(1) - 1;
MaxI = M(1) - 1;
end
function m_ceiling = BoundFinding(ph,Per)
cumP = cumsum(ph);
n = 1;
residualP = 1-Per;
while cumP(n) n = n+1; end m_ceiling = n; end [1] K Zhan, J Shi, Q Li, J Teng, M Wang, "Image segmentation using fast linking SCM," in Proc. of IJCNN, vol. 25, pp. 2093-2100, 2015. ❤️ 关注我领取海量matlab电子书和数学建模资料 ❤️部分理论引用网络文献,若有侵权联系博主删除 ⛄ 运行结果
⛄ 参考文献