March 2018
Beginner to intermediate
306 pages
9h 54m
English
In order to complete this recipe, you need to perform the following steps:
import cv2
img = cv2.imread('../data/scenetext01.jpg')
det = cv2.text.TextDetectorCNN_create( "../data/textbox.prototxt", "../data/TextBoxes_icdar13.caffemodel")rects, probs = det.detect(img)
THR = 0.3for i, r in enumerate(rects): if probs[i] > THR: cv2.rectangle(img, (r[0], r[1]), (r[0]+r[2], r[1]+r[3]), (0, 255, 0), 2)
plt.figure(figsize=(10,8))plt.axis('off')plt.imshow(img[:,:,[2,1,0]])plt.tight_layout()plt.show()