diff options
| -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) |
