helpers.py 文件源码

python
阅读 34 收藏 0 点赞 0 评论 0

项目:opencv-helpers 作者: abarrak 项目源码 文件源码
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()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号