MCPcopy Create free account
hub / github.com/JimmyHHua/opencv_tutorials / blur_demo

Function blur_demo

python/code_028/opencv_028.py:14–33  ·  view source on GitHub ↗
(image, ii)

Source from the content-addressed store, hash-verified

12
13
14def blur_demo(image, ii):
15 h, w, dims = image.shape
16 result = np.zeros(image.shape, image.dtype)
17 ksize = 15
18 radius = ksize // 2
19 for row in range(0, h + radius, 1):
20 y2 = h if (row + 1)> h else (row + 1)
21 y1 = 0 if (row - ksize) < 0 else (row - ksize)
22 for col in range(0, w + radius, 1):
23 x2 = w if (col + 1)>w else (col + 1)
24 x1 = 0 if (col - ksize) < 0 else (col - ksize)
25 cx = 0 if (col - radius) < 0 else (col - radius)
26 cy = 0 if (row - radius) < 0 else (row - radius)
27 num = (x2 - x1)*(y2 - y1)
28 for i in range(0, 3, 1):
29 s = get_block_sum(ii, x1, y1, x2, y2, i)
30 result[cy, cx][i] = s // num
31
32 cv.imshow("integral fast blur", result)
33 # cv.imwrite("./result.png", result)
34
35
36src = cv.imread("./test.png")

Callers 1

opencv_028.pyFile · 0.85

Calls 1

get_block_sumFunction · 0.85

Tested by

no test coverage detected