개정판 6d46bd8c
- Rename LineProperty(UNIT NUMBER > Unit No, P&ID NUMBER -> P&ID No) Remove not used codes
DTI_PID/DTI_PID/DTI_PID.py | ||
---|---|---|
197 | 197 |
|
198 | 198 |
return float((w * h)) / float((tw * th)) * 100 |
199 | 199 |
|
200 |
def getSplitSrcList(srcPid, splitCount, splitWidth, splitHeight): |
|
201 |
splitRoiList = [] |
|
202 |
for hi in range(splitCount): |
|
203 |
for wi in range(splitCount): |
|
204 |
roiSp = (splitWidth*wi, splitHeight*hi) |
|
205 |
roiEp = (splitWidth*(wi+1), splitHeight*(hi+1)) |
|
206 |
splitRoiList.append((roiSp, roiEp, srcPid[roiSp[1]:roiEp[1], roiSp[0]:roiEp[0]])) |
|
207 |
return splitRoiList |
|
208 |
|
|
209 | 200 |
''' |
210 | 201 |
@history 2018.06.12 Jeongwoo Type changed (int → float) |
211 | 202 |
humkyung 2018.07.07 change return type as like [x,y] |
... | ... | |
428 | 419 |
searchedItemSp = (roiItemSp[0]+pt[0] + round(offsetDrawingArea[0]), roiItemSp[1]+pt[1] + round(offsetDrawingArea[1])) |
429 | 420 |
|
430 | 421 |
for i in range(len(searchedSymbolList)): |
422 |
_pt = searchedSymbolList[i].getSp() |
|
423 |
rect = QRectF(_pt[0], _pt[1], searchedSymbolList[i].getWidth(), searchedSymbolList[i].getHeight()) |
|
424 |
_rect = QRectF(searchedItemSp[0], searchedItemSp[1], sw, sh) |
|
425 |
if rect.intersects(_rect): |
|
426 |
intersect = rect.intersected(_rect) |
|
427 |
overlapArea = intersect.width()*intersect.height() |
|
428 |
if overlapArea > ACCEPT_OVERLAY_AREA: |
|
429 |
symbolIndex = i |
|
430 |
break |
|
431 |
|
|
432 |
''' |
|
431 | 433 |
overlapArea = contains(searchedSymbolList[i], searchedItemSp, sw, sh) |
432 | 434 |
if overlapArea > ACCEPT_OVERLAY_AREA: |
433 | 435 |
symbolIndex = i |
434 | 436 |
break |
437 |
''' |
|
435 | 438 |
|
436 | 439 |
hitRate = tmRes[pt[1], pt[0]] |
437 | 440 |
## DEBUG |
... | ... | |
599 | 602 |
if rect.intersects(_rect): |
600 | 603 |
intersect = rect.intersected(_rect) |
601 | 604 |
overlapArea = intersect.width()*intersect.height() |
602 |
print('overlapArea = {}'.format(overlapArea)) |
|
603 | 605 |
if overlapArea > ACCEPT_OVERLAY_AREA: |
604 | 606 |
symbolIndex = i |
605 | 607 |
break |
... | ... | |
875 | 877 |
imgOCR = cv2.threshold(cvtGrayImage(imgOCR), 127, 255, cv2.THRESH_BINARY)[1] |
876 | 878 |
|
877 | 879 |
# get unit no. |
878 |
''' |
|
879 | 880 |
area = appDocData.getArea('Unit') |
880 | 881 |
if area is not None: |
881 |
img = srcGray[area.y:area.y+area.height, area.x:area.x+area.width]
|
|
882 |
img = srcGray[round(area.y):round(area.y+area.height), round(area.x):round(area.x+area.width)]
|
|
882 | 883 |
text = TOCR.getTextInfo(img, (area.x, area.y), 0) |
883 | 884 |
if text is not None: |
884 | 885 |
appDocData.activeDrawing.setAttr('Unit', text[0].getText()) |
885 |
''' |
|
886 | 886 |
# up to here |
887 | 887 |
|
888 | 888 |
global MIN_TEXT_SIZE |
DTI_PID/DTI_PID/TextItemFactory.py | ||
---|---|---|
103 | 103 |
loopList = fluidCodeList |
104 | 104 |
isTable = True |
105 | 105 |
#DB Table: |
106 |
elif i == 'UNIT NUMBER':
|
|
106 |
elif i == 'Unit No':
|
|
107 | 107 |
pass |
108 | 108 |
#DB Table: |
109 |
elif i == 'P&ID NUMBER':
|
|
109 |
elif i == 'P&ID No':
|
|
110 | 110 |
pass |
111 | 111 |
#Number |
112 | 112 |
elif i == 'Tag Seq No': |
... | ... | |
123 | 123 |
else: |
124 | 124 |
return (False,) |
125 | 125 |
|
126 |
|
|
127 | 126 |
if isTable: |
128 | 127 |
find = False |
129 | 128 |
for loop in loopList: |
... | ... | |
222 | 221 |
except Exception as ex: |
223 | 222 |
print('error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno)) |
224 | 223 |
|
225 |
|
|
226 | 224 |
''' |
227 | 225 |
@brief Check if given text is Note No Text (ex : NOTE 1, NOTE 2, ...) |
228 | 226 |
@author Jeongwoo |
내보내기 Unified diff