feat
fix design print stack_prin 函数逻辑修改
This commit is contained in:
@@ -323,21 +323,13 @@ class PrintPainting(object):
|
|||||||
@staticmethod
|
@staticmethod
|
||||||
def stack_prin(print_background, pattern_image, rotate_image, start_y, y, start_x, x):
|
def stack_prin(print_background, pattern_image, rotate_image, start_y, y, start_x, x):
|
||||||
temp_print = np.zeros((pattern_image.shape[0], pattern_image.shape[1], 3), dtype=np.uint8)
|
temp_print = np.zeros((pattern_image.shape[0], pattern_image.shape[1], 3), dtype=np.uint8)
|
||||||
|
|
||||||
temp_print[start_y:y + rotate_image.shape[0], start_x:x + rotate_image.shape[1]] = rotate_image
|
temp_print[start_y:y + rotate_image.shape[0], start_x:x + rotate_image.shape[1]] = rotate_image
|
||||||
|
img2gray = cv2.cvtColor(temp_print, cv2.COLOR_BGR2GRAY)
|
||||||
img2gray = cv2.cvtColor(print_background, cv2.COLOR_BGR2GRAY)
|
|
||||||
|
|
||||||
ret, mask_ = cv2.threshold(img2gray, 1, 255, cv2.THRESH_BINARY)
|
ret, mask_ = cv2.threshold(img2gray, 1, 255, cv2.THRESH_BINARY)
|
||||||
|
|
||||||
mask_inv = cv2.bitwise_not(mask_)
|
mask_inv = cv2.bitwise_not(mask_)
|
||||||
|
img1_bg = cv2.bitwise_and(print_background, print_background, mask=mask_inv)
|
||||||
img1_bg = cv2.bitwise_and(print_background, print_background, mask=mask_)
|
img2_fg = cv2.bitwise_and(temp_print, temp_print, mask=mask_)
|
||||||
|
|
||||||
img2_fg = cv2.bitwise_and(temp_print, temp_print, mask=mask_inv)
|
|
||||||
|
|
||||||
print_background = img1_bg + img2_fg
|
print_background = img1_bg + img2_fg
|
||||||
|
|
||||||
return print_background
|
return print_background
|
||||||
|
|
||||||
def painting_collection(self, painting_dict, print_dict, print_trigger=False, is_single=False):
|
def painting_collection(self, painting_dict, print_dict, print_trigger=False, is_single=False):
|
||||||
|
|||||||
Reference in New Issue
Block a user