-
Notifications
You must be signed in to change notification settings - Fork 8
/
latlong2gearvrmono.bat
111 lines (83 loc) · 3.96 KB
/
latlong2gearvrmono.bat
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
@ECHO OFF
@title latlong2gearvrmono v1.6 - immersive transformations
echo latlong2gearvrmono v1.6 - 2016-08-18
echo script by Andrew Hazelden
echo ----------------------------------------------------------------------
echo latlong2gearvrmono converts a latlong formatted image sequence
echo into a GearVR cubic format using the moving panorama program
echo by Helmut Dersch and Imagemagick.
echo ----------------------------------------------------------------------
echo Check out the PTStitcher wiki for the script syntax:
echo http://wiki.panotools.org/PTStitcher
REM Note: mpremap accepts piped .pnm image streams
REM Image sequences are processed with unpadded sequence frame extensions.
REM output image folder
@set outputFolder=C:\dome2rect\output
REM Start/End Sequence Frame Range:
REM @set start_frame=1
REM @set end_frame=30
@set start_frame=1
@set end_frame=1
@set step_by_frames=1
REM The cubemap extracted face resolution is defined in each of the PT Stitcher scripts on the "p" line
REM Example: p f0 w1024 h1024 v90
REM PT Stitcher Scripts
@set ptscript_back=latlong2cubemap_back
@set ptscript_bottom=latlong2cubemap_bottom
@set ptscript_front=latlong2cubemap_front
@set ptscript_left=latlong2cubemap_left
@set ptscript_right=latlong2cubemap_right
@set ptscript_top=latlong2cubemap_top
REM Input image filename prefix
REM Example: The image filename prefix "CubeX_LatLong_L" would be used for the image named "CubeX_LatLong_L.1.jpg"
@set input=input\CubeX_LatLong_L
REM Output image extension:
@set output_ext=jpg
REM Output image - 6 extracted cubemap faces per camera view:
REM Cube Views
@set output_back=%outputFolder%\back
@set output_bottom=%outputFolder%\bottom
@set output_front=%outputFolder%\front
@set output_left=%outputFolder%\left
@set output_right=%outputFolder%\right
@set output_top=%outputFolder%\top
REM Output image - final stitched cubic GearVR horizontal strip
@set output_gearvr=%outputFolder%\gearvr
REM Create the output folder if it doesn't exist
IF exist %outputFolder% ( echo The %outputFolder% folder exists ) ELSE ( mkdir %outputFolder% && echo The %outputFolder% folder has been created)
REM Move to the base dome2rect folder
cd C:\dome2rect\
echo.
FOR /L %%G IN (%start_frame%, %step_by_frames%, %end_frame%) DO (
REM Checking if the source left and right image exists
if exist %input%.%%G.%output_ext% (
echo.
echo Processing Frame %%G
echo.
echo Back View
bin\mpremap.exe -f scripts\%ptscript_back% -o %output_back%.%%G.%output_ext% %input%.%%G.%output_ext%
echo Bottom View
bin\mpremap.exe -f scripts\%ptscript_bottom% -o %output_bottom%.%%G.%output_ext% %input%.%%G.%output_ext%
echo Front View
bin\mpremap.exe -f scripts\%ptscript_front% -o %output_front%.%%G.%output_ext% %input%.%%G.%output_ext%
echo left View
bin\mpremap.exe -f scripts\%ptscript_left% -o %output_left%.%%G.%output_ext% %input%.%%G.%output_ext%
echo Right View
bin\mpremap.exe -f scripts\%ptscript_right% -o %output_right%.%%G.%output_ext% %input%.%%G.%output_ext%
echo Top View
bin\mpremap.exe -f scripts\%ptscript_top% -o %output_top%.%%G.%output_ext% %input%.%%G.%output_ext%
echo Merging Cubic Images
REM Build the 6 cubic faces into a GearVR horizontal strip layout
REM Note: The ^ carets are for escaping the closing parentheses in the Imagemagick commands since they are happening inside the batch script's do loop
bin\imagemagick\imconvert.exe %output_left%.%%G.%output_ext% %output_right%.%%G.%output_ext% ( %output_top%.%%G.%output_ext% -rotate 180 ^) ( %output_bottom%.%%G.%output_ext% -rotate 180 ^) %output_back%.%%G.%output_ext% %output_front%.%%G.%output_ext% +append %output_gearvr%.%%G.%output_ext%
echo Saving Image: %output_gearvr%.%%G.%output_ext%
) else (
echo Warning: The %input%.%%G.%output_ext% image was not found.
)
)
echo.
echo Sequence Processing Complete
echo.
REM echo Loading frames into viewer...
PAUSE
REM C:\dome2rect\review.bat %output_gearvr%.%%d.%output_ext%