visualize.py 667 字节
Newer Older
W
wuzewu 已提交
1 2 3 4 5 6 7 8 9 10 11
import cv2
import sys

# ColorMap for visualization more clearly
color_map = [[128, 64, 128], [244, 35, 231], [69, 69, 69], [102, 102, 156],
             [190, 153, 153], [153, 153, 153], [250, 170, 29], [219, 219, 0],
             [106, 142, 35], [152, 250, 152], [69, 129, 180], [219, 19, 60],
             [255, 0, 0], [0, 0, 142], [0, 0, 69], [0, 60, 100], [0, 79, 100],
             [0, 0, 230], [119, 10, 32]]

im = cv2.imread(sys.argv[1])
J
joey12300 已提交
12
shape = im.shape
W
wuzewu 已提交
13
print("visualizing...")
J
joey12300 已提交
14 15
for i in range(0, shape[0]):
    for j in range(0, shape[1]):
W
wuzewu 已提交
16 17
        im[i, j] = color_map[im[i, j, 0]]

J
joey12300 已提交
18
cv2.imwrite(sys.argv[2], im)
W
wuzewu 已提交
19
print("visualizing done!")