개정판 de8b2c8e
issue #663: fix multiple detection
Change-Id: Iad11f5d1175e1f7331ffcc91a9fa4180ac696690
DTI_PID/DTI_PID/LineDetector.py | ||
---|---|---|
587 | 587 |
return [] |
588 | 588 |
|
589 | 589 |
smallContours = [] |
590 |
minimumSize = docData.getConfigs('Filter', 'MinimumSize') * 2
|
|
590 |
minimumSize = docData.getConfigs('Filter', 'MinimumSize') * 3
|
|
591 | 591 |
lineLengthConfigs = docData.getConfigs('Small Line Minimum Length', 'Min Length') |
592 | 592 |
lineMinLength = int(lineLengthConfigs[0].value) if 1 == len(lineLengthConfigs) else 30 |
593 | 593 |
for contour in contours: |
... | ... | |
603 | 603 |
edged = cv2.Canny(imgNotRemoveSmall, 100, 200) |
604 | 604 |
|
605 | 605 |
rate = 25 |
606 |
lines = cv2.HoughLinesP(image=edged, rho=1, theta=np.pi/180, threshold=rate, minLineLength=lineMinLength*2, maxLineGap=25)
|
|
606 |
lines = cv2.HoughLinesP(image=edged, rho=1, theta=np.pi/180, threshold=rate, minLineLength=lineMinLength*3, maxLineGap=25)
|
|
607 | 607 |
if lines is None: |
608 | 608 |
return [] |
609 | 609 |
|
DTI_PID/DTI_PID/RecognitionDialog.py | ||
---|---|---|
41 | 41 |
THREAD_MAX_WORKER = os.cpu_count() |
42 | 42 |
threadLock = threading.Lock() |
43 | 43 |
|
44 |
ACCEPT_OVERLAY_AREA = 10
|
|
44 |
ACCEPT_OVERLAY_AREA = 20
|
|
45 | 45 |
#endregion |
46 | 46 |
|
47 | 47 |
''' |
... | ... | |
706 | 706 |
|
707 | 707 |
overlapArea = 0 |
708 | 708 |
symbolIndex = -1 |
709 |
for i in range(len(searchedSymbolList)): |
|
709 |
for i in range(len(searchedSymbolList) - 1, -1, -1):
|
|
710 | 710 |
area = Worker.contains(searchedSymbolList[i], searchedItemSp, sw, sh) |
711 | 711 |
if area > ACCEPT_OVERLAY_AREA: |
712 |
if area > overlapArea: |
|
713 |
overlapArea = area |
|
714 |
symbolIndex = i |
|
712 |
#if area > overlapArea: |
|
713 |
# overlapArea = area |
|
714 |
# symbolIndex = i |
|
715 |
overlapArea = area |
|
716 |
symbolIndex = i |
|
717 |
break |
|
715 | 718 |
""" |
716 | 719 |
categories = [appDocData.isEquipmentType(symbolType), appDocData.isEquipmentType(searchedSymbolList[i].getType())] |
717 | 720 |
if categories[0] == categories[1]: |
... | ... | |
738 | 741 |
symbolHitRate = searchedSymbol.getHitRate() |
739 | 742 |
if symbolHitRate < hitRate: |
740 | 743 |
threadLock.acquire() |
744 |
# replace existing symbol with new symbol has high accuracy |
|
741 | 745 |
searchedSymbolList[symbolIndex] = symbol.Symbol(symbolName, symbolType , |
742 | 746 |
searchedItemSp, sw, sh, symbolThreshold, symbolMinMatchCount, hitRate, symbolRotatedAngle , |
743 | 747 |
isDetectOnOrigin, symbolRotateCount, symbolOcrOption, isContainChild , |
내보내기 Unified diff