From 57b9c1ebbc669b65f80853a75b52056d02f8cffb Mon Sep 17 00:00:00 2001 From: mattmcw Date: Mon, 20 Feb 2023 18:44:20 -0500 Subject: [PATCH] move functions from proof of concept into apply image --- fourcell/apply_image.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/fourcell/apply_image.py b/fourcell/apply_image.py index 0935635..cb906d1 100644 --- a/fourcell/apply_image.py +++ b/fourcell/apply_image.py @@ -38,6 +38,18 @@ def create_blank(width, height): def to_points (d) : return [[d['0']['x'], d['0']['y']], [d['1']['x'], d['1']['y']], [d['3']['x'], d['3']['y']]] +def get_mask (img) : + lower = np.array([0,0,0,0]) + upper= np.array([0,0,0,0]) + mask = cv2.inRange(img, lower, upper) + return cv2.bitwise_not(mask) + +def combine_images (bg, fg, mask) : + fk = cv2.bitwise_or(fg, fg, mask=mask) + mask = cv2.bitwise_not(mask) + bk = cv2.bitwise_or(bg, bg, mask=mask) + return cv2.bitwise_or(fk, bk) + if len(sys.argv) < 2 : print('Please provide an output destination file') exit(1)