深度图像分割:利用mask对原图中的分割对象进行分割出来

from PIL import Image
import numpy as np

subimage = Image.open('res.jpg')
original = Image.open(img_path)
original = original.resize((320, 320))
subimage = np.array(subimage)
original = np.array(original)

for i in range(320):
    for j in range(320):
        if subimage[i][j][0] == 0 and subimage[i][j][1] == 0 and subimage[i][j][2] == 0:
            original[i][j] = (255, 255, 255)

img = Image.fromarray(original)
img.save("output.jpg", "JPEG")

你可能感兴趣的:(深度图像分割:利用mask对原图中的分割对象进行分割出来)