(image, ii)
| 12 | |
| 13 | |
| 14 | def 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 | |
| 36 | src = cv.imread("./test.png") |
no test coverage detected