我正在使用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)
回溯(最近通话最近): 文件“”,第1行,位于 cv2.error:OpenCV(4.1.0)C:\ projects \ opencv-python \ opencv_contrib \ modules \ text \ src \ text_detectorCNN.cpp:66:error:(-2:Unspecified error)in function'void cdecl cv :: text :: TextDetectorCNNImpl :: detect(const class cv :: InputArray&,std :: vector>&,class std :: vector&)' (预期:“ inputImage.channels()== inputChannelCount_”),其中 'inputImage_.channels()'为1 必须等于 “ inputChannelCount_”为3