-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Nikita Shevtsov <[email protected]>
- Loading branch information
Showing
5 changed files
with
48 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
0.2 | ||
0.2.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import os.path | ||
import unittest | ||
|
||
import cv2 | ||
|
||
from dedocutils.text_detection import DoctrTextDetector | ||
from dedocutils.text_recognition import TesseractTextRecognizer | ||
|
||
|
||
class TestTextRecognizer(unittest.TestCase): | ||
@unittest.skip | ||
def test_tesseract_recognize(self) -> None: | ||
file_path = os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "data", "document_example.png")) | ||
text_recognizer = TesseractTextRecognizer() | ||
text = text_recognizer.recognize(cv2.imread(file_path)) | ||
self.assertIn("Document example", text) | ||
|
||
@unittest.skip | ||
def test_tesseract_recognize_bboxes(self) -> None: | ||
file_path = os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "data", "document_example.png")) | ||
|
||
text_detector = DoctrTextDetector() | ||
text_recognizer = TesseractTextRecognizer() | ||
|
||
img = cv2.imread(file_path) | ||
bboxes = text_detector.detect(img) | ||
texts = text_recognizer.recognize_bboxes(img, bboxes) | ||
self.assertEquals("Document", texts[-1]) |