-
Notifications
You must be signed in to change notification settings - Fork 27
/
pers2equir.py
43 lines (30 loc) · 1 KB
/
pers2equir.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
39
40
41
42
43
import os
import cv2
import lib.Equirec2Perspec as E2P
import lib.Perspec2Equirec as P2E
import lib.multi_Perspec2Equirec as m_P2E
import glob
import argparse
def pers2equir():
#
# FOV unit is degree
# theta is z-axis angle(right direction is positive, left direction is negative)
# phi is y-axis angle(up direction positive, down direction negative)
# height and width is output image dimension
#
input_dir = './example/perspective'
output_dir = './example/equirectangle'
width = 1920
height = 960
if not os.path.exists(output_dir):
os.mkdir(output_dir)
input1 = input_dir + '/perspective_1.png'
input2 = input_dir + '/perspective_2.png'
# this can turn cube to panorama
equ = m_P2E.Perspective([input1,input2],
[[120, 0, 0],[120, 0, 90]])
img = equ.GetEquirec(height,width)
print(img.shape)
cv2.imwrite(output_dir + '/output.png', img)
if __name__ == '__main__':
pers2equir()