2017-04-27 31 views
0

我運行此命令AttributeError的: '模塊' 對象有沒有屬性 'popall'

python tes4.py 

,它會導致這個錯誤:

AttributeError: 'module' object has no attribute 'popall' 

我的計劃是這樣

import cv2 
import numpy as np 
from matplotlib import pyplot as plt 

gray_img = cv2.imread('lena.jpg', cv2.IMREAD_GRAYSCALE) 
cv2.imshow('GoldenGate',gray_img) 
#hist = cv2.calcHist([gray_img],[0],None,[256],[0,256]) 
hist,bins = np.histogram(gray_img,256,[0,256]) 

plt.hist(gray_img.ravel(),256,[0,256]) 
plt.title('Histogram for gray scale picture') 
plt.show() 

while True: 
    k = cv2.waitKey(0) & 0xFF  
    if k == 27: break    # ESC key to exit 
cv2.destroyAllWindows() 

我該怎麼辦??

回答

相關問題