I have the original image and its segmented mask. My task is to get a colored segmentation plot over the original image. I tried following
The segmented image:
This is a similar example of the result I want to achieve:
CodePudding user response:
It can be easily done using matplotlib.pyplot
import matplotlib.pyplot as plt
image = plt.imread('image.png')
mask = plt.imread('mask.png')
fig, ax = plt.subplots()
ax.imshow(image, cmap='gray')
ax.imshow(mask, cmap='gray', alpha=0.5)
fig.show()
fig.savefig('overlapped.png')
You can also change colors by changing colormap parameter, cmap.