Color image loaded by OpenCV is in BGR mode.But Matplotlib displays in RGB mode.So color images will not be displayed correctly in Matplotlib if image is read with OpenCV.Please see the exercises for more details.(引自文档) import numpy as np import cv2…
以下代码为在Python3环境下利用OpenCV 抓取摄像头的实时图像, 通过OpenCV的 calHist函数计算直方图, 并显示在3个不同窗口中. import cv2 import numpy as np from matplotlib import pyplot as plt import time cap = cv2.VideoCapture(0) for i in range(0, 19): print(cap.get(i)) while(1): ret, fram…