MCPcopy Create free account
hub / github.com/cxapython/catvm / gaussian_noise

Function gaussian_noise

test.py:28–38  ·  view source on GitHub ↗
(image)

Source from the content-addressed store, hash-verified

26
27
28def gaussian_noise(image): # 加高斯噪声
29 h, w, c = image.shape
30 for row in range(h):
31 for col in range(w):
32 s = np.random.normal(0, 20, 3)
33 b = image[row, col, 0] # blue
34 g = image[row, col, 1] # green
35 r = image[row, col, 2] # red
36 image[row, col, 0] = clamp(b + s[0])
37 image[row, col, 1] = clamp(g + s[1])
38 image[row, col, 2] = clamp(r + s[2])
39
40
41src = cv.imread('img2.png')

Callers

nothing calls this directly

Calls 1

clampFunction · 0.85

Tested by

no test coverage detected