개정판 a5003140
revised #577: Equipment Desc. 영역 설정
DTI_PID/DTI_PID/DTI_PID.py | ||
---|---|---|
850 | 850 |
Jeongwoo 2018.06.21 If noteTextInfoList is None, change from None to empty list |
851 | 851 |
''' |
852 | 852 |
def executeRecognition(signal, updateProgressSignal, path, listWidget, isSymbolTextChecked): |
853 |
import re |
|
854 |
|
|
853 | 855 |
global src |
854 | 856 |
global srcGray |
855 | 857 |
global ocrCompletedSrc |
... | ... | |
892 | 894 |
srcGray = src.copy() |
893 | 895 |
srcGray = cv2.threshold(srcGray, 127, 255, cv2.THRESH_BINARY)[1] |
894 | 896 |
|
897 |
# remove equipment desc. area |
|
898 |
configs = docData.getConfigs('{} Equipment Desc Area'.format(docData.imgName)) |
|
899 |
for config in configs: |
|
900 |
found = re.findall('\d+', config.value) |
|
901 |
if len(found) == 4: |
|
902 |
cv2.rectangle(srcGray, (int(found[0]), int(found[1])), (int(found[2]), int(found[3])), 255, -1) |
|
903 |
# up to here |
|
904 |
|
|
895 | 905 |
area = docData.getArea('Drawing') |
896 | 906 |
if area is not None: |
897 |
#TODO: 영역을 설정한 값과 이미지 좌표계를 차이를 보정 |
|
898 | 907 |
area.img = srcGray[round(area.y):round(area.y+area.height), round(area.x):round(area.x+area.width)] |
899 | 908 |
|
900 | 909 |
listWidget.addItem("Start recognition : " + mainRes) |
... | ... | |
1105 | 1114 |
@date 2018.06.11 |
1106 | 1115 |
''' |
1107 | 1116 |
def getDifference(orgImagePath, recImagePath): |
1117 |
import re |
|
1118 |
|
|
1108 | 1119 |
global srcGray |
1109 | 1120 |
global ocrCompletedSrc |
1110 | 1121 |
global textInfoList |
1111 | 1122 |
global noteTextInfoList |
1112 | 1123 |
|
1113 | 1124 |
try: |
1125 |
docData = AppDocData.instance() |
|
1114 | 1126 |
if os.path.isfile(orgImagePath) and os.path.isfile(recImagePath): |
1115 | 1127 |
imgOriginal = cv2.threshold(cvtGrayImage(cv2.imread(orgImagePath, 1)), 127, 255, cv2.THRESH_BINARY)[1] |
1128 |
# remove equipment desc. area |
|
1129 |
configs = docData.getConfigs('{} Equipment Desc Area'.format(docData.imgName)) |
|
1130 |
for config in configs: |
|
1131 |
found = re.findall('\d+', config.value) |
|
1132 |
if len(found) == 4: |
|
1133 |
cv2.rectangle(imgOriginal, (int(found[0]), int(found[1])), (int(found[2]), int(found[3])), 255, -1) |
|
1134 |
# up to here |
|
1135 |
|
|
1116 | 1136 |
imgRecognized = cv2.threshold(cvtGrayImage(cv2.imread(recImagePath, 1)), 127, 255, cv2.THRESH_BINARY)[1] |
1117 | 1137 |
|
1118 | 1138 |
imgDiff = np.ones(imgOriginal.shape, np.uint8)*255 |
내보내기 Unified diff