基于阈值的图像分割
2010-12-25 21:03
393 查看
% Find a good threshold automatically, using the isodata algorithm (Ridler % and Calvard 1978) % % Example: % vImage = Image(:); % [n xout]=hist(vImage, <nb_of_bins>); % threshold = isodata(n, xout) % % Parameters: count and intensity are vectors, % there are count(i) pixels of intensity(i) % (see "hist" function) function threshold = isodata(count, intensity) T(1) = round(sum(count.*intensity) ./ sum(count)); delta = 1; % initialisation before while loop i=1; %counter for the generations of T (threshold) % the index of the threshold in the intensity list (T(i) is a threshold, not an index... it can be <0, for example. while (delta ~= 0) && (i<15) % after the call to the "hist" function, the intensities are sorted % (ascending). T_indexes = find(intensity >= T(i)); T_i = T_indexes(1); % finds the value (in "intensity") that is closest to the threshold. % calculate mean below current threshold: mbt mbt = sum(count(1:T_i) .* intensity(1:T_i) ) ./ sum(count(1:T_i)); % calculate mean above current threshold: mat mat = sum(count(T_i:end) .* intensity(T_i:end) ) ./ sum(count(T_i:end)); % the new threshold is the mean of mat and mbt i= i+1; T(i) = round( (mbt+mat)./2 ); delta = T(i) - T(i-1); end threshold = T(i); save T
相关文章推荐
- 图像分割—基于图像数据的自动选择阈值(基本全局阈值处理方法)
- matlab基于遗传算法的最大熵值法的双阈值图像分割
- 基于阈值的图像分割方法
- 基于OTSU算法和基本粒子群优化算法的双阈值图像分割
- 基于OTSU算法和基本粒子群优化算法的双阈值图像分割
- 基于阈值图像分割
- 基于梯度调整的矩不变自动阈值图像分割算法
- 基于轮廓的图像分割、连通区域提取
- 基于CIELab空间色彩K-means聚类彩色图像分割
- 基于直方图的图像全局二值化算法原理、实现--基于双峰平均值的阈值
- 基于聚类的“图像分割”
- 基于图像分割的立体匹配方法
- CNN在基于弱监督学习的图像分割中的应用
- 基于卷积神经网络的图像语义分割
- 基于区域的图像分割-----------区域分裂合并
- Matlab 图像分割 (阈值处理)
- 基于灰度世界、完美反射、动态阈值等图像自动白平衡算法的原理、实现及效果
- 基于Otsu算法的图像自适应阈值切割
- 基于图像分块的图像分割
- Halcon视频学习2.2---图像分割之阈值