Error in TextDetectorCNN_create

asked 2019-05-20 10:23:06 -0600

updated 2019-05-20 10:26:06 -0600

berak gravatar image

Hi experts

I am running opencv 4.1.0 Windows 10 64 bit with python 3.7.

My code is:

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)

But I get the following error below. Any hints?

rects, probs = det.detect(img)
Traceback (most recent call last):
File "", line 1, in 
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 &,class std::vector<class cv::Rect,class std::allocator<class cv::Rect > > &,class std::vector<float,class std::allocator > &)'
(expected: 'inputImage.channels() == inputChannelCount_'), where
'inputImage_.channels()' is 1
must be equal to
'inputChannelCount_' is 3
edit retag flag offensive close merge delete

Comments

are you sure, your input image is valid ?

berak gravatar imageberak ( 2019-05-20 12:43:07 -0600 )edit