move functions from proof of concept into apply image

This commit is contained in:
Matt McWilliams 2023-02-20 18:44:20 -05:00
parent 0af8b43606
commit 57b9c1ebbc
1 changed files with 12 additions and 0 deletions

View File

@ -38,6 +38,18 @@ def create_blank(width, height):
def to_points (d) : def to_points (d) :
return [[d['0']['x'], d['0']['y']], [d['1']['x'], d['1']['y']], [d['3']['x'], d['3']['y']]] 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 : if len(sys.argv) < 2 :
print('Please provide an output destination file') print('Please provide an output destination file')
exit(1) exit(1)