프로젝트

일반

사용자정보

개정판 5dcaeba9

ID5dcaeba97b7e8cdd233f1f43eecab152738962e1
상위 8cc915e9
하위 98d0af30

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

issue #506: fix text edit and short text and LineNoTracer on going

Change-Id: I5cb546fc73939c94bfa4cf62346ab5d7e92ea11c

차이점 보기:

DTI_PID/DTI_PID/LineNoTracer.py
450 450
    import uuid
451 451
    from LineNoTracer import LineNoTracer
452 452
    from AppDocData import AppDocData
453
    from EngineeringAbstractItem import QEngineeringAbstractItem
453 454
    from EngineeringSpecBreakItem import QEngineeringSpecBreakItem
454 455
    from EngineeringInstrumentItem import QEngineeringInstrumentItem
455 456
    from EngineeringReducerItem import QEngineeringReducerItem
......
471 472
    try:
472 473
        docdata = AppDocData.instance()
473 474
        worker.display_message.emit('Initializing...')
475

  
476
        ALL_ITEM = [item for item in worker.scene.items() if issubclass(type(item), QEngineeringAbstractItem)]
477
        for item in ALL_ITEM:
478
            item.setVisible(False)
479
        QApplication.processEvents()
480

  
474 481
        symbols = []
475 482
        lines = docdata.lines
476 483
        lineNos = []
......
666 673
        for lineNo in lineNos:
667 674
            lineNo.EvaluatedEQ()
668 675

  
676
        ALL_ITEM = [item for item in worker.scene.items() if issubclass(type(item), QEngineeringAbstractItem)]
677
        for item in ALL_ITEM:
678
            item.setVisible(True)
679

  
669 680
    except Exception as ex:
670 681
        message = 'error occurred({}) in {}:{}'.format(repr(ex), sys.exc_info()[-1].tb_frame.f_code.co_filename,
671 682
                                                       sys.exc_info()[-1].tb_lineno)
DTI_PID/DTI_PID/tesseract_ocr_module.py
105 105

  
106 106
        im = Image.fromarray(img)
107 107
        # add padding to increase text recognition
108
        im = ImageOps.expand(im, border=thickness, fill='white')
109 108
        im = im.rotate(-angle, expand=True)
110 109
        imgWidth = im.width
111 110
        imgHeight = im.height
111
        
112
        #long_img = None
113
        #if imgHeight / imgWidth > 0.5 and imgHeight < maxSize:
114
        #    long_img = Image.new('RGB', (imgWidth * 3, imgHeight), (255, 255, 255))
115
        #    long_img.paste(im, (0, 0))
116
        #    long_img.paste(im, (imgWidth, 0))
117
        #    long_img.paste(im, (imgWidth * 2, 0))
118
        #    im = long_img
119

  
120
        im = ImageOps.expand(im, border=thickness, fill='white')
121
        imgWidth = im.width
122
        imgHeight = im.height
123

  
112 124
        boundaryOcrData = pytesseract.image_to_boxes(im, config=_conf, lang=oCRLang)
125

  
113 126
        bounding_boxes = boundaryOcrData.split('\n')
114 127
        merged_boxes = []
115 128

  
......
155 168
            if cropped.width == 0 or cropped.height == 0:
156 169
                continue
157 170
            text = pytesseract.image_to_string(cropped, config=_conf, lang=oCRLang)
171
            #if long_img:
172
            #    text = text[:int(len(text)/ 3)]
173
            #    rect = QRect(rect.left(), imgHeight - rect.bottom(), int((rect.width() - thickness)/ 3), rect.height())
174
            
158 175
            # skip if text is not allowed single character when text is one char
159 176
            if not text or (len(text) == 1 and text not in allowed_single_chars):
160 177
                continue
minorTools/xmlTextSearcher.py
3 3
def finder():
4 4
    print("finder start")
5 5
    
6
    targetText = ['<NAME>BLIND FLANGE</NAME>']
6
    targetText = ['²g']
7 7
    path = 'W:\ID2_Project\POSCO\Temp'
8 8

  
9 9
    print("target : " + str(len(targetText)))
......
45 45
def changer():
46 46
    print("changer start")
47 47
    
48
    originText = '150814'
49
    newText = '150B14'
50
    path = 'W:\ID2_Project\POSCO\Flange_fix'
48
    originText = 'kg/cm&#178;g'
49
    newText = ''
50
    path = 'W:\ID2_Project\POSCO\Temp'
51 51
    
52 52
    print("origin : " + originText)
53 53
    print("new : " + newText)

내보내기 Unified diff

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