MCPcopy Create free account
hub / github.com/buaacxf/VIPTR / random_dilute

Function random_dilute

dataload/dataAug.py:147–164  ·  view source on GitHub ↗
(image, sele_value=50, set_value=20, num_ratio=[0.1, 0.2])

Source from the content-addressed store, hash-verified

145
146
147def random_dilute(image, sele_value=50, set_value=20, num_ratio=[0.1, 0.2]):
148 index = np.where(image < (image.min() + sele_value))
149 tag = []
150 for i in range(len(index[0])):
151 tag.append([index[0][i], index[1][i]])
152 np.random.shuffle(tag)
153 tag = np.array(tag)
154 total_num = len(tag[:, 0])
155 num = int(total_num * np.random.choice(num_ratio, 1)[0])
156 tag1 = tag[:num, 0]
157 tag2 = tag[:num, 1]
158 index = (tag1, tag2)
159 start = image.min() + sele_value + set_value
160 if (start >= 230):
161 start = start - 50
162 ra_value = min(np.random.randint(min(225, start), 230), 230)
163 image[index] = ra_value
164 return image
165
166
167def motion_blur(image):

Callers 1

warpFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected