def plot_glcf_labelmap(labels, ax=None):
import pylab as pl
if ax is None:
ax = pl.subplot(111)
vimg = glcf_to_rgb(labels)
vimg[labels.mask] = (0, 0, 0)
ax.imshow(vimg, interpolation='nearest')
lgd_patches = []
for glcf_type in sorted(np.unique(labels)):
if glcf_type is ma.masked:
continue
lgd_patches.append(
mpatches.Patch(
color=np.array(CMAP[glcf_type]) / 255.,
label=CLASSES_NAMES[glcf_type]
)
)
ax.legend(loc='upper center', bbox_to_anchor=(0.5, -0.05),
handles=lgd_patches)
评论列表
文章目录