在从表中提取行后,我将倒置的二值化图像保存为png(使用opencv)。现在,当我尝试用opencv或matplotlib加载它们时,它将在标题中显示NoneType或错误。我检查过许多不同的帖子,都有相同的错误。我想这和图像数据有关
import cv2
import matplotlib.pyplot as plt
imgs = cv2.imread('Users/marius/Desktop/PDF/imgvh/1.png')
cv2.imshow('Users/marius/Desktop/PDF/imgvh/1.png', imgs)
使用cv2时发生的错误:
cv2.error: OpenCV(4.2.0) /Users/travis/build/skvark/opencv-python/opencv/modules/highgui/src/window.cpp:376: error: (-215:Assertion failed) size.width>0 && size.height>0 in function 'imshow'
以这种方式使用matplotlib:
imgs = plt.imshow('Users/marius/Desktop/PDF/imgvh/1.png')
plt.show()
导致以下错误:
TypeError: Image data of dtype <U49 cannot be converted to float
OpenCV部分不起作用,因为您忽略了
Users/marius...
前面路径开头的斜杠。应该是:matplotlib零件不工作,因为它应该是:
相关问题 更多 >
编程相关推荐