OpenCV 3 Computer Vision with Python Cookbook by Alexey Spizhevoy & Aleksandr Rybnikov

OpenCV 3 Computer Vision with Python Cookbook by Alexey Spizhevoy & Aleksandr Rybnikov

Author:Alexey Spizhevoy & Aleksandr Rybnikov
Language: eng
Format: epub
Tags: COM051360 - COMPUTERS / Programming Languages / Python, COM060090 - COMPUTERS / Internet / Application Development, COM060080 - COMPUTERS / Web / General
Publisher: Packt Publishing
Published: 2018-03-23T08:49:47+00:00


import cv2

Load the text image:

img = cv2.imread('../data/scenetext01.jpg')

Load the pre-trained convolutional neural network and detect the text messages:

det = cv2.text.TextDetectorCNN_create(

"../data/textbox.prototxt", "../data/TextBoxes_icdar13.caffemodel")

rects, probs = det.detect(img)

Draw the detected text bounding boxes with confidences higher than the threshold:

THR = 0.3

for 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)

Visualize the results:



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.