Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 54990e9

Browse files
Add tophat explanations
1 parent 14af582 commit 54990e9

File tree

3 files changed

+23
-0
lines changed

3 files changed

+23
-0
lines changed

‎01 OpenCV Basics and Image Processing.md‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1096,8 +1096,25 @@ gradient = cv.morphologyEx(img, cv.MORPH_GRADIENT, kernel)
10961096

10971097
Difference between input and opening.
10981098

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+
10991114
![tophat.png](assets/tophat.png)
11001115

1116+
You can use it for isolating bright objects under non-uniform illumination too!
1117+
11011118
```python
11021119
tophat = cv.morphologyEx(img, cv.MORPH_TOPHAT, kernel)
11031120
```
@@ -1106,6 +1123,12 @@ tophat = cv.morphologyEx(img, cv.MORPH_TOPHAT, kernel)
11061123

11071124
Difference between input and closing.
11081125

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+
11091132
![blackhat.png](assets/blackhat.png)
11101133

11111134
```python

‎assets/Cosmos_original.jpg‎

31.2 KB
Loading[フレーム]

‎assets/Cosmos_tophat.jpg‎

30 KB
Loading[フレーム]

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /