首页 > 解决方案 > TextDetectorCNN_create 的问题

问题描述

我正在使用 python 3.7 运行 opencv 4.1.0 Windows 10 64 位。

我的代码是:

img = cv2.imread('C:/projects/kort/Hjerter/IMG_2383.jpg')

det = cv2.text.TextDetectorCNN_create("c:/projects/Caffe/textbox.prototxt", "c:/projects/Caffe/TextBoxes_icdar13.caffemodel")

rects, probs = det.detect(img)

这是我得到的错误(下)。有什么提示吗?

rects, probs = det.detect(img)

Traceback(最近一次调用最后一次):文件“”,第 1 行,在 cv2.error: OpenCV(4.1.0) C:\projects\opencv-python\opencv_contrib\modules\text\src\text_detectorCNN.cpp:66: 错误: (-2:Unspecified error) in function 'void cdecl cv::text::TextDetectorCNNImpl::detect(const class cv::InputArray &,class std::vector > &,class std::vector &)' (预期: 'inputImage.channels() == inputChannelCount_'),其中 'inputImage_.channels()' 为 1 必须等于 'inputChannelCount_' 为 3

标签: opencvocr

解决方案


推荐阅读