개정판 7dba979e
issue #000: update border deleter
Change-Id: Id4c141f586eab514867edc6a67e807220f4b5d53
minorTools/deleteBorder.py | ||
---|---|---|
1 | 1 |
import numpy as np |
2 | 2 |
import cv2, os |
3 | 3 |
|
4 |
rootPath = 'E:\Projects\LPG\drawings_'
|
|
4 |
rootPath = 'X:\CPChem\drawings'
|
|
5 | 5 |
imgList = os.listdir(rootPath) |
6 | 6 |
|
7 |
startX, startY, endX, endY = 6783, 121, 8223, 5820 |
|
7 |
startX, startY, endX, endY = [417, 3727, 7723], \ |
|
8 |
[5815, 5534, 5262], \ |
|
9 |
[9374, 9374, 9374], \ |
|
10 |
[6096, 6096, 6096] |
|
8 | 11 |
|
9 | 12 |
print('start') |
10 | 13 |
|
... | ... | |
13 | 16 |
|
14 | 17 |
img = cv2.imread(fullPath, cv2.IMREAD_GRAYSCALE) |
15 | 18 |
|
16 |
img = cv2.rectangle(img, (startX, startY), (endX, endY), 255, -1) |
|
19 |
for i in range(len(startX)): |
|
20 |
img = cv2.rectangle(img, (startX[i], startY[i]), (endX[i], endY[i]), 255, -1) |
|
17 | 21 |
|
18 | 22 |
originPath = os.path.splitext(fullPath) |
19 | 23 |
|
20 |
newPath = originPath[0] + '_new' + originPath[1]
|
|
24 |
newPath = originPath[0] + originPath[1] |
|
21 | 25 |
|
22 | 26 |
cv2.imwrite(newPath, img) |
23 | 27 |
|
24 |
print('finished') |
|
28 |
print('finished') |
내보내기 Unified diff