C#,图像二值化(17)——全局阈值的ISODATA算法(亦称作InterMeans法)及其源程序
二值算法综述请阅读:
支持函数请阅读:
1、ISODATA算法
原文:
ISO数据
基于isodata算法的迭代程序:
Ridler,TW&Calvard,S(1978),“使用迭代选择方法的图像阈值”,IEEE系统、人和控制论汇刊8:630-632
该过程通过采用初始阈值将图像划分为对象和背景,然后计算阈值或阈值以下的像素和阈值以上的像素的平均值。计算这两个值的平均值,增加阈值并重复该过程,直到阈值大于复合平均值。即,
阈值=(平均背景+平均对象)/2。
该方法有几种实现方式。请参见源代码以获取更多注释。
IsoData
Iterative procedure based on the isodata algorithm of:
Ridler, TW & Calvard, S (1978), "Picture thresholding using an iterative selection method", IEEE Transactions on Systems, Man and Cybernetics 8: 630-632
The procedure divides the image into object and background by taking an initial threshold, then the averages of the pixels at or below the threshold and pixels above are computed. The averages of those two values are computed, the threshold is incremented and the process is repeated until the threshold is larger than the composite average. That is,
threshold = (average background + average objects)/2.
Several implementations of this method exist. See the source code for further comments.
在农业信息领域,植物叶片病害的检测对农民的生活和环境都非常重要。为了提高植物叶病检测的准确性并减少图像处理时间,本研究提出了改进的K均值++聚类和均值间阈值方法。所提出的算法用于在两个不同的数据库中训练和测试植物叶片图像中的疾病。在所提出的方法中,将基于不同的阈值来选择中间均值算法。阈值的最佳值,即中间均值算法,将有助于提高植物叶片图像中疾病分类的准确性和速度。这种方法也将用于植物叶子的不可见图像。植物叶病检测的实验结果达到了98.10%的平均检测准确率。与基于标准K-均值聚类的结果相比,当前方法给出了23.20%左右的更好结果。所提出的算法比用于检测植物叶病的标准算法更有效,以及计算机计算能力中cots的减少。
In the field of agricultural information, the plant leaf disease detection is highly important for both farmer life and environment. To improve the accuracy of plant leaf disease detection and reduce the image processing time, the improved K‒mean++ clustering and intermeans thresholding method are proposed in this study. The proposed algorithms are used for training and testing diseases in plant leaf images in two different databases. Of the proposed methods, the intermeans algorithm will be selected based on different thresholding values. The optimal value of thresholding-i.e., the intermeans algorithm-will help increase the accuracy and speed of classifying diseases in plant leaf images. This method will be also used with unseen images of plant leaf. The experimental result of the detection of plant leaf diseases achieves an average detection accuracy of 98.10%. When compared with the results based on standard K‒mean clustering, the current method gives better results around 23.20%. The proposed algorithm is more effective than the standard algorithms for detecting plant leaf diseases, as well as the reduction in cots in the computational power of computers.
INTERMEANS ITER算法细节
一种迭代算法,其结果与OTSU算法相似
计算强度低于OTSU
算法从t的初始猜测开始
定义两类的均值μt和νt
设置t=[(μt+νt)/2]并重新计算μt和νt。
重复,直到t在两次连续迭代中具有相同的值
获得的t可能强烈依赖于其初始值
如果对象和背景占据可比较的区域,请使用平均值
如果对象与背景相比较小,请使用INTERMODES。
工具书类
T、 Ridler和S.Calvard,使用迭代选择方法的图像阈值,IEEE Trans。系统人网络。,第8卷,第630-6321978页。
H、 J.Trussell,评论?使用迭代选择方法的图像阈值处理?,IEEE Trans。系统人网络。,第9卷,第311页,1979年。
Details of INTERMEANS ITER algorithm
An iterative algorithm that gives similar results as the OTSU algorithm
Computationally less intensive than OTSU
The algorithm starts with an initial guess for t
Define the means μt and νt of the two classes
Set t = [(μt + νt)/2] and recalculate μt and νt.
Repeat until t has the same value in two consecutive iterations
The obtained t may strongly depend on its initial value
If the objects and background occupy comparable areas, use MEAN
If the objects are small compared to the background, use INTERMODES.
References
T. Ridler and S. Calvard, Picture thresholding using an iterative selection method, IEEE Trans. Systems Man Cybernet., vol. 8, pp. 630-632, 1978.
H. J. Trussell, Comments on ?Picture thresholding using an iterative selection method?, IEEE Trans. Systems Man Cybernet., vol. 9, p. 311, 1979.
Acknowledgements Based on the HistThresh Toolbox by Antti Niemistö, Tampere University of Technology, Finland
2、ISODATA算法源程序
using System;
using System.Linq;
using System.Text;
using System.Drawing;
using System.Collections;
using System.Collections.Generic;
using System.Drawing.Imaging;
namespace Legalsoft.Truffer.ImageTools
{
public static partial class BinarizationHelper
{
#region 灰度图像二值化 全局算法 ISODATA法
/// <summary>
/// ISODATA(也叫做intermeans法)
/// </summary>
/// <param name="histogram"></param>
/// <returns></returns>
public static int IsoData_Threshold(int[] histogram)
{
int g = Histogram_Left(histogram) + 1;
while (true)
{
int w = 0;
int totl = 0;
for (int i = 0; i < g; i++)
{
totl = totl + histogram[i];
w = w + (histogram[i] * i);
}
int h = 0;
int toth = 0;
for (int i = g + 1; i < histogram.Length; i++)
{
toth += histogram[i];
h += (histogram[i] * i);
}
if (totl > 0 && toth > 0)
{
w /= totl;
h /= toth;
if (g == (int)Math.Round((w + h) / 2.0))
{
break;
}
}
g++;
if (g > (histogram.Length - 2))
{
return 0;
}
}
return g;
}
public static void IsoData_Algorithm(byte[,] data)
{
int[] histogram = Gray_Histogram(data);
int threshold = IsoData_Threshold(histogram);
Threshold_Algorithm(data, threshold);
}
#endregion
}
}
3、ISODATA算法程序计算效果
相关文章
- c#中@标志的作用 C#通过序列化实现深表复制 细说并发编程-TPL 大数据量下DataTable To List效率对比 【转载】C#工具类:实现文件操作File的工具类 异步多线程 Async .net 多线程 Thread ThreadPool Task .Net 反射学习
- Newtonsoft.Json C# Json序列化和反序列化工具的使用、类型方法大全 C# 算法题系列(二) 各位相加、整数反转、回文数、罗马数字转整数 C# 算法题系列(一) 两数之和、无重复字符的最长子串 DateTime Tips c#发送邮件,可发送多个附件 MVC图片上传详解
- 请求大神,C#如何截取字符串中指定字符之间的部分 按指定字符串分割 一分为二 c# 去除字符串中的某个已知字符
- C#【基础篇】 C# 变量
- C#,图像二值化(18)——全局阈值的模糊集理论算法(Huang Thresholding)与源程序
- C#,图像二值化(16)——全局阈值的力矩保持算法(Moment-proserving Thresholding)及其源代码
- C#,图像二值化(15)——全局阈值的一维最大熵(1D maxent)算法及源程序
- C#,图像二值化(08)——全局阈值的优化算法(Optimization Thresholding)及其源代码
- C#,图像二值化(07)——全局阈值的迭代算法(Iteration Thresholding)及其源代码
- C#,图像二值化(06)——全局阈值的大津算法(OTSU Thresholding)及其源代码
- C#,图像二值化(01)——二值化算法综述与二十三种算法目录
- C#,图论与图算法,二分图(Bipartite Graph)的霍普克罗夫特-卡普(Hopcroft Karp)最大匹配算法与源程序
- C#,人工智能,机器学习,聚类算法,训练数据集生成算法、软件与源代码
- C#,图论与图算法,图(Graph)广度优先遍历(BFS,Breadth First Search)算法与源代码
- C#,二进制数的按位旋转(Bits Rotate)算法与源代码
- C#,最长公共扩展(LCE,Longest Common Extention)的算法与源代码
- C#,图论与图算法,有向图单源最短路径的贝尔曼·福特(Bellman Ford)算法与源代码
- C#,普洛尼克数(Pronic Number)的算法与源代码
- C#,超级阿格里数字(超级丑数,Super Ugly Number)的算法与源代码
- C#,字符串相似度的莱文斯坦距离(Levenshtein Distance)算法与源代码
- C#,动态规划的集合划分问题(DP Partition problem)算法与源代码
- C#,最小代价多边形三角剖分MCPT(Minimum Cost Polygon Triangulation)算法与源代码
- C#,质数(Prime Number)的四种算法源代码和性能比较
- C#,码海拾贝(18)——矩阵的(一般)三角分解法(Triangular Decomposition)之C#源代码,《C#数值计算算法编程》源代码升级改进版
- C#,码海拾贝(06)——连分式(Continued Fraction)曲线插值算法,《C#数值计算算法编程》源代码升级改进版
- C#,核心基础算法——文件处理的基础功能,文本文件与文本流编码问题的终极解决方案之源程序
- 《C#多线程编程实战(原书第2版)》——第1章 线 程 基 础 1.1 简介
- c#-接口
- 堆排序 -- C#代码实现
- C# 排序列表(SortedList)
- C# 特性参数(注解属性加在参数前面)
- C# TextBox 换行 滚动到最后一行