프로젝트

일반

사용자정보

개정판 686602e0

ID686602e0228ecf7230e0e5a375cd148be2094e8e
상위 f989c5f6
하위 a1865809

gaqhf 이(가) 약 5년 전에 추가함

dev issue #507 : fix bug

Change-Id: I8e8388d31923518455070f135ad5aa8b8aa40b3d

차이점 보기:

DTI_PID/DTI_PID/RecognitionDialog.py
306 306
                               round(area.x):round(area.x + area.width)]
307 307

  
308 308
                    _, area.mask = cv2.threshold(area.img, 0, 255, cv2.THRESH_BINARY + cv2.THRESH_OTSU)
309
                    """
309

  
310 310
                    # area.contours, area.hierarchy = cv2.findContours(mask, cv2.RETR_TREE, cv2.CHAIN_APPROX_NONE)
311
                    not_area = cv2.bitwise_not(area.img)
312
                    area.not_img = not_area
313
                    area_contours, area_hierachy = cv2.findContours(area.not_img, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE)
314
                    area.contours = area_contours
315
                    area.hierachy = area_hierachy
316
                    """
311
                    area.not_img = cv2.bitwise_not(area.img)
312
                    area.contours, area.hierachy = cv2.findContours(area.not_img, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE)
317 313

  
318 314
                maxProgressValue = 0
319 315
                listWidget.addItem("Start recognition : " + mainRes)
......
948 944
                                                                          sh, sow, soh)
949 945

  
950 946
                    # For OPC
951
                    if area is not None and (symbolType == "Piping OPC\'s" or symbolType == "Instrument OPC\'s"):
952
                        worker.detectOPCOnPid(area, symGray)
947
                    drawing_area = app_doc_data.getArea('Drawing')
948
                    if drawing_area is not None and (symbolType == "Piping OPC\'s" or symbolType == "Instrument OPC\'s"):
949
                        worker.detectOPCOnPid(drawing_area, symGray)
953 950

  
954 951
                    # Template Matching
955 952
                    tmRes = cv2.matchTemplate(roiItem, symGray, cv2.TM_CCOEFF_NORMED)
......
1119 1116
        return []
1120 1117

  
1121 1118
    @staticmethod
1122
    def detectOPCOnPid(area, symGray) -> None:
1123
        # symbol = cv2.copyMakeBorder(symGray, 1, 1, 1, 1, cv2.BORDER_CONSTANT, value=255)
1124
        # not_symbol = cv2.bitwise_not(symbol)
1125
        # symbol_contours, symbol_hierachy = cv2.findContours(not_symbol, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE)
1126
        # if symbol_hierachy[0][0][0] != -1:
1127
        #     return None
1119
    def detectOPCOnPid(area, symGray):
1120
        results = []
1121

  
1122
        # try:
1123
        #     symbol = cv2.copyMakeBorder(symGray, 1, 1, 1, 1, cv2.BORDER_CONSTANT, value=255)
1124
        #     not_symbol = cv2.bitwise_not(symbol)
1125
        #     symbol_contours, symbol_hierachy = cv2.findContours(not_symbol, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE)
1126
        #     if symbol_hierachy[0][0][0] != -1:
1127
        #         return results
1128 1128
        #
1129
        # results = []
1130
        # contour_count = len(symbol_contours)
1131
        # for i in range(1, contour_count):
1132
        #     symbol_area = cv2.contourArea(symbol_contours[i])
1129
        #     contour_count = len(symbol_contours)
1130
        #     for i in range(1, contour_count):
1131
        #         symbol_area = cv2.contourArea(symbol_contours[i])
1133 1132
        #
1134
        #     for contour in area.contours:
1135
        #         area_area = cv2.contourArea(contour)
1136
        #         if area_area * 1.2 >= symbol_area >= area_area * 0.8:
1137
        #             v1 = cv2.matchShapes(symbol_contours[i], contour, 1, 0)
1138
        #             v1 = cv2.matchShapes(symbol_contours[i], contour, 2, 0)
1139
        #             v1 = cv2.matchShapes(symbol_contours[i], contour, 3, 0)
1140
        #             # results.append()
1141
        #             continue
1142
        #     break
1143

  
1144
        return None
1133
        #         for contour in area.contours:
1134
        #             area_area = cv2.contourArea(contour)
1135
        #             if area_area * 1.2 >= symbol_area >= area_area * 0.8:
1136
        #                 I1 = cv2.matchShapes(symbol_contours[i], contour, 1, 0)
1137
        #                 I2 = cv2.matchShapes(symbol_contours[i], contour, 2, 0)
1138
        #                 I3 = cv2.matchShapes(symbol_contours[i], contour, 3, 0)
1139
        #                 if I1 < 1 and I2 < 1 and I3 < 0.1:
1140
        #                     rect = cv2.boundingRect(contour)
1141
        #                     results.append([0.8, [rect[0],rect[1]]])
1142
        #         break
1143
        # except Exception as ex:
1144
        #     message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename,
1145
        #                                                    sys.exc_info()[-1].tb_lineno)
1146
        #     a = 5
1147

  
1148
        return results
1145 1149

  
1146 1150
    '''
1147 1151
        @brief      detect nozzle
DTI_PID/SPPIDConverter/BaseModel/Document.cs
1095 1095
                                if (!VentDrainSymbol.Contains(symbol))
1096 1096
                                    VentDrainSymbol.Add(symbol);
1097 1097
                            }
1098
                            VentDrainLine.Add(lines[0]);
1098
                            if (!VentDrainLine.Contains(lines[0]))
1099
                                VentDrainLine.Add(lines[0]);
1099 1100
                        }
1100 1101
                    }
1101 1102
                }

내보내기 Unified diff

클립보드 이미지 추가 (최대 크기: 500 MB)