//
//------------------------------
//
// 中位值滤波
//
//------------------------------
//
uint16 GetTheMiddleValue(uint16 *Pointer,uint8 Length)
{
uint8 i;
uint32 temp32 = 0;
uint16 MaxVal = 0x0000;
uint16 MinVal = 0xffff;
if ( Length>2 )
{
for ( i="0";i<Length;i++ )
{
if ( Pointer> MaxVal)
{
MaxVal = Pointer;
}
if ( Pointer<MinVal )
{
MinVal = Pointer;
}
temp32 += Pointer;
}
temp32 = (temp32-MaxVal-MinVal)/(Length-2);
}
else
{
for ( i="0";i<Length;i++ )
{
temp32 += Pointer;
}
temp32 = temp32/Length;
}
return (uint16)temp32;
}
文章评论(0条评论)
登录后参与讨论