In morphology and digital image processing, top-hat and black-hat transform are operations that are used to extract small elements and details from given images. These two types of transforms in which, the top-hat transform is defined as the difference between the input image and its opening by some structuring element, while the black-hat transform is defined as the difference between the closing and the input image. These transforms are used for various image processing tasks, such as feature extraction, background equalization, image enhancement, and others.
Difference between Top-Hat and Black-Hat
The top-hat filter is used to enhance bright objects of interest in a dark background. The black-hat operation is used to do the opposite, enhance dark objects of interest in a bright background.
Example 1: Top-Hat Transform
As you can observe in the above image, the very small details are enhanced and taken out using the Top-Hat operation. Hence, it is useful in observing the minor details of the inputs when are present as light pixels on a dark background.
Example 2: Black Hat transform
Here in this image, all the objects which are white on a dark background are highlighted due to the Black Hat transformation applied to the input image.
- White and black dot detection using OpenCV | Python
- Python code formatting using Black
- Highlight the negative values red and positive values black in Pandas Dataframe
- Python | Pandas Series.transform()
- Python | Pandas DataFrame.transform
- Python PIL | Image.transform() method
- Python | Fast Walsh Hadamard Transform
- Wand transform() function in Python
- Mahotas - Reversing Haar Transform
- Mahotas - Haar Transform
- Mahotas - Hit & Miss transform
- Fetching top news using News API
- Top 10 Python IDE and Code Editors in 2020
- Fetch top 10 starred repositories of user on GitHub | Python
- PyQt5 ComboBox - User entered items store at top
- Add a row at top in pandas DataFrame
- Python | Find top K frequent elements from a list of tuples
- Python | Sorting URL on basis of Top Level Domain
- Python | Get Top N elements from Records
- Python | Top N pairs by Kth element from list