프로젝트

일반

사용자정보

개정판 824f1a2b

ID824f1a2ba93809b4bb488064964ecdcb229c8aed
상위 13759969
하위 42fbc5d6

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

issue #700: process check off

Change-Id: I4d139411680d48f1bf1c2fceb14442ca6b7a3cb6

차이점 보기:

DTI_PID/DTI_PID/TextDetector.py
47 47
                return self.getTextAreaInfo(img, offset[0], offset[1])
48 48
            else:
49 49
                # using craft
50
                return self.get_text_box_using_craft(img, offset[0], offset[1], web=True)
50
                local_info, _ = [], []#self.getTextAreaInfo(img, offset[0], offset[1])
51
                server_info, img = self.get_text_box_using_craft(img, offset[0], offset[1], web=True)
52
                
53
                min_area = sys.maxsize
54
                for info in server_info:
55
                    if info.area < min_area:
56
                        min_area = info.area
57
                min_area = min_area * 1.3
58

  
59
                for index in reversed(range(len(local_info))):
60
                    if local_info[index].area > min_area:
61
                        local_info.pop(index)
62

  
63
                return local_info + server_info, img
51 64

  
52 65
        except Exception as ex:
53 66
            from App import App
......
185 198
                               abs(x[1].height() - rect[1].height()) < (x[1].height() + rect[1].height())*0.5 and
186 199
                               abs(x[1].center().y() - rect[1].center().y()) < rect[1].height()*0.25 and
187 200
                               rectExpand.intersects(x[1])]
188
                else:               # y -direction text
201
                else:               # y-direction text
189 202
                    rectExpand = rect[1].adjusted(0, -mergeSize, 0, mergeSize)
190 203
                    matches = [x for x in rects if (x[0] == rect[0]) and
191 204
                               abs(x[1].width() - rect[1].width()) < (x[1].width() + rect[1].width())*0.5 and
......
644 657
            app_doc_data = AppDocData.instance()
645 658
            project = app_doc_data.getCurrentProject()
646 659

  
647
            text_info_array = np.array_split(tInfoList, App.THREAD_MAX_WORKER
648
                if len(tInfoList) > App.THREAD_MAX_WORKER else len(tInfoList))
649
            with futures.ThreadPoolExecutor(max_workers=App.THREAD_MAX_WORKER) as pool:
650
                future_text = {pool.submit(TextDetector.recognizeTextFromImage, tInfo, imgSrc, offset,
651
                                       searchedSymbolList, worker, listWidget, maxProgressValue):
652
                               tInfo for tInfo in text_info_array}
653

  
654
                for future in futures.as_completed(future_text):
655
                    try:
656
                        data = future.result()
657
                        if data:
658
                            self.textInfoList.extend(data)
659
                    except Exception as ex:
660
                        message = 'error occurred({}) in {}:{}'.format(repr(ex), sys.exc_info()[-1].tb_frame.f_code.co_filename,
660
            if len(tInfoList):
661
                text_info_array = np.array_split(tInfoList, App.THREAD_MAX_WORKER
662
                    if len(tInfoList) > App.THREAD_MAX_WORKER else len(tInfoList))
663
                with futures.ThreadPoolExecutor(max_workers=App.THREAD_MAX_WORKER) as pool:
664
                    future_text = {pool.submit(TextDetector.recognizeTextFromImage, tInfo, imgSrc, offset,
665
                                           searchedSymbolList, worker, listWidget, maxProgressValue):
666
                                   tInfo for tInfo in text_info_array}
667

  
668
                    for future in futures.as_completed(future_text):
669
                        try:
670
                            data = future.result()
671
                            if data:
672
                                self.textInfoList.extend(data)
673
                        except Exception as ex:
674
                            message = 'error occurred({}) in {}:{}'.format(repr(ex), sys.exc_info()[-1].tb_frame.f_code.co_filename,
661 675
                                                                       sys.exc_info()[-1].tb_lineno)
662
                        if worker:
663
                            worker.displayLog.emit(MessageType.Error, message)
676
                            if worker:
677
                                worker.displayLog.emit(MessageType.Error, message)
664 678

  
665 679
            if onlyTextArea:
666 680
                return

내보내기 Unified diff

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