kAver[i * 3 + 1] = kOldAver[i * 3 + 1] = Convert.ToInt16(i * 255 /
(numbers - 1));
kAver[i * 3] = kOldAver[i * 3] = Convert.ToInt16(i * 255 / (numbers -
1));
}
int count = 0;
while (true)
{
int order = 0;
for (int i = 0; i < numbers; i++)
{
kNum[i] = 0;
kSum[i * 3 + 2] = kSum[i * 3 + 1] = kSum[i * 3] = 0;
kAver[i * 3 + 2] = kOldAver[i * 3 + 2];
kAver[i * 3 + 1] = kOldAver[i * 3 + 1];
kAver[i * 3] = kOldAver[i * 3];
}
//归属聚类
for (int i = 0; i < bytes; i++)
{
for (int j = 0; j < numbers; j++)
{
kTemp[j] = Math.Pow(rgbValues[i * 3 + 2] - kAver[j * 3 + 2],
2) + Math.Pow(rgbValues[i * 3 + 1] - kAver[j * 3 + 1], 2) + 彩色图像的分割处理程序设计+Hough算法(14):http://www.751com.cn/jisuanji/lunwen_1067.html