!_src.empty() in function ‘cv::cvtColor‘

Posted Data+Science+Insight

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了!_src.empty() in function ‘cv::cvtColor‘相关的知识,希望对你有一定的参考价值。

!_src.empty() in function 'cv::cvtColor'

 

image = cv2.imread(args["image"])
rgb = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)

 

---------------------------------------------------------------------------
error                                     Traceback (most recent call last)
E:\\files\\ocr_test\\tesseract.py in <module>
     18 # and use Tesseract to localize each area of text in the input image
     19 image = cv2.imread(args["image"])
---> 20 rgb = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
     21 results = pytesseract.image_to_data(rgb, output_type=Output.DICT)
     22 

error: OpenCV(4.5.1) C:\\Users\\appveyor\\AppData\\Local\\Temp\\1\\pip-req-build-oduouqig\\opencv\\modules\\imgproc\\src\\color.cpp:182: error: (-215:Assertion failed) !_src.empty() in function 'cv::cvtColor'

 

确认你的文件后缀是否合法正确:

笔者遇到这个问题的原因是文件输成了

xxxxx.png.png

xxxx,png

xxxx.pnng

 

自己仔细核对下就知道了,,,,,

 

参考:opencv

参考:(-215:Assertion failed) !_src.empty() in function 'cv::cvtColor'

以上是关于!_src.empty() in function ‘cv::cvtColor‘的主要内容,如果未能解决你的问题,请参考以下文章

opencv_src.empty() in function ‘cvtColor‘

cv2.error: OpenCV(4.5.2) .error: (-215:Assertion failed) !_src.empty() in function 'cv::cvtColor'

opencv cv2.imread()报错: error: (-215:Assertion failed) !_src.empty() in function ‘cv::cvtColor‘

!_src.empty() 在函数 'cv::cvtColor' imgproc\src\color.cpp:182

javascript JS__var_in_function

php--------文件夹文件拷贝和复制