(img, sf=4)
| 337 | |
| 338 | |
| 339 | def add_resize(img, sf=4): |
| 340 | rnum = np.random.rand() |
| 341 | if rnum > 0.8: # up |
| 342 | sf1 = random.uniform(1, 2) |
| 343 | elif rnum < 0.7: # down |
| 344 | sf1 = random.uniform(0.5 / sf, 1) |
| 345 | else: |
| 346 | sf1 = 1.0 |
| 347 | img = cv2.resize(img, (int(sf1 * img.shape[1]), int(sf1 * img.shape[0])), interpolation=random.choice([1, 2, 3])) |
| 348 | img = np.clip(img, 0.0, 1.0) |
| 349 | |
| 350 | return img |
| 351 | |
| 352 | |
| 353 | # def add_Gaussian_noise(img, noise_level1=2, noise_level2=25): |
no outgoing calls
no test coverage detected