-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfilters.py
37 lines (31 loc) · 835 Bytes
/
filters.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import numpy as np
from typing import Union
"""
Assigin any other edge detection filters here!
"""
edge_filters: dict[str, Union[np.ndarray, dict]] = {
'horizontal_edge': np.array([
[-1, -2, -1],
[0, 0, 0],
[1, 2, 1]
]),
'vertical_edge': np.array([
[-1, 0, 1],
[-2, 0, 2],
[-1, 0, 1]
]),
'scharr_filter': { # For diagonal edges!
'x': np.array([[-3, 0, 3],
[-10, 0, 10],
[-3, 0, 3]]),
'y': np.array([[-3, -10, -3],
[0, 0, 0],
[3, 10, 3]])
},
# 'prewitt_filter': np.array([ # For edges in all direction!
# ]),
# 'laplacian_filter': np.array([ # Finds abrupt intensity changes
# ])
}
scale_filters: dict[str, Union[np.ndarray, dict]] = {
}