我将图像名称作为参数传递给此函数:
def main(imageName):
image = cv2.imread(imageName)
cv2.imshow('color_image', image)
gray_image = grey(image)
cv2.imshow("gray_image", gray_image)
cv2.waitKey(0)
clahe_image = clahe(gray_image,0)
cv2.imshow("clahe_image", clahe_image)
cv2.waitKey(0)
dst_img = denoise(clahe_image)
cv2.imshow("dst_img", dst_img)
cv2.waitKey(0)
binary_img = threshld(dst_img,0)
cv2.imshow("binary_img", binary_img)
cv2.waitKey(0)
skiw_img = deskew(binary_img)
cv2.imshow("skiw_img", skiw_img)
cv2.imwrite("skiw_img.png", skiw_img)
cv2.waitKey(0)
然后我得到了那个错误。但是当我执行它时没有参数
def main():
image = cv2.imread('e2nn.png')
cv2.imshow('color_image', image)
gray_image = grey(image)
cv2.imshow("gray_image", gray_image)
cv2.waitKey(0)
clahe_image = clahe(gray_image,0)
cv2.imshow("clahe_image", clahe_image)
cv2.waitKey(0)
dst_img = denoise(clahe_image)
cv2.imshow("dst_img", dst_img)
cv2.waitKey(0)
binary_img = threshld(dst_img,0)
cv2.imshow("binary_img", binary_img)
cv2.waitKey(0)
skiw_img = deskew(binary_img)
cv2.imshow("skiw_img", skiw_img)
cv2.imwrite("skiw_img.png", skiw_img)
cv2.waitKey(0)
我没有得到那个错误并且执行得很好。
答案 0 :(得分:1)
当没有图像(包含图像信息的数组)到达imshow()
函数时,会出现此错误。这是因为您的imread()
函数未返回所需的输出。常见错误包括:
'\home\username\Desktop'
chmod 777
并再次运行您的代码。请注意,建议将访问权限更改为更严格的内容。