Show all scripts

Top Hat Filter

Category: Image Filters
Description: Filter to carry out Top Hat Filtering for efficient noise removal of high pixel values of noise (white, 255). The rolling ball filter performs the equivalent function on black pixels. A top hat kernel is defined as a 3x3 array with 3 pixels attached to each of the sides a square with the corner pixels removed). The maximum values the central 5 pixels (3 x 3 cross) are compared with the maximum values of the rest of the kernel (the brim). If the central maxium-peripheral maximum exceeds a threshold value, then it is replaced with the median value of the brim otherwise it is retained. The threshold value is set a 12 and an alternative value may be selected by holding down the option key when running the script.
Acknowledgements: For an excellent overview of image processing methods and applications see 'The Image Processing Handbook' by john Russ
Script version: 2.0
DM/GMS version: 3.6.5
Script written as a function: No
Source: Show code
Download Source Code: Download
Download Zip File: Download