• 大小: 502KB
    文件类型: .zip
    金币: 2
    下载: 1 次
    发布日期: 2021-06-09
  • 语言: Python
  • 标签: Python  

资源简介

利用opencv的简易Python文字识别demo,可能有点小问题,随后会优化

资源截图

代码片段和文件信息

from simpleocr.files import open_img
from simpleocr.segmentation import ContourSegmenter
from simpleocr.feature_extraction import SimpleFeatureExtractor
from simpleocr.classification import KNNClassifier
from simpleocr.ocr import OCR accuracy show_differences

segmenter = ContourSegmenter(blur_y=5 blur_x=5 block_size=11 c=10)
extractor = SimpleFeatureExtractor(feature_size=10 stretch=False)
classifier = KNNClassifier()
ocr = OCR(segmenter extractor classifier)

ocr.train(open_img(‘digits1‘))

test_image = open_img(‘digits2‘)
test_chars test_classes test_segments = ocr.ocr(test_image show_steps=True)

print(“accuracy:“ accuracy(test_image.ground.classes test_classes))
print(“OCRed text:\n“ test_chars)

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2017-09-16 14:51  simple-ocr-opencv-master\
     文件        1174  2017-09-16 14:51  simple-ocr-opencv-master\.gitignore
     文件         272  2017-09-16 14:51  simple-ocr-opencv-master\.travis.yml
     文件          29  2017-09-16 14:51  simple-ocr-opencv-master\AUTHORS
     文件       34520  2017-09-16 14:51  simple-ocr-opencv-master\LICENSE
     文件          85  2017-09-16 14:51  simple-ocr-opencv-master\MANIFEST.in
     文件        3205  2017-09-16 14:51  simple-ocr-opencv-master\README.md
     文件         724  2017-09-16 14:51  simple-ocr-opencv-master\example.py
     文件         387  2017-09-16 14:51  simple-ocr-opencv-master\example_grounding.py
     文件         776  2017-09-16 14:51  simple-ocr-opencv-master\setup.py
     目录           0  2017-09-16 14:51  simple-ocr-opencv-master\simpleocr\
     文件        2171  2017-09-16 14:51  simple-ocr-opencv-master\simpleocr\__init__.py
     文件        2902  2017-09-16 14:51  simple-ocr-opencv-master\simpleocr\classification.py
     目录           0  2017-09-16 14:51  simple-ocr-opencv-master\simpleocr\data\
     文件        2176  2017-09-16 14:51  simple-ocr-opencv-master\simpleocr\data\digits1.box
     文件      147997  2017-09-16 14:51  simple-ocr-opencv-master\simpleocr\data\digits1.png
     文件        3931  2017-09-16 14:51  simple-ocr-opencv-master\simpleocr\data\digits2.box
     文件      310624  2017-09-16 14:51  simple-ocr-opencv-master\simpleocr\data\digits2.png
     文件         814  2017-09-16 14:51  simple-ocr-opencv-master\simpleocr\data\unicode1.box
     文件       15501  2017-09-16 14:51  simple-ocr-opencv-master\simpleocr\data\unicode1.png
     文件        1736  2017-09-16 14:51  simple-ocr-opencv-master\simpleocr\feature_extraction.py
     文件        3081  2017-09-16 14:51  simple-ocr-opencv-master\simpleocr\files.py
     文件        4250  2017-09-16 14:51  simple-ocr-opencv-master\simpleocr\grounding.py
     文件        2904  2017-09-16 14:51  simple-ocr-opencv-master\simpleocr\improver.py
     文件        2172  2017-09-16 14:51  simple-ocr-opencv-master\simpleocr\numpy_utils.py
     文件        3975  2017-09-16 14:51  simple-ocr-opencv-master\simpleocr\ocr.py
     文件        4147  2017-09-16 14:51  simple-ocr-opencv-master\simpleocr\opencv_utils.py
     文件        5896  2017-09-16 14:51  simple-ocr-opencv-master\simpleocr\processor.py
     文件        3406  2017-09-16 14:51  simple-ocr-opencv-master\simpleocr\segmentation.py
     文件        5552  2017-09-16 14:51  simple-ocr-opencv-master\simpleocr\segmentation_aux.py
     文件        3204  2017-09-16 14:51  simple-ocr-opencv-master\simpleocr\segmentation_filters.py
............此处省略7个文件信息

评论

共有 条评论