A Simple De-speckle Algorithm

This algorithm attempts to find out whether a Pixel is a speckle in the scanned Image. A speckle can be roughly defined as an Impulse noise that has a very high/low value compared to its neighbors.
Normally, a median filter is good in reducing the speckle. But, applying median to remove speckle is not efficient. So an efficient way to do de-speckle is determine whether a pixel is a speckle and then apply Median or some other averaging technique.
Here is a way you can determine whether a pixel is a speckle quite fast. For this method to work you need to analyze the speckle pattern offline to figure out the threshold value.
Void SpeckleDetectAndCorrect ( char * source, int NumPixels )
{
/* We assume that the pixel of inerest is NumPixels/2+1. That is if the NumPixels is 5, then the 3rd pixel is the point of interest.*/
sum = source[0] + source[1] + source[3] + source[4];
Average = sum /4 ;
if (( Average – source[2]) > abs(20) )
{
/*this is a speckle Hence Apply Median*/
ApplyMedian(source, NumPixels )
}
}
Share: