我已分割图像和原始图像。如何将原始图像放置在分割图像的白色区域?
我根据ksooklall的建议编写的代码是:
segmented_imgs=("D:/melanoma/train2/train/mask/1")
original_img=("D:/melanoma/train2/train/org/1")
masks=[]
original_imgs=[]
index=0
for index in range(1476):
segmented_img=(segmented_imgs+ str(index) +"_mask.jpg"!=0)
original_img=(original_img+ "/" + str(index) + ".jpg")
mask = (segmented_img != 0)
segmented_img[mask] = original_img[mask]
index +=1
我收到错误:
File "D:/merge orjsegment.py", line 14, in <module> segmented_img=cv2.imread(segmented_img+ str(index) + "_mask.jpg"!=0) TypeError: bad argument type for built-in operation
答案 0 :(得分:0)
尝试:
mask = (segmented_img != 0)
segmented_img[mask] = original_img[mask]