Sometimes you work in an environment that generates data you need to analyze and rely on. However, unexpected noise can occasionally affect the quality of your data.
For example, consider an electrical system with unshielded cables placed close together. The yellow cables carry a signal that ramps up and down to control an actuator. During data analysis, you might discover that the green cables emit square pulses, which, due to EMI, also appear as interference on the yellow cables. Since this disturbance from the green cables is predictable, we can use morphological operations to remove the unwanted signal.
![cables](https://sysreq.ch/wp-content/uploads/2024/12/7355c559-cf63-4f4c-b355-beed4da39e5d.webp)
Content
- What are morphological operations?
- Dilation – max filter
- Erosion – min filter
- Open – first min filter than max filter
- Close – first max filter than min filter
- Bonus: Close minus Open (CMO)
- Summary
[>_] Try out the interactive application below for each example to see the operations in action!
What are morphological operations?
At the core of morphological operations are filters that calculate the minimum or maximum value within a sliding window defined by the structuring element. This approach helps highlight or suppress certain patterns in your signal or image. Morphological operations are commonly found in image processing, where they are used to analyze and modify shapes, remove noise, or enhance specific features in an image. Here, we are applying morphological operations in a 1D space, specifically to process and clean signal data.
Dilation – max filter
Dilation is the process of taking the maximum value within the structuring element. This operation «grows» or emphasizes bright areas in a signal or image. In our example, dilation could enhance the unwanted pulses from the green cables.
Erosion – min filter
Erosion is the opposite of dilation—it takes the minimum value within the structuring element. This operation «shrinks» or suppresses bright areas. In our scenario, erosion could help reduce the impact of smaller disturbances.
Open – first min filter than max filter
Opening is a combination of erosion followed by dilation. It is particularly effective for removing small noise while preserving the overall structure of the signal. For instance, it could help eliminate isolated disturbances caused by EMI.
Close – first max filter than min filter
Closing is the reverse of opening—it applies dilation first, followed by erosion. This operation is useful for filling small gaps or connecting nearby elements in the data. For instance, it can emphasize the disturbance on the signal, making it more apparent for further analysis
Bonus: Close minus Open (CMO)
The «Close minus Open» operation is a more advanced technique that highlights differences between closing and opening. It is useful for detecting subtle variations or emphasizing patterns that other operations might miss. In our case, it could isolate the exact shape of the interference from the green cables for further analysis.
Summary
By applying the «Open» operation, the original signal could be better reconstructed by effectively removing the unwanted noise caused by EMI. Additionally, the «Close minus Open» (CMO) operation allowed the interference to be isolated, providing a clear separation of the disturbance from the true signal. These morphological operations proved to be powerful tools for enhancing data quality in this scenario.