개정판 6830e470
issue #480: fix diagonal prepare
Change-Id: Ibe7f36743d08ef3b4d3a0119848dd4a4a1e6094f
DTI_PID/DTI_PID/MainWindow.py | ||
---|---|---|
1720 | 1720 |
idx = 0 |
1721 | 1721 |
## |
1722 | 1722 |
smallContours = [] |
1723 |
minimumSize = docData.getConfigs('Filter', 'MinimumSize') |
|
1724 |
lineLengthConfigs = docData.getConfigs('Small Line Minimum Length', 'Min Length') |
|
1725 |
lineMinLength = int(lineLengthConfigs[0].value) if 1 == len(lineLengthConfigs) else 10 |
|
1723 | 1726 |
for contour in contours: |
1724 | 1727 |
[x, y, w, h] = cv2.boundingRect(contour) |
1725 | 1728 |
|
1726 | 1729 |
# remove too small one |
1727 |
minimumSize = docData.getConfigs('Filter', 'MinimumSize') |
|
1728 | 1730 |
if len(minimumSize) is 1: |
1729 | 1731 |
if (w * h < int(minimumSize[0].value) * int(minimumSize[0].value)): |
1730 | 1732 |
smallContours.append(contour) |
... | ... | |
1745 | 1747 |
epsilon = cv2.arcLength(contour, True)*0.001 |
1746 | 1748 |
approx = cv2.approxPolyDP(contour, epsilon, True) |
1747 | 1749 |
approx = [pt[0] for pt in approx] |
1748 |
resultStr, resultList = self.determineRemainObject(idx, contours, imgNot) |
|
1750 |
resultStr, resultList = self.determineRemainObject(idx, contours, imgNot, lineMinLength)
|
|
1749 | 1751 |
if resultStr == 'LineIndicator': |
1750 | 1752 |
item = QEngineeringUnknownItem(approx, 'True', resultList[0], resultList[1]) |
1751 | 1753 |
docData.lineIndicators.append(item) |
... | ... | |
1772 | 1774 |
message = 'error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno) |
1773 | 1775 |
self.addMessage.emit(MessageType.Error, message) |
1774 | 1776 |
|
1775 |
def determineRemainObject(self, idx, contours, imgNot): |
|
1777 |
def determineRemainObject(self, idx, contours, imgNot, lineMinLength):
|
|
1776 | 1778 |
''' |
1777 | 1779 |
@brief determine remain objects -> line no indicator, missing line or unknown |
1778 | 1780 |
@author euisung |
... | ... | |
1781 | 1783 |
''' |
1782 | 1784 |
import math |
1783 | 1785 |
[x, y, w, h] = cv2.boundingRect(contours[idx]) |
1786 |
if (w < lineMinLength or h < lineMinLength): |
|
1787 |
return ('Unknown', []) |
|
1784 | 1788 |
|
1785 | 1789 |
fLines = [] |
1786 | 1790 |
maxDifAngle = 3 |
... | ... | |
1839 | 1843 |
|
1840 | 1844 |
return ('Unknown', []) |
1841 | 1845 |
|
1842 |
def isMissingLine(w, h, fLines): |
|
1846 |
def isMissingLine(w, h, fLines, horLines, verLines, otherLines):
|
|
1843 | 1847 |
''' |
1844 | 1848 |
@brief determine lines that LineDetector can not catch |
1845 | 1849 |
@author euisung |
... | ... | |
1849 | 1853 |
|
1850 | 1854 |
def isLineNoIndicator(self, w, h, maxDifAngle, maxDifH, maxDifW, horLines, verLines, otherLines): |
1851 | 1855 |
''' |
1852 |
@brief determine remain objects -> line no indicator, missing line or unknown
|
|
1856 |
@brief determine line no indicator
|
|
1853 | 1857 |
@author euisung |
1854 | 1858 |
@date 2019.03.25 |
1855 | 1859 |
''' |
DTI_PID/DTI_PID/RecognitionDialog.py | ||
---|---|---|
479 | 479 |
message = 'error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno) |
480 | 480 |
worker.displayLog.emit(MessageType.Error, message) |
481 | 481 |
finally: |
482 |
listWidget.addItem('Finished line recognization')
|
|
482 |
listWidget.addItem('Finishing line recognization')
|
|
483 | 483 |
worker.finished.emit() |
484 | 484 |
|
485 | 485 |
''' |
내보내기 Unified diff