개정판 31b6fae5
DTI_PID.py import 정리
DTI_PID/DTI_PID/DTI_PID.py | ||
---|---|---|
3 | 3 |
import urllib, base64, json |
4 | 4 |
import cv2 |
5 | 5 |
import numpy as np |
6 |
import matplotlib.pyplot as plt |
|
7 |
import matplotlib.image as mpimg |
|
8 | 6 |
import SymbolBase |
9 | 7 |
import symbol |
10 | 8 |
import TextInfo as ti |
11 | 9 |
import azure_ocr_module as OCR |
12 |
import azure_handwrite_ocr_module as HOCR |
|
13 |
import imutils |
|
14 | 10 |
from PIL import Image |
15 |
from PIL import ImageTk |
|
16 |
from PIL import ImageChops |
|
17 | 11 |
from io import BytesIO |
18 |
from functools import partial |
|
19 |
from functools import reduce |
|
20 | 12 |
import gc |
21 | 13 |
import os |
22 | 14 |
import glob |
23 | 15 |
import timeit |
24 |
import scipy |
|
25 | 16 |
import math, operator |
26 | 17 |
import threading |
27 | 18 |
import concurrent.futures as futures |
28 | 19 |
import XmlGenerator as xg |
29 |
import sqlite3 |
|
30 | 20 |
import pytesseract |
31 | 21 |
import tesseract_ocr_module as TOCR |
32 | 22 |
import potrace |
... | ... | |
617 | 607 |
im = Image.fromarray(bitImg) |
618 | 608 | |
619 | 609 |
ocrData = pytesseract.image_to_boxes(im, config='-c tessedit_char_whitelist="-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ" -psm 6') |
620 |
#ocrData = pytesseract.image_to_data(im) |
|
621 |
#ocrData = pytesseract.image_to_string(im, config = "hocr") |
|
622 |
#listWidget.addItem("tesseract result : \n" + ocrData) |
|
623 | ||
624 |
### For image_to_data() |
|
625 |
#if ocrData: |
|
626 |
# splitOcrData = ocrData.split('\n') |
|
627 |
# size = len(splitOcrData) |
|
628 |
# i = 1 |
|
629 |
# while i < size: |
|
630 |
# data = splitOcrData[i] |
|
631 |
# threadLock.acquire() |
|
632 |
# sData = data.split('\t') |
|
633 |
# if len(sData) == 12: |
|
634 |
# text = sData[11] |
|
635 |
# tx = int(sData[6]) // 2 |
|
636 |
# ty = int(sData[7]) // 2 |
|
637 |
# tw = int(sData[8]) // 2 |
|
638 |
# th = int(sData[9]) // 2 |
|
639 |
# realSp = (symbolSp[0]+tx, symbolSp[1]+ty) |
|
640 |
# cv2.putText(canvas, text, (realSp[0], realSp[1]+th), cv2.FONT_HERSHEY_SIMPLEX, 1, (0, 0, 0), 3) |
|
641 |
# threadLock.release() |
|
642 |
# i = i+1 |
|
643 | 610 | |
644 | 611 |
### For image_to_boxes() |
645 | 612 |
if ocrData: |
내보내기 Unified diff