-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.py
38 lines (30 loc) · 1.1 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import numpy as np
import argparse
import cv2
import time
from util import writePFM
from RorS import chooseClass
from preprocess import prepareGCnet
parser = argparse.ArgumentParser(description='Disparity Estimation')
parser.add_argument('--input-left', default='./data/Synthetic/TL0.png', type=str, help='input left image')
parser.add_argument('--input-right', default='./data/Synthetic/TR0.png', type=str, help='input right image')
parser.add_argument('--output', default='./TL0.pfm', type=str, help='left disparity map')
# You can modify the function interface as you like
def computeDisp(Il, Ir):
flag = chooseClass(Il, Ir)
print(flag)
disp = prepareGCnet(Il, Ir, flag)
return disp
def main():
args = parser.parse_args()
print(args.output)
print('Compute disparity for %s' % args.input_left)
img_left = cv2.imread(args.input_left)
img_right = cv2.imread(args.input_right)
tic = time.time()
disp = computeDisp(img_left, img_right)
toc = time.time()
writePFM(args.output, disp)
print('Elapsed time: %f sec.' % (toc - tic))
if __name__ == '__main__':
main()