프로젝트

일반

사용자정보

개정판 f3635f2b

IDf3635f2b1b39842ba6ce6084b4054f28523ce33a
상위 d8a53b03
하위 2f0e18ee

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

dev issue #507 : detectOPCOnPid

Change-Id: I2577d16d23a3df4d9304aa061dc71dff12407735

차이점 보기:

DTI_PID/DTI_PID/RecognitionDialog.py
304 304
                if area is not None:
305 305
                    area.img = app_doc_data.imgSrc[round(area.y):round(area.y + area.height),
306 306
                               round(area.x):round(area.x + area.width)]
307
                    not_area = cv2.bitwise_not(area.img)
308
                    area.not_img = not_area
309
                    area_contours, area_hierachy = cv2.findContours(area.not_img , cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE)
310
                    area.contours = area_contours
311
                    area.hierachy = area_hierachy
307 312

  
308 313
                maxProgressValue = 0
309 314
                listWidget.addItem("Start recognition : " + mainRes)
......
914 919
                                                                          sh, sow, soh)
915 920

  
916 921
                    ## For OPC
917
                    if symbolType == "Piping OPC\'s" or symbolType == "Instrument OPC\'s":
918
                        worker.detectOPCOnPid(roiItem, symGray)
922
                    if area is not None and (symbolType == "Piping OPC\'s" or symbolType == "Instrument OPC\'s"):
923
                        worker.detectOPCOnPid(area, symGray)
919 924

  
920 925
                    ## Template Matching
921 926
                    tmRes = cv2.matchTemplate(roiItem, symGray, cv2.TM_CCOEFF_NORMED)
......
1072 1077
        return []
1073 1078

  
1074 1079
    @staticmethod
1075
    def detectOPCOnPid(src, symGray):
1076
        not_src = cv2.bitwise_not(src)
1077
        symbol = cv2.copyMakeBorder(symGray, 1, 1, 1, 1, cv2.BORDER_CONSTANT, value=255)
1078
        not_symbol = cv2.bitwise_not(symbol)
1079
        symbol_contours, symbol_hierachy = cv2.findContours(not_symbol, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE)
1080
        if symbol_hierachy[0][0][0] != -1:
1081
            return None
1082

  
1083
        return
1080
    def detectOPCOnPid(area, symGray):
1081
        # symbol = cv2.copyMakeBorder(symGray, 1, 1, 1, 1, cv2.BORDER_CONSTANT, value=255)
1082
        # not_symbol = cv2.bitwise_not(symbol)
1083
        # symbol_contours, symbol_hierachy = cv2.findContours(not_symbol, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE)
1084
        # if symbol_hierachy[0][0][0] != -1:
1085
        #     return None
1086
        #
1087
        # results = []
1088
        # contour_count = len(symbol_contours)
1089
        # for i in range(1, contour_count):
1090
        #     symbol_area = cv2.contourArea(symbol_contours[i])
1091
        #
1092
        #     for contour in area.contours:
1093
        #         area_area = cv2.contourArea(contour)
1094
        #         if area_area * 1.3 >= symbol_area >= area_area * 0.7:
1095
        #             cv2.matchShape(symbol_contours[i], contour, )
1096
        #             results.append()
1097
        # 
1098
        #     break
1099

  
1100
        return results
1084 1101

  
1085 1102
    '''
1086 1103
        @brief      detect nozzle

내보내기 Unified diff

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