Как распознать буквы слов с помощью Google TextRecognizer? - PullRequest
0 голосов
/ 05 июня 2019

Я использую OCR для моего приложения (https://github.com/CalamityDeadshot/DNAsec),, тема которого очень конкретна.
Мне нужно распознать слова, состоящие из символов "A", "T", "G", "C", "-", ",", "", но TextRecognizer может обнаруживать только слова, но не символы, и у него есть предопределенный словарный запас слов, поэтому он не распознает такие слова, как "ATGCGC".
Как я могу сделать это с TextRecognizer или какие библиотеки мне следует использовать вместо этого?
Спасибо.

В настоящее время я рисую распознанный текст в оверлейном холсте:

public void draw(Canvas canvas) {
    TextBlock text = mText;
    if (text == null) {
        return;
    }

    // Checking if the value is of my letters to draw a box around the word
    if (text.getValue().equals("A") ||
            text.getValue().equals("T") ||
            text.getValue().equals("G") ||
            text.getValue().equals("C")) {
        RectF rect = new RectF(text.getBoundingBox());
        rect.left = translateX(rect.left);
        rect.top = translateY(rect.top);
        rect.right = translateX(rect.right);
        rect.bottom = translateY(rect.bottom);
        canvas.drawRect(rect, sRectPaint);
    }



   //  Checking if the value is of my letters to draw recognized text
    List<? extends Text> textComponents = text.getComponents();
    for(Text currentText : textComponents) {
        if (currentText.getValue().equals("A") ||
                currentText.getValue().equals("T") ||
                currentText.getValue().equals("G") ||
                currentText.getValue().equals("C")) {
            float left = translateX(currentText.getBoundingBox().left);
            float bottom = translateY(currentText.getBoundingBox().bottom);
            canvas.drawText(currentText.getValue(), left, bottom, sTextPaint);
        }
    }
}
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...