MCPcopy
hub / github.com/makelove/OpenCV-Python-Tutorial / blur_edge

Function blur_edge

官方samples/deconvolution.py:43–50  ·  view source on GitHub ↗
(img, d=31)

Source from the content-addressed store, hash-verified

41
42
43def blur_edge(img, d=31):
44 h, w = img.shape[:2]
45 img_pad = cv2.copyMakeBorder(img, d, d, d, d, cv2.BORDER_WRAP)
46 img_blur = cv2.GaussianBlur(img_pad, (2*d+1, 2*d+1), -1)[d:-d,d:-d]
47 y, x = np.indices((h, w))
48 dist = np.dstack([x, w-x-1, y, h-y-1]).min(-1)
49 w = np.minimum(np.float32(dist)/d, 1.0)
50 return img*w + img_blur*(1-w)
51
52def motion_kernel(angle, d, sz=65):
53 kern = np.ones((1, d), np.float32)

Callers 1

deconvolution.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected