Skip to content

Instantly share code, notes, and snippets.

@odebeir
Last active December 17, 2015 10:49
Show Gist options
  • Save odebeir/5598052 to your computer and use it in GitHub Desktop.
Save odebeir/5598052 to your computer and use it in GitHub Desktop.
label2rgb
label = np.asarray([[0,1],[2,3]])
rgblabel = np.zeros([2,2,3])
rgblabel[label==1,:]=[1,0,0]
rgblabel[label==2,:]=[0,1,0]
rgblabel[label==3,:]=[0,0,1]
plt.imshow(rgblabel,interpolation='nearest')
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment