MCPcopy Create free account
hub / github.com/ZhengPeng7/BiRefNet / random_gaussian

Function random_gaussian

preproc.py:62–72  ·  view source on GitHub ↗
(image, mean=0.1, sigma=0.35)

Source from the content-addressed store, hash-verified

60
61
62def random_gaussian(image, mean=0.1, sigma=0.35):
63 def gaussianNoisy(im, mean=mean, sigma=sigma):
64 for _i in range(len(im)):
65 im[_i] += random.gauss(mean, sigma)
66 return im
67
68 img = np.asarray(image)
69 width, height = img.shape
70 img = gaussianNoisy(img[:].flatten(), mean, sigma)
71 img = img.reshape([width, height])
72 return Image.fromarray(np.uint8(img))
73
74
75def random_pepper(img, N=0.0015):

Callers

nothing calls this directly

Calls 1

gaussianNoisyFunction · 0.85

Tested by

no test coverage detected