프로젝트

일반

사용자정보

개정판 18b7ddf5

ID18b7ddf55086566563bf2c4fadaed86b59697bc9
상위 aa2b8cc7
하위 2efc211e, bc21c61a

김정우 이(가) 6년 이상 전에 추가함

LineDetector 내 detectLine() 에서 UPPERCASE 로 작성된 변수명 변경

차이점 보기:

DTI_PID/DTI_PID/LineDetector.py
394 394
        from AppDocData import AppDocData
395 395

  
396 396
        lineLengthConfigs = AppDocData.instance().getConfigs('Small Line Minimum Length', 'Min Length')
397
        LINE_MIN_LENGTH = int(lineLengthConfigs[0].value) if 1 == len(lineLengthConfigs) else 10
397
        lineMinLength = int(lineLengthConfigs[0].value) if 1 == len(lineLengthConfigs) else 10
398 398

  
399 399
        try:
400 400
            white = [255]
......
409 409
                for i in range(imgWidth-windowSize[0]):
410 410
                    window = image[0:windowSize[1], i:i+windowSize[0]]
411 411
                    if (white == window[0:windowSize[1],0:windowSize[0]]).all(): break
412
                if i > LINE_MIN_LENGTH:
412
                if i > lineMinLength:
413 413
                    self._image[(pt[1]-yHalf):(pt[1]+yHalf), pt[0]:(pt[0]+i)] = white
414 414
                    return [[pt[0], pt[1]], [pt[0] + i - round(thickness*0.5), pt[1]]]
415 415
            elif ([-1,0] == dir):
......
419 419
                for i in range(imgWidth-windowSize[0], -1, -1):
420 420
                    window = image[0:windowSize[1], i:i+windowSize[0]]
421 421
                    if (white == window[0:windowSize[1],0:windowSize[0]]).all(): break
422
                if abs(pt[0] - i - windowSize[0]) > LINE_MIN_LENGTH: 
422
                if abs(pt[0] - i - windowSize[0]) > lineMinLength: 
423 423
                    self._image[int(pt[1]-yHalf):int(pt[1]+yHalf), (i+windowSize[0]+yHalf):pt[0]] = white
424 424
                    return [[pt[0], pt[1]], [i+windowSize[0]+round(thickness*0.5), pt[1]]]
425 425
            elif ([0,1] == dir):
......
433 433
                for i in range(imgHeight-windowSize[1]):
434 434
                    window = image[i:i+windowSize[1], 0:windowSize[0]]
435 435
                    if (white == window[0:windowSize[1],0:windowSize[0]]).all(): break
436
                if i > LINE_MIN_LENGTH:
436
                if i > lineMinLength:
437 437
                    self._image[(pt[1]):(pt[1]+i), (pt[0]-xHalf):(pt[0]+xHalf)] = white
438 438
                    return [[pt[0], pt[1]], [pt[0], pt[1] + i - round(thickness*0.5)]]
439 439
            elif ([0,-1] == dir):
......
447 447
                for i in range(imgHeight-windowSize[1], -1, -1):
448 448
                    window = image[i:i+windowSize[1], 0:windowSize[0]]
449 449
                    if (white == window[0:windowSize[1],0:windowSize[0]]).all(): break
450
                if abs(pt[1] - i - windowSize[1]) > LINE_MIN_LENGTH:
450
                if abs(pt[1] - i - windowSize[1]) > lineMinLength:
451 451
                    self._image[(i+windowSize[1]):pt[1], (pt[0]-xHalf):(pt[0]+xHalf)] = white
452 452
                    return [[pt[0], pt[1]], [pt[0], i+windowSize[1]+round(thickness*0.5)]]
453 453
        except Exception as ex:

내보내기 Unified diff

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