files2 = [f for f in listdir(dstpath) if isfile(join(dstpath,f))]
for image in files2:
img = cv2.imread(os.path.join(dstpath,image))
equ = cv2.equalizeHist(img)
dstPath2 = join(dstpath,image)
cv2.imwrite(dstPath2,equ)
我有jpg格式,包括灰度圖像的文件夾,但是當我跑我上面的代碼對於直方圖均衡,它給了我上面提到的錯誤。請幫助histogram.cpp:3915:錯誤:(-215)_src.type()== CV_8UC1在功能簡歷:: equalizeHist
請參見[如何提問](https://stackoverflow.com/help/how-詢問)並相應地編輯問題。其中一部分就是給出一個可以理解的標題,並在問題主體中包含完整的追溯。 – roganjosh
使用年度調試工具驗證圖像是否已加載。 – flamelite