标签:nbsp win 参考 rom extract 运行 ack sub style
在用plt.imshow和cv2.imshow显示同一幅图时可能会出现颜色差别很大的现象。这是因为:
opencv的接口使用BGR,而matplotlib.pyplot 则是RGB模式
import cv2 import numpy as np import matplotlib.pyplot as plt img = cv2.imread(‘lena_std.tif‘) b,g,r = cv2.split(img) img2 = cv2.merge([r,g,b]) plt.subplot(121);plt.imshow(img) plt.subplot(122);plt.imshow(img2) plt.show() cv2.imshow(‘bgr image‘,img) cv2.imshow(‘rgb image‘,img2) cv2.waitKey(0) cv2.destroyAllWindows()
程序运行结果如下:
Matplotlib显示结果
OpenCV显示结果
参考资料:http://stackoverflow.com/questions/15072736/extracting-a-region-from-an-image-using-slicing-in-python-opencv/15074748#15074748
标签:nbsp win 参考 rom extract 运行 ack sub style
原文地址:https://www.cnblogs.com/Ph-one/p/12093193.html