c++实现代码
public: void __gc* ClearNoise(Int32 __gc* dgGrayValue)
{
Byte __gc* buffer __gc [] = __gc new Byte __gc*[9];
for (Int32 __gc* i = 1; (i < (this->bmpobj->Height - 1)); i++)
{
for (Int32 __gc* j = 1; (j < (this->bmpobj->Width - 1)); j++)
{
buffer[0] = this->bmpobj->GetPixel((j - 1), (i - 1))->R;
buffer[1] = this->bmpobj->GetPixel(j, (i - 1))->R;
buffer[2] = this->bmpobj->GetPixel((j + 1), (i - 1))->R;
buffer[3] = this->bmpobj->GetPixel((j - 1), i)->R;
buffer[4] = this->bmpobj->GetPixel(j, i)->R;
buffer[5] = this->bmpobj->GetPixel((j + 1), i)->R;
buffer[6] = this->bmpobj->GetPixel((j - 1), (i + 1))->R;
buffer[7] = this->bmpobj->GetPixel(j, (i + 1))->R;
buffer[8] = this->bmpobj->GetPixel((j + 1), (i + 1))->R;
for (Int32 __gc* k = 0; (k < 5); k++)
{
for (Int32 __gc* m = (k + 1); (m < 9); m++)
{
if (buffer[k] > buffer[m])
{
Byte __gc* num3 = buffer[k];
buffer[k] = buffer[m];
buffer[m] = num3;
}
}
}
this->bmpobj->SetPixel(j, i, Color::FromArgb(buffer[4], buffer[4], buffer[4]));
}
}
}
public: void __gc* ClearNoise(Int32 __gc* dgGrayValue)
{
Byte __gc* buffer __gc [] = __gc new Byte __gc*[9];
for (Int32 __gc* i = 1; (i < (this->bmpobj->Height - 1)); i++)
{
for (Int32 __gc* j = 1; (j < (this->bmpobj->Width - 1)); j++)
{
buffer[0] = this->bmpobj->GetPixel((j - 1), (i - 1))->R;
buffer[1] = this->bmpobj->GetPixel(j, (i - 1))->R;
buffer[2] = this->bmpobj->GetPixel((j + 1), (i - 1))->R;
buffer[3] = this->bmpobj->GetPixel((j - 1), i)->R;
buffer[4] = this->bmpobj->GetPixel(j, i)->R;
buffer[5] = this->bmpobj->GetPixel((j + 1), i)->R;
buffer[6] = this->bmpobj->GetPixel((j - 1), (i + 1))->R;
buffer[7] = this->bmpobj->GetPixel(j, (i + 1))->R;
buffer[8] = this->bmpobj->GetPixel((j + 1), (i + 1))->R;
for (Int32 __gc* k = 0; (k < 5); k++)
{
for (Int32 __gc* m = (k + 1); (m < 9); m++)
{
if (buffer[k] > buffer[m])
{
Byte __gc* num3 = buffer[k];
buffer[k] = buffer[m];
buffer[m] = num3;
}
}
}
this->bmpobj->SetPixel(j, i, Color::FromArgb(buffer[4], buffer[4], buffer[4]));
}
}
}
200字以内,仅用于支线交流,主线讨论请采用回复功能。