diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2018-05-15 04:43:30 +0200 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2018-05-15 04:43:30 +0200 |
| commit | c64bdfb658771c9e913b8af58486353c897ece64 (patch) | |
| tree | bbbf7e86b1677a3d9b50caa372b7c94b376415e3 /test-mogrify.py | |
| parent | 898cf483f915605280a1de52943ad50e9507ca75 (diff) | |
testy
Diffstat (limited to 'test-mogrify.py')
| -rw-r--r-- | test-mogrify.py | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/test-mogrify.py b/test-mogrify.py index d4cc2a6..25a62d4 100644 --- a/test-mogrify.py +++ b/test-mogrify.py @@ -70,6 +70,8 @@ if __name__ == '__main__': print("Sequence not found") def process_image(im): + src_img = im[:, :, ::-1].copy() + img = im[:, :, ::-1].copy() if data_opt.clahe is True: @@ -79,7 +81,6 @@ if __name__ == '__main__': l = clahe.apply(l) limg = cv2.merge((l,a,b)) img = cv2.cvtColor(limg, cv2.COLOR_LAB2BGR) - if data_opt.posterize is True: img = cv2.pyrMeanShiftFiltering(img, data_opt.spatial_window, data_opt.color_window) if data_opt.grayscale is True: @@ -89,6 +90,12 @@ if __name__ == '__main__': if data_opt.canny is True: img = cv2.Canny(img, data_opt.canny_lo, data_opt.canny_hi) + frac_a = data_opt.process_frac + frac_b = 1.0 - frac_a + array_a = np.multiply(src_img.astype('float64'), frac_a) + array_b = np.multiply(img.astype('float64'), frac_b) + img = np.add(array_a, array_b).astype('uint8') + return img if data_opt.sequence: @@ -176,15 +183,8 @@ if __name__ == '__main__': # im = np.asarray(image_pil).astype('uint8') #print(im.shape, im.dtype) - src_img = im[:, :, ::-1].copy() img = process_image(im) - frac_a = data_opt.process_frac - frac_b = 1.0 - frac_a - array_a = np.multiply(src_img.astype('float64'), frac_a) - array_b = np.multiply(img.astype('float64'), frac_b) - img = np.add(array_a, array_b).astype('uint8') - cv2.imwrite(tmp_path, img) os.rename(tmp_path, edges_path) |
