@@ -1096,8 +1096,25 @@ gradient = cv.morphologyEx(img, cv.MORPH_GRADIENT, kernel)
1096
1096
1097
1097
Difference between input and opening.
1098
1098
1099
+ > The white top-hat transform returns an image, containing those "objects" or "elements" of an input image that:
1100
+ >
1101
+ > - Are "smaller" than the structuring element (i.e., places where the structuring element does not fit in), and
1102
+ > - are ** brighter** than their surroundings.
1103
+ >
1104
+ > ** Before**
1105
+ >
1106
+ > ![ img] ( assets/Cosmos_original.jpg )
1107
+ >
1108
+ > ** After**
1109
+ >
1110
+ > ![ img] ( assets/Cosmos_tophat.jpg )
1111
+ >
1112
+ > https://en.wikipedia.org/wiki/Top-hat_transform
1113
+
1099
1114
![ tophat.png] ( assets/tophat.png )
1100
1115
1116
+ You can use it for isolating bright objects under non-uniform illumination too!
1117
+
1101
1118
``` python
1102
1119
tophat = cv.morphologyEx(img, cv.MORPH_TOPHAT , kernel)
1103
1120
```
@@ -1106,6 +1123,12 @@ tophat = cv.morphologyEx(img, cv.MORPH_TOPHAT, kernel)
1106
1123
1107
1124
Difference between input and closing.
1108
1125
1126
+ > The black top-hat returns an image, containing the "objects" or "elements" that:
1127
+ >
1128
+ > - Are "smaller" than the structuring element, and
1129
+ > - are ** darker** than their surroundings.
1130
+ > - https://en.wikipedia.org/wiki/Top-hat_transform
1131
+
1109
1132
![ blackhat.png] ( assets/blackhat.png )
1110
1133
1111
1134
``` python
0 commit comments