(img, sf=4)
| 323 | |
| 324 | |
| 325 | def add_blur(img, sf=4): |
| 326 | wd2 = 4.0 + sf |
| 327 | wd = 2.0 + 0.2 * sf |
| 328 | if random.random() < 0.5: |
| 329 | l1 = wd2 * random.random() |
| 330 | l2 = wd2 * random.random() |
| 331 | k = anisotropic_Gaussian(ksize=2 * random.randint(2, 11) + 3, theta=random.random() * np.pi, l1=l1, l2=l2) |
| 332 | else: |
| 333 | k = fspecial('gaussian', 2 * random.randint(2, 11) + 3, wd * random.random()) |
| 334 | img = ndimage.filters.convolve(img, np.expand_dims(k, axis=2), mode='mirror') |
| 335 | |
| 336 | return img |
| 337 | |
| 338 | |
| 339 | def add_resize(img, sf=4): |
no test coverage detected