简体   繁体   English

错误:如何修复“系统错误:<built-in function imshow> 在Opencv python中返回NULL而不设置错误”

[英]Error : How to fix "SystemError: <built-in function imshow> returned NULL without setting an error" in Opencv python

I am working on one project Data extraction from invoices using computer vision in this i am trying to extract data from image invoice using opencv and pytesseract and further i am using Regex for segregate that raw data into different parts like Date, Vendor name, Invoice number, item name and item quantity.at start i am trying to extract Date but stuck with error.我正在研究一个项目使用计算机视觉从发票中提取数据,我正在尝试使用 opencv 和 pytesseract 从图像发票中提取数据,并且我正在使用正则Regex将原始数据分离到不同的部分,如日期、供应商名称、发票编号,项目名称和项目数量。在开始时,我试图提取日期但遇到错误。

here is my code这是我的代码

import pytesseract
from pytesseract import Output
import cv2

img = cv2.imread('invoice.png')
d = pytesseract.image_to_data(img, output_type=Output.DICT)
n_boxes = len(d['level'])
for i in range(n_boxes):
    (x, y, w, h) = (d['left'][i], d['top'][i], d['width'][i], d['height'][i])
    img = cv2.rectangle(img, (x, y), (x + w, y + h), (0, 0, 255), 2)

cv2.imshow(img,'img')

but i get this error但我收到这个错误

File "testpdf3.py", line 12, in <module>
    cv2.imshow(img,'img')
SystemError: <built-in function imshow> returned NULL without setting an error

The syntax of cv2.imshow() is cv2.imshow("windowname", image) . cv2.imshow()的语法是cv2.imshow("windowname", image) In the program, line 12 should be cv2.imshow('img', img) .在程序中,第 12 行应该是cv2.imshow('img', img)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何修复“系统错误:<built-in function 'name'> 在 Python C 扩展中返回 NULL 而不设置错误” - How to fix "SystemError: <built-in function 'name'> returned NULL without setting an error" in Python C Extension Python 3.7.3 SystemError:错误返回,未设置异常 - Python 3.7.3 SystemError: error return without exception set Python中的多参数null cowellce和内置“or”函数 - Multi-argument null coalesce and built-in “or” function in Python cv2。错误:C:\\ projects \\ opencv-python \\ opencv \\ modules \\ highgui \\ src \\ window.cpp:325:错误:(-215)size.width&gt; 0 &amp;&amp; size.height&gt; 0在函数cv :: imshow中 - cv2.error: C:\projects\opencv-python\opencv\modules\highgui\src\window.cpp:325: error: (-215) size.width>0 && size.height>0 in function cv::imshow 我如何找到python内置函数实现? - How do I find python built-in function implementations? SystemError:使用请求和调试器时,无异常设置的错误返回 - SystemError: error return without exception set, when using requests and debugger Python内置运算符的函数句柄 - Function handle to a built-in operator in Python Python 3最小和最大内置函数 - Python 3 minimum and maximum built-in function OpenCV 错误:(-215:断言失败)size.width>0 && size.height>0 in function 'imshow' - OpenCV error: (-215:Assertion failed) size.width>0 && size.height>0 in function 'imshow' 如何更改内置类型()function? - How to change built-in type() function?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM