프로젝트

일반

사용자정보

개정판 ef8dfda1

IDef8dfda1532cb9dd7e85e020b07faeccd4575cab
상위 d5411b35
하위 feee472b

함의성이(가) 약 5년 전에 추가함

issue #663: fix recognition image management

Change-Id: Ia047410e981cfdefebb946ddce8e771c12e82229

차이점 보기:

DTI_PID/DTI_PID/RecognitionDialog.py
832 832
                        continue
833 833

  
834 834
                    #cv2.imwrite('c:\\temp\\before-imgSrc.png', area.img)
835
                    # save original image before remove symbol
836
                    worker.copy_imgSrc = app_doc_data.imgSrc.copy()
835 837
                    searchedTextSymList = []
836 838
                    for sym in searchedSymbolList:
837 839
                        Worker.remove_detected_symbol_image(sym, app_doc_data.imgSrc)
......
1003 1005
                worker.updateBatchProgress.emit(len(srcList), 2)
1004 1006

  
1005 1007
                # check symbol validate
1006
                valid_sym = []
1008
                #valid_sym = []
1007 1009
                for index in reversed(range(len(searchedTextSymList))):
1008 1010
                    sym_xmin = searchedTextSymList[index].getSp()[0]
1009 1011
                    sym_ymin = searchedTextSymList[index].getSp()[1]
......
1016 1018
                        if sym_xmin < info_center[0] < sym_xmax and info_center[1] > sym_ymin and \
1017 1019
                                info_center[1] < sym_ymax:
1018 1020
                            valid += 1
1019
                            if valid >= valid_count:
1020
                                valid_sym.append(searchedTextSymList[index])
1021
                                break
1021
                            break
1022
                            #if valid >= valid_count:
1023
                            #    valid_sym.append(searchedTextSymList[index])
1024
                            #    break
1022 1025
                    if valid < valid_count:
1023 1026
                        searchedSymbolList.pop(searchedSymbolList.index(searchedTextSymList[index]))
1024 1027

  
1025
                pool = futures.ThreadPoolExecutor(max_workers=THREAD_MAX_WORKER)
1026
                for sym in valid_sym:
1027
                    pool.submit(Worker.remove_detected_symbol_image, sym, app_doc_data.imgSrc)
1028
                pool.shutdown(wait=True)
1028
                # roll back because invalidated symbol was deleted for text detection
1029
                app_doc_data.imgSrc = worker.copy_imgSrc
1030

  
1031
                for sym in searchedSymbolList:
1032
                        Worker.remove_detected_symbol_image(sym, app_doc_data.imgSrc)
1033
                #pool = futures.ThreadPoolExecutor(max_workers=THREAD_MAX_WORKER)
1034
                #for sym in valid_sym:
1035
                #    pool.submit(Worker.remove_detected_symbol_image, sym, app_doc_data.imgSrc)
1036
                #pool.shutdown(wait=True)
1029 1037
                # up to here
1030 1038

  
1031 1039
                # remove text from image
1032
                textDetector.remove_text_from_image(app_doc_data.imgSrc, offset)
1040
                textDetector.remove_text_from_image(app_doc_data.imgSrc, [0, 0])
1041
                #textDetector.remove_text_from_image(area.img, offset)
1033 1042
                if not worker.isTextChecked:
1034 1043
                    textInfoList.clear()
1035 1044
                # up to here
......
1108 1117
                # up to here
1109 1118

  
1110 1119
                listWidget.addItem('Connecting lines')
1111
                area = app_doc_data.getArea('Drawing')
1112
                detector = LineDetector(area.img)
1120
                #area = app_doc_data.getArea('Drawing')
1121
                detector = LineDetector(app_doc_data.imgSrc)
1113 1122
                symbols = app_doc_data.symbols
1114 1123
                configs = app_doc_data.getConfigs('Line Detector', 'Length to connect line')
1115 1124
                toler = int(configs[0].value) if configs else 20
......
1232 1241
            connectedLines = []
1233 1242

  
1234 1243
            area = app_doc_data.getArea('Drawing')
1244
            if area is not None:
1245
                area.img = app_doc_data.imgSrc[round(area.y + 1):round(area.y + area.height),
1246
                            round(area.x + 1):round(area.x + area.width)]
1235 1247
            area.img = worker.remove_small_objects(area.img)
1236 1248
            detector = LineDetector(area.img)
1237 1249

  

내보내기 Unified diff

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