首先下载 opencv 3.4 的python 包:

opencv_python-3.4.1-cp36-cp36m-win_amd64.whl , 从这里: https://www.lfd.uci.edu/~gohlke/pythonlibs/#opencv

然后在控制台里安装这个包:

python -mpip install opencv_python-3.4.1-cp36-cp36m-win_amd64.whl

测试一下是否可行:

import cv2
import matplotlib.pyplot as plt

img = cv2.imread('fig/sinx.png',0)
r ,  thr = cv2.threshold( img , 200 , 255 , cv2.THRESH_BINARY ) 

plt.imshow( thr , 'gray')

plt.show()


#cv2.imshow("1" , thr ) 
#cv2.waitKey(0)
#cv2.destroyAllWindows()

sinx.png 如下:

python 3.6 使用 opencv 3.4 做图像二值化和显示

相关文章:

  • 2022-12-23
  • 2021-10-18
  • 2021-11-14
  • 2021-10-12
  • 2021-07-22
  • 2021-05-20
猜你喜欢
  • 2021-11-03
  • 2022-12-23
  • 2022-12-23
  • 2021-09-30
  • 2021-11-01
  • 2021-11-01
  • 2021-11-03
相关资源
相似解决方案