프로젝트

일반

사용자정보

개정판 730e6a4f

ID730e6a4fe36cf3c5e609fdd62c157e94e6f300ac
상위 17345074
하위 59f71a7a

humkyung 이(가) 약 7년 전에 추가함

Add Splitter widget

차이점 보기:

DTI_PID/DTI_PID/App.py
309 309
                if symbol.find('CONNECTIONPOINT').text is not None:
310 310
                    connPts = [(float(x.split(',')[0]), float(x.split(',')[1])) for x in symbol.find('CONNECTIONPOINT').text.split('/')]
311 311
                
312
                if 'GATE VALVE WITH PLUG' != name: continue
313 312
                svgFilePath = project.getSvgFilePath() + '/' + type + '/' + name + '.svg'
314 313
                if os.path.isfile(svgFilePath):
315 314
                    svg = SymbolSvgItem(svgFilePath)
......
326 325
                    svg.clicked.connect(lambda param=svg: self.resultTreeWidget.findItem(param))
327 326

  
328 327
                    transform = QTransform()
329
                    if (-1.57 == angle) or (-4.71 == angle): ## 18.04.12    Jeongwoo    Radian → -Radin
328
                    if (1.57 == angle) or (4.71 == angle):
330 329
                        transform.translate(pt[0] + size[0]*0.5,pt[1] + size[1]*0.5)
331
                        transform.rotateRadians(svg.angle) ## 18.04.12    Jeongwoo
330
                        transform.rotateRadians(-svg.angle)
332 331
                        transform.translate(-size[1]*0.5, -size[0]*0.5)
333
                    elif -3.14 == angle: ## 18.04.12    Jeongwoo    Radian → -Radin
332
                    elif 3.14 == angle:
334 333
                        transform.translate(pt[0] + size[0]*0.5,pt[1] + size[1]*0.5)
335
                        transform.rotateRadians(svg.angle) ## 18.04.12    Jeongwoo
334
                        transform.rotateRadians(-svg.angle)
336 335
                        transform.translate(-size[0]*0.5, -size[1]*0.5)
337 336
                    else:
338 337
                        transform.translate(pt[0],pt[1])
DTI_PID/DTI_PID/DTI_PID.py
394 394
                ## Case : Bigger Symbol than Split ROI
395 395
                if roiw < sw or roih < sh:
396 396
                    symGray = cv2.rotate(symGray, cv2.ROTATE_90_COUNTERCLOCKWISE)
397
                    symbolRotatedAngle = symbolRotatedAngle - 90
397
                    symbolRotatedAngle = symbolRotatedAngle + 90
398 398

  
399 399
                    if baseSymbol is not None and additionalSymbol is not None:
400 400
                        additionalSymbol = getRotatedChildInfo(additionalSymbol)
......
489 489
                                
490 490
                ## Rotate Symbol
491 491
                symGray = cv2.rotate(symGray, cv2.ROTATE_90_COUNTERCLOCKWISE)
492
                symbolRotatedAngle = symbolRotatedAngle - 90
492
                symbolRotatedAngle = symbolRotatedAngle + 90
493 493

  
494 494
                if additionalSymbol is not None:
495 495
                    additionalSymbol = getRotatedChildInfo(additionalSymbol)
......
523 523
    symImg = cv2.imread(path)
524 524
    symImg = cvtGrayImage(symImg)
525 525
    
526
    for i in range(abs(sAngle//90)):
526
    for i in range(sAngle//90):
527 527
        symImg = cv2.rotate(symImg, cv2.ROTATE_90_COUNTERCLOCKWISE)
528 528

  
529 529
    threadLock.acquire()
......
567 567
    symbolOcrOption = symbol.getOcrOption()
568 568

  
569 569
    symImg = cv2.imread(symbolPath, 1)
570
    for i in range(abs(symbolRotatedAngle//90)):
570
    for i in range(symbolRotatedAngle//90):
571 571
        symImg = cv2.rotate(symImg, cv2.ROTATE_90_COUNTERCLOCKWISE)
572 572

  
573 573
    chan, w, h = symImg.shape[::-1]
DTI_PID/DTI_PID/LineDetector.py
291 291
        @date       2018.04.??
292 292
        @history    humkyung 2018.04.11 merge lines which are collinear or connected    
293 293
        @history    humkyung 2018.04.12 rotate connection points by symbol angle
294
        @history    humkyung 2018.04.12 use connection points without rotation(already rotated)
294 295
    '''
295 296
    def detectConnectedLine(self, symbol, offsetX, offsetY):
296 297
        res = []
......
299 300
            pool = []
300 301
            if (0 == symbol.angle) or (1.57 == symbol.angle) or (3.14 == symbol.angle) or (4.71 == symbol.angle):
301 302
                for conn in symbol.connPts:
302
                    pt = self.rotatePoint(conn, symbol.origin, symbol.angle)
303
                    dx = pt[0] - symbol.origin[0]
304
                    dy = pt[1] - symbol.origin[1]
303
                    dx = conn[0] - symbol.origin[0]
304
                    dy = conn[1] - symbol.origin[1]
305 305
                    length = math.sqrt(dx*dx + dy*dy)
306 306
                    dx /= length
307 307
                    dy /= length
308 308

  
309 309
                    if abs(dx) < 0.1:
310
                        pool.append([[0,1 if dy > 0 else -1], [round(pt[0] - offsetX), round(pt[1] - offsetY)]])
310
                        pool.append([[0,1 if dy > 0 else -1], [round(conn[0] - offsetX), round(conn[1] - offsetY)]])
311 311
                    elif abs(dy) < 0.1:
312
                        pool.append([[1 if dx > 0 else -1,0], [round(pt[0] - offsetX), round(pt[1] - offsetY)]])
312
                        pool.append([[1 if dx > 0 else -1,0], [round(conn[0] - offsetX), round(conn[1] - offsetY)]])
313 313

  
314 314
            while len(pool) > 0:
315 315
                dir, pt = pool.pop()

내보내기 Unified diff

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