jupyter notebook oepncv 显示一张图像

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/w5688414/article/details/83660223

感想

我们在用jupyter notebook的时候,经常需要可视化一些东西,尤其是一些图像,我这里给个sample code

环境

opencv-python

matplotlib

numpy

sample

import os
import numpy as np
from matplotlib import pyplot as plt
%matplotlib inline
img_dir='/Users/eric/Documents/data/wheel_train_val/train/non_defect/'
filename='00005.BMP_block_8.jpg'
img = cv2.imread(img_dir +os.sep+ filename)
plt.imshow(img)
plt.show()

参考文献

[1]. opencv.imshow will cause jupyter notebook crash.  https://stackoverflow.com/questions/46236180/opencv-imshow-will-cause-jupyter-notebook-crash

猜你喜欢

转载自blog.csdn.net/w5688414/article/details/83660223