def plot(image, is_bgr=True, cmap=None, title='Image Viewer', disable_toolbar=True):
''' show image in matplotlib viewer. if path is given, load() first. '''
if isinstance(image, str):
image = load(str)
if disable_toolbar:
matplotlib.rcParams['toolbar'] = 'None'
# opencv image are in BGR colormap while matplotlib in RGB.
if is_bgr:
image = convert_to_rgb(image)
fig = plt.figure()
fig.canvas.set_window_title(title)
plt.imshow(image, cmap)
# hide tick values on X and Y axis.
plt.xticks([]), plt.yticks([])
plt.show()
评论列表
文章目录