MCPcopy Create free account
hub / github.com/alinlab/SelfPatch / GaussianBlur

Class GaussianBlur

utils.py:36–54  ·  view source on GitHub ↗

Apply Gaussian Blur to the PIL image.

Source from the content-addressed store, hash-verified

34
35
36class GaussianBlur(object):
37 """
38 Apply Gaussian Blur to the PIL image.
39 """
40 def __init__(self, p=0.5, radius_min=0.1, radius_max=2.):
41 self.prob = p
42 self.radius_min = radius_min
43 self.radius_max = radius_max
44
45 def __call__(self, img):
46 do_it = random.random() <= self.prob
47 if not do_it:
48 return img
49
50 return img.filter(
51 ImageFilter.GaussianBlur(
52 radius=random.uniform(self.radius_min, self.radius_max)
53 )
54 )
55
56
57class Solarization(object):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected