개정판 93295502
issue #663: fixed line detection error(too large line thickness)
Change-Id: If5e70931f2f381d9d730dbbff3114f79c6329408
DTI_PID/DTI_PID/MainWindow.py | ||
---|---|---|
2436 | 2436 |
|
2437 | 2437 |
diffFilePath = os.path.join(project.getTempPath(), "DIFF_" + os.path.basename(path)) |
2438 | 2438 |
if os.path.isfile(diffFilePath): |
2439 |
imgDiff = cv2.threshold(cv2.cvtColor(cv2.imread(diffFilePath, 1), cv2.COLOR_BGR2GRAY), 127, 255,
|
|
2440 |
cv2.THRESH_BINARY)[1] |
|
2439 |
imgDiff = cv2.threshold(cv2.cvtColor(cv2.imread(diffFilePath, 1), cv2.COLOR_BGR2GRAY), 0, 255,
|
|
2440 |
cv2.THRESH_BINARY + cv2.THRESH_OTSU)[1]
|
|
2441 | 2441 |
|
2442 |
## remove line
|
|
2442 |
# remove line from image
|
|
2443 | 2443 |
lines = docData.lines |
2444 | 2444 |
for line in lines: |
2445 |
line.drawToImage(imgDiff, 255, thickness) if line.thickness is None else line.drawToImage(imgDiff, |
|
2446 |
255, |
|
2447 |
line.thickness) |
|
2445 |
line.drawToImage(imgDiff, 255, thickness) if line.thickness is None else \ |
|
2446 |
line.drawToImage(imgDiff, 255, line.thickness) |
|
2448 | 2447 |
cv2.imwrite(diffFilePath, imgDiff) |
2449 |
## up to here
|
|
2448 |
# up to here |
|
2450 | 2449 |
|
2451 | 2450 |
imgNot = np.ones(imgDiff.shape, np.uint8) |
2452 | 2451 |
cv2.bitwise_not(imgDiff, imgNot) |
내보내기 Unified diff