前提・実現したいこと
pythonで画像中の文字の領域を検出したいです。
CNNを読み込むところでエラーが発生しました。
発生している問題・エラーメッセージ
error Traceback (most recent call last) <ipython-input-4-57dd41df7655> in <module>() 4 img = cv2.imread('train_1014378_0057.jpg',cv2.IMREAD_COLOR) 5 ----> 6 textSpotter = cv2.text.TextDetectorCNN_create("textbox.prototxt", "TextBoxes_icdar13.caffemodel") 7 thres = 0.6 8 vis = img.copy() error: OpenCV(4.1.0) C:\projects\opencv-python\opencv\modules\dnn\src\caffe\caffe_io.cpp:1121: error: (-2:Unspecified error) FAILED: fs.is_open(). Can't open "textbox.prototxt" in function 'cv::dnn::ReadProtoFromTextFile'
該当のソースコード
import cv2 import numpy as np img = cv2.imread('train_1014378_0057.jpg',cv2.IMREAD_COLOR) textSpotter = cv2.text.TextDetectorCNN_create("textbox.prototxt", "TextBoxes_icdar13.caffemodel") thres = 0.6 vis = img.copy() rects, outProbs = textSpotter.detect(img); for r in range(np.shape(rects)[0]): if outProbs[r] > thres: rect = rects[r] cv2.rectangle(vis, (rect[0],rect[1]), (rect[0] + rect[2], rect[1] + rect[3]), (255, 0, 0), 2) cv2.imshow('TextArea Detection', vis) cv2.imwrite('result.jpg',img)
原因がわかりません。ディレクトリに必要な物を置けていないのかと思いましたが、何が必要かもわからないのでご教授よろしくお願いいたします。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2020/01/24 13:16