python对图像提取mask部分:
代码:
#coding:utf-8
import os
import cv2
import numpy as np
def add_mask2image_binary(images_path, masks_path, masked_path):
# Add binary masks to images
for img_item in os.listdir(images_path):
print(img_item)
img_path = os.path.join(images_path, img_item)
img = cv2.
1