Ask Your Question
0

OpenCV 3.0 text module - python export

asked 2015-10-11 15:35:13 -0500

rprevi gravatar image

Hi All, I would like to use the OpenCV 3.0 OCRTesseract class provided by the opencv_contrib text module. The class is C++ only, and it seems that it is not currently available as an exported Python Object, although the module text itself, as well as several enums, are correctly exported as "cv2.text".

Is it possible to call OCRTesseract by python, or does the interface is C++-only by design?

Best regards Roberto

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2016-01-25 20:54:11 -0500

mlennox gravatar image

Hi @rprevi

I have found that the OCR function bindings are only available in OpenCV 3.1.0. From my installation of OpenCV provided in this docker image : https://hub.docker.com/r/mlennox/dock...

Help on module cv2.text in cv2:

NAME
    cv2.text

FUNCTIONS
    OCRBeamSearchDecoder_create(...)
        OCRBeamSearchDecoder_create(classifier, vocabulary, transition_probabilities_table, emission_probabilities_table[, mode[, beam_size]]) -> retval

    OCRHMMDecoder_create(...)
        OCRHMMDecoder_create(classifier, vocabulary, transition_probabilities_table, emission_probabilities_table[, mode]) -> retval

    OCRTesseract_create(...)
        OCRTesseract_create([, datapath[, language[, char_whitelist[, oem[, psmode]]]]]) -> retval

    createOCRHMMTransitionsTable(...)
        createOCRHMMTransitionsTable(vocabulary, lexicon) -> retval

    loadOCRBeamSearchClassifierCNN(...)
        loadOCRBeamSearchClassifierCNN(filename) -> retval

    loadOCRHMMClassifierCNN(...)
        loadOCRHMMClassifierCNN(filename) -> retval

    loadOCRHMMClassifierNM(...)
        loadOCRHMMClassifierNM(filename) -> retval

DATA
    ERFILTER_NM_IHSGRAD = 1
    ERFILTER_NM_IHSGrad = 1
    ERFILTER_NM_RGBLGRAD = 0
    ERFILTER_NM_RGBLGrad = 0
    ERGROUPING_ORIENTATION_ANY = 1
    ERGROUPING_ORIENTATION_HORIZ = 0
    OCR_DECODER_VITERBI = 0
    OCR_LEVEL_TEXTLINE = 1
    OCR_LEVEL_WORD = 0

FILE
    (built-in)

I hope that helps

edit flag offensive delete link more

Comments

@mlennox, does this interface actually work? It almost seems more like a stubbed-out prototype then actaully functional code. If you have successfully called these functions, could you post some snippets of how to do so? I have been trying to replicate some of the functionality shown here: https://github.com/opencv/opencv_contrib/blob/master/modules/datasets/samples/tr_chars_benchmark.cpp (https://github.com/opencv/opencv_cont...). I have as of yet been unsuccessful. Thanks for any info! OpenCV 3.2.0, by the way.

sputnick1124 gravatar imagesputnick1124 ( 2017-03-20 15:28:44 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2015-10-11 15:35:13 -0500

Seen: 724 times

Last updated: Oct 11 '15