Ask Your Question
0

Code sample using TextDetectorCNN

asked 2018-06-29 04:33:51 -0600

brinx gravatar image

Is there an actual sample using TextDetectorCNN it seems that I cannot find any. How to implement this class?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2018-06-29 05:00:56 -0600

berak gravatar image

updated 2018-06-29 05:10:26 -0600

there is a c++ sample here , also docs and javadocs

assuming, you're using opencv3.x, and you have build opencv libs with the opencv_contrib repo,

download the model and the prototxt , then something similar to this:

TextDetector detector = TextDetectorCNN.create(prototxt, weights);

Mat image = ...
MatOfRect boxes = new MatOfRect();
MatOfFloat confidences = new MatOfFloat();
detector.detect(image, boxes, confidences);

float thresh = ???; // heuristic value
Rect[] rects = boxes.toArray();
float[] conf = confidences.toArray();
for (int i=0; i<rects.length; i++)
    if (conf[i] >= thresh)
        // assume rects[i] is valid

should get you started in java. good luck !

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2018-06-29 04:33:51 -0600

Seen: 1,237 times

Last updated: Jun 29 '18