-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.py
38 lines (33 loc) · 1.07 KB
/
test.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
38
import cv2, numpy as np
from scipy.ndimage import maximum_filter
img = cv2.imread(f"assets/images/20241203_000635.mp4_frame_1.png", cv2.IMREAD_COLOR)
# blur the image
sigma = 1.6*(np.sqrt(2))**10
radius = int(3*sigma)
img0 = cv2.sepFilter2D(
img,
-1,
cv2.getGaussianKernel(radius, sigma),
cv2.getGaussianKernel(radius, sigma).T,
borderType=cv2.BORDER_CONSTANT,
)
#save it as "assets/blurred_0.png"
cv2.imwrite("assets/blurred_0.png", img0)
imgr = cv2.sepFilter2D(
img,
-1,
cv2.getGaussianKernel(radius, sigma),
cv2.getGaussianKernel(radius, sigma).T,
borderType=cv2.BORDER_REFLECT_101,
)
#save it as "assets/blurred_0.png"
cv2.imwrite("assets/blurred_r.png", imgr)
imgc = cv2.sepFilter2D(
img,
-1,
cv2.getGaussianKernel(radius, sigma),
cv2.getGaussianKernel(radius, sigma).T,
borderType=cv2.BORDER_REPLICATE,
)
#save it as "assets/blurred_0.png"
cv2.imwrite("assets/blurred_c.png", imgc)