Jump to content

Draft:Alpha-trimmed filter

From Wikipedia, the free encyclopedia

The alpha-trimmed filter is a statistical tool used in image processing for noise reduction.:[1] It combines elements of both median and mean filters, leveraging their advantages. The filter operates by discarding a specified number of the smallest and largest values in a dataset, guided by a trimming parameter alpha (α) which ranges from 0 to 0.5. The trimmed mean is then calculated from the remaining values, striking a balance between the median and moving average filters. This approach is particularly effective at reducing noise while maintaining the integrity of the original signal, making it a valuable technique for image enhancement and noise reduction. This is an algorithmic approach that tries to combine properties of the mean filter with properties of the median filter.

Removal of salt and pepper noise

[edit]

The proposed system involves developing an adaptive alpha-trimmed median filter designed to eliminate salt and pepper noise from digital images. This filter selectively adjusts corrupted pixel values, effectively restoring images while preserving edge details. When tested across different noise levels, the filter consistently shows enhanced performance in terms of PSNR and IEF, highlighting its significant contribution to digital image processing.

Code

[edit]

The alpha-trimmed mean filter algorithm takes the general formula[2]

  1. Select a suitable value of alpha
  2. Arrange all the image pixel values in increasing or decreasing order
  3. Trim alpha elements from the start and end
  4. Take average of the remaining pixel values

The entire algorithm as function:

void calculateTrimmedMean(const element* signal, int N, int alpha) {

    if (2 * alpha >= N) {

        std::cerr << "Invalid alpha value: The array is too small to trim " << alpha << " elements from both ends." << std::endl;

        return;

    }

    element sum = 0;

    int count = 0;

    std::cout << "Remaining elements after trimming: ";

    for (int i = alpha; i < N - alpha; ++i) {

        std::cout << signal[i] << " ";

        sum += signal[i];

        ++count;

    }

    std::cout << std::endl;

 

    float mean = (float)sum / count;

    std::cout << "Mean of the remaining elements: " << mean << std::endl;

}

Alpha (α)-Trimmed Averaging Filter Example

[edit]

Window F

[edit]
20 20 18
21 19 12
19 22 10

Ordered List

[edit]

The ordered list is:

F = { 10, 12, 18, 19, 19, 20, 20, 21, 22 }

Alpha-Trimmed Mean Calculation

[edit]

For α = 1

[edit]

Trim 1 smallest and 1 largest elements. Remaining list:

{ 12, 18, 19, 19, 20, 20, 21 }

Mean:

(12 + 18 + 19 + 19 + 20 + 20 + 21)/7 = 129/7= 18.43

For α = 2

[edit]

Trim 2 smallest and 2 largest elements. Remaining list:

{ 18, 19, 19, 20, 20 }

Mean:

(18 + 19 + 19 + 20 + 20)/5 = 96/5 = 19.2

For α = 3

[edit]

Trim 3 smallest and 3 largest elements. Remaining list:

{ 19, 19, 20 }

Mean:

(19 + 19 + 20)/3 =58/3=19.33

For α = 4

[edit]

Trim 4 smallest and 4 largest elements. Remaining list:

{ 19 }

Mean:

19

References

[edit]
  1. ^ "Image Enhancement using α-Trimmed Mean εFilters". World Academy of Science, Engineering and Technology 59 2011.
  2. ^ Jayaraman, S.; Esakkirajan, S.; Veerakumar, T. (2009). Digital Image Processing. Tata McGraw Hill Education. ISBN 9780070144798.