Opencv Python 简明教程

OpenCV Python - Using Matplotlib

Python 的 Matplotlib 是一个功能强大的绘图库,它为各种绘图类型提供了大量的绘图函数。它还具有用于呈现图片的 imshow() 函数。它提供了诸如缩放、保存等附加功能。

Python’s Matplotlib is a powerful plotting library with a huge collection of plotting functions for the variety of plot types. It also has imshow() function to render an image. It gives additional facilities such as zooming, saving etc.

Example

在运行以下程序之前,确保在当前工作环境中已安装 Matplotlib。

Ensure that Matplotlib is installed in the current working environment before running the following program.

import numpy as np
import cv2
import matplotlib.pyplot as plt
# Load an color image in grayscale
img = cv2.imread('OpenCV_Logo.png',0)
plt.imshow(img)
plt.show()

Output

opencv logo matplotlib