def plot_hsv(image, bins=12):
"""
Plot HSV histograms of image
INPUT: image with HSV channels
OUPUT: plot of HSV histograms and color spectrum
"""
sns.set_style("whitegrid", {'axes.grid': False})
fig = plt.figure(figsize=(12, 5))
plt.subplots_adjust(top=2, bottom=1, wspace=.5, hspace=0)
plt.subplot(231)
plt.hist(image[:, :, 0].flatten(), bins=bins, color='gray')
plt.title('Hue')
plt.subplot(232)
plt.hist(image[:, :, 1].flatten(), bins=bins, color='gray')
plt.title('Saturation')
plt.subplot(233)
plt.hist(image[:, :, 2].flatten(), bins=bins, color='gray')
plt.title('Value')
plt.subplot(234)
plt.imshow(all_hues, extent=(0, 1, 0, 0.2))
plt.show()
评论列表
文章目录