Skip to content

Commit

Permalink
Scripts Update
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewHazelden committed Aug 18, 2016
1 parent a75ba51 commit 0e9890e
Show file tree
Hide file tree
Showing 29 changed files with 417 additions and 132 deletions.
37 changes: 22 additions & 15 deletions Dome2rect readme.html
Original file line number Diff line number Diff line change
Expand Up @@ -291,16 +291,19 @@
</style>
</head>
<body>
<h1>Dome2rect v1.5.2 - 2016-03-30</h1>
<h1>Dome2rect v1.6 - 2016-08-18</h1>
<p>by Andrew Hazelden</p>
<h2>Overview</h2>
<p>Dome2rect is a command line script that uses the open source Panotool library + MPRemap application to automate the process of converting image sequences between multiple panoramic formats. I created this script because I wanted to make it simpler to convert a fulldome movie trailer into a &quot;flat screen&quot; rectilinear format for posting on sites like YouTube.</p>
<p><strong>Note:</strong> Windows 7 or higher is required to use the tools.</p>
<p><em>Dome2rect is distributed under the GPL v3 license.</em></p>
<h2>Version History</h2>
<h3>Changes in Version 1.6</h3>
<p>New in Dome2rect version 1.6 is a <code>latlong2gearvrmono.bat</code> script that converts latlong/equirectangular/spherical imagery into the Gear VR mono horizontal strip cubemap image format. The <code>cubic2gearvrmono.bat</code> script converts 6 cubemap images into a Gear VR mono horizontal strip cubemap image format. Updated the scripts to automatically create the output folder if required. Updated the file naming of the intermediate cubemap frames.</p>
<h3>Changes in Version 1.5</h3>
<p>New in Dome2rect version 1.5 is a <code>movie2imagesequence.bat</code> script that makes it easy to extract image sequences from any .mp4 movies placed in the dome2rect input folder. Also added a script <code>alphaextract.bat</code> that extracts a transparent mask from footage and saves it into an RGB image file in the output folder. The <code>encodemovie.bat</code> script will re-encode a mp4/mov/mkv/avi movie file with ffmpeg into a compact mp4 movie to make it playback better on mobile/tablets/desktop systems. The <code>imagesequence2movie.bat</code> script will turn your image sequence into an mp4 movie using ffmpeg.</p>
<h3>Changes in Version 1.4</h3>
<p>New in Dome2rect version 1.4 is support for converting LatLong Stereo images into the GearVR Stereo cubic format, and a LatLong to mental ray cube1 horizontal strip format conversion.</p>
<p>New in Dome2rect version 1.4 is support for converting LatLong Stereo images into the Gear VR Stereo cubic format, and a LatLong to mental ray cube1 horizontal strip format conversion.</p>
<h3>Changes in Version 1.3</h3>
<p>New in Dome2rect version 1.3 is support for LatLong to cubic, horizontal cross, vertical cross, and cubemap3x2 conversions.</p>
<h2>Download</h2>
Expand Down Expand Up @@ -341,39 +344,43 @@ <h2>Converting 1080p HD Media to Fulldome</h2>
<p><strong>Note:</strong> The <a href="https://github.com/zicher3d-org/domemaster-stereo-shader/wiki/DomeViewer">Domemaster Stereo shader tool &quot;Dome Viewer&quot;</a> was used to preview the rect to dome conversion.</p>
<hr />
<h2>Batch Script Notes</h2>
<p>The tool is an early alpha release and will be improved over time. Right now the only image format enabled for input/output is .jpg files and a UNIX .pnm image format. In the future all the common image/video formats could be supported since the FFMPEG library is used for format conversions.</p>
<p>Right now the only image format enabled for input/output is .jpg files and a UNIX .pnm image format.</p>
<p>I created the following example .bat scripts to show what is possible:</p>
<p><strong>alphaextract.bat</strong><br />
This script extracts a transparent mask from footage and saves it into an RGB image file in the output folder.</p>
<p><strong>angular2cyl.bat</strong><br />
Converts a an angular fisheye image to a cylindrical image.</p>
<p><strong>angular2latlong.bat</strong><br />
Converts an angular fisheye image to a latitude/longitude (equirectangular) image.</p>
Converts an angular fisheye image to a latlong/equirectangular/spherical image.</p>
<p><strong>cubic2gearvrmono.bat</strong><br />
Converts 6 cubemap images into a Gear VR mono horizontal strip cubemap.</p>
<p><strong>dome2rect.bat</strong><br />
Converts a 180 degree domemaster format angular fisheye image to a rectilinear image format.</p>
<p><strong>encodemovie.bat</strong><br />
Re-encode a mp4/mov/mkv/avi movie file with ffmpeg into a compact mp4 movie to make it playback better on mobile/tablets/desktop systems.</p>
<p><strong>imagesequence2movie.bat</strong>
<p><strong>imagesequence2movie.bat</strong><br />
This script will take an image sequence along with an audio file and create an mp4 movie file using ffmpeg.</p>
<p><strong>latlong2cubemap3x2.bat</strong><br />
Converts a latitude/longitude image to a cubic format that has a single image output with a Cubemap 3x2 arrangement with 3 cubic faces on the top row, and 3 cubic faces on the bottom row. </p>
Converts a latlong/equirectangular/spherical image to a cubic format that has a single image output with a Cubemap 3x2 arrangement with 3 cubic faces on the top row, and 3 cubic faces on the bottom row. </p>
<p>The Cubemap 3x2 format was popularized by <a href="http://ggnome.com/pano2vr">Garden Gnome Software's Pano2VR</a> Panoramic tools.</p>
<p><strong>latlong2cubic.bat</strong><br />
Converts a latitude/longitude image to a set of 6 cubic face images.</p>
<p><strong>latlong2cyl.bat</strong>
Converts a latitude/longitude image to a cylindrical image.</p>
Converts a latlong/equirectangular/spherical image to a set of 6 cubic face images.</p>
<p><strong>latlong2cyl.bat</strong><br />
Converts a latlong/equirectangular/spherical image to a cylindrical image.</p>
<p><strong>latlong2dome.bat</strong><br />
Converts a latitude/longitude (equirectangular) image to a fulldome image.</p>
Converts a latlong/equirectangular/spherical image to a fulldome image.</p>
<p><strong>latlong2gearvrmono.bat</strong><br />
Converts latlong/equirectangular/spherical image into a Gear VR mono horizontal strip cubemap image format.</p>
<p><strong>latlong2horizontalcross.bat</strong><br />
Converts a latitude/longitude image to a cubic format that has a single image output with a horizontal cross arrangement.</p>
Converts a latlong/equirectangular/spherical image to a cubic format that has a single image output with a horizontal cross arrangement.</p>
<p><strong>latlong2mentalrayhorizontalstripcube1.bat</strong><br />
Converts a latitude/longitude image into a cubic format that has a single image output with a mental ray cube1 horizontal strip arrangement.</p>
Converts a latlong/equirectangular/spherical image into a cubic format that has a single image output with a mental ray cube1 horizontal strip arrangement.</p>
<p><strong>latlong2rect.bat</strong><br />
Converts a latitude/longitude (equirectangular) image to a rectilinear image.</p>
Converts a latlong/equirectangular/spherical image to a rectilinear image.</p>
<p><strong>latlong2verticalcross.bat</strong><br />
Converts a latitude/longitude image to a cubic format that has a single image output with a vertical cross arrangement.</p>
Converts a latlong/equirectangular/spherical image to a cubic format that has a single image output with a vertical cross arrangement.</p>
<p><strong>latlongstereo2gearvrstereo.bat</strong><br />
Converts a pair of latitude/longitude stereo images into a cubic format that has a single image output with a Samsung GearVR Stereo horizontal strip arrangement.</p>
Converts a pair of latlong/equirectangular/spherical stereo images into a cubic format that has a single image output with a Samsung GearVR Stereo horizontal strip arrangement.</p>
<p>The left LatLong frames in the image sequence should be named <code>&lt;name&gt;_L.#.jpg</code>, and the right LatLong frames in the image sequence should be named <code>&lt;name&gt;_R.#.jpg</code>.</p>
<p><strong>movie2imagesequence.bat</strong><br />
Extract image sequence frames from all of the .mp4 movie files in the input folder using ffmpeg.</p>
Expand Down
4 changes: 2 additions & 2 deletions alphaextract.bat
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@ECHO OFF
@title Alpha Extract v1.5
@title Alpha Extract v1.6

echo Alpha Extract v1.5 - 2016-03-28
echo Alpha Extract v1.6 - 2016-08-18
echo Script by Andrew Hazelden
echo ----------------------------------------------------------------------
echo Alpha Extract will extract a transparent mask from footage
Expand Down
12 changes: 9 additions & 3 deletions angular2cyl.bat
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@ECHO OFF
@title angular2cyl v1.5 - immersive transformations
@title angular2cyl v1.6 - immersive transformations

echo angular2cyl v1.5 - 2016-03-28
echo angular2cyl v1.6 - 2016-08-18
echo script by Andrew Hazelden
echo ----------------------------------------------------------------------
echo angular2cyl converts an angular fisheye image sequence into the cylinder
Expand All @@ -18,11 +18,17 @@ REM Use the exact image name for a single frame (eg. image.0009.jpg)
REM Use %%d.jpg for an unpadded image sequence (eg: 9.jpg)
REM Use %%.4d.jpg for a padded image sequence (eg: 0009.jpg)

REM output image folder
@set outputFolder=C:\dome2rect\output

REM Process a single frame for testing:
@set ptscript=angular2cyl
@set input=input\angular360.jpg
REM @set input=input\zosma.0001.jpg
@set output=output\sequence.%%d.jpg
@set output=%outputFolder%\sequence.%%d.jpg

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 Process a 4 digit padded image sequence:
REM @set ptscript=angular2cyl
Expand Down
13 changes: 10 additions & 3 deletions angular2latlong.bat
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@ECHO OFF
@title angular2latlong v1.5 - immersive transformations
@title angular2latlong v1.6 - immersive transformations

echo angular2latlong v1.5 - 2016-03-28
echo angular2latlong v1.6 - 2016-08-18
echo script by Andrew Hazelden
echo ----------------------------------------------------------------------
echo angular2latlong converts a 360 degree angular fisheye image sequence
Expand All @@ -19,6 +19,9 @@ REM Use the exact image name for a single frame (eg. image.0009.jpg)
REM Use %%d.jpg for an unpadded image sequence (eg: 9.jpg)
REM Use %%.4d.jpg for a padded image sequence (eg: 0009.jpg)

REM output image folder
@set outputFolder=C:\dome2rect\output

REM Process a single frame for testing:
REM @set ptscript=angular2latlong
REM @set input=input\angular360.jpg
Expand All @@ -29,7 +32,11 @@ REM Process a 4 digit padded image sequence:
@set ptscript=angular2latlong
REM @set input=input\zosma.0001.jpg
@set input=input\zosma.%%.4d.jpg
@set output=output\sequence.%%d.jpg
@set output=%outputFolder%\sequence.%%d.jpg

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\
Expand Down
77 changes: 77 additions & 0 deletions cubic2gearvrmono.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
@ECHO OFF
@title cubic2gearvrmono v1.6 - immersive transformations

echo cubic2gearvrmono v1.6 - 2016-08-18
echo script by Andrew Hazelden
echo ----------------------------------------------------------------------
echo cubic2gearvrmono converts 6 cubemap formatted image sequences
echo into a GearVR cubic format using 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 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 Image extension:
@set input_ext=jpg

REM Output image - 6 extracted cubemap faces per camera view:
REM Cube Views - enter the initital file name prefix like "back" for "back.1.jpg"
@set input_back=input\back
@set input_bottom=input\bottom
@set input_front=input\front
@set input_left=input\left
@set input_right=input\right
@set input_top=input\top

REM output image folder
@set outputFolder=C:\dome2rect\output

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_left%.%%G.%input_ext% if exist %input_right%.%%G.%input_ext% if exist %input_top%.%%G.%input_ext% if exist %input_bottom%.%%G.%input_ext% if exist %input_back%.%%G.%input_ext% if exist %input_front%.%%G.%input_ext% (

echo.
echo Processing Frame %%G
echo.

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 %input_left%.%%G.%input_ext% %input_right%.%%G.%input_ext% ( %input_top%.%%G.%input_ext% -rotate 180 ^) ( %input_bottom%.%%G.%input_ext% -rotate 180 ^) %input_back%.%%G.%input_ext% %input_front%.%%G.%input_ext% +append %output_gearvr%.%%G.%input_ext%

echo Saving Image: %output_gearvr%.%%G.%input_ext%
) else (
echo Warning: One of the cubic input images were not found.
)
)

echo.
echo Sequence Processing Complete
echo.

REM echo Loading frames into viewer...
PAUSE
REM C:\dome2rect\review.bat %output_gearvr%.%%d.%input_ext%
12 changes: 9 additions & 3 deletions dome2rect.bat
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@ECHO OFF
@title dome2rect v1.5 - immersive transformations
@title dome2rect v1.6 - immersive transformations

echo dome2rect v1.5 - 2016-03-28
echo dome2rect v1.6 - 2016-08-18
echo script by Andrew Hazelden
echo ----------------------------------------------------------------------
echo dome2rect converts a fisheye image sequence into the rectilinear format
Expand All @@ -18,6 +18,9 @@ REM Use the exact image name for a single frame (eg. image.0009.jpg)
REM Use %%d.jpg for an unpadded image sequence (eg: 9.jpg)
REM Use %%.4d.jpg for a padded image sequence (eg: 0009.jpg)

REM output image folder
@set outputFolder=C:\dome2rect\output

REM Process a single frame for testing:
REM @set ptscript=dome2rect
REM @set input=input\zosma.0001.jpg
Expand All @@ -26,7 +29,10 @@ REM @set output=output\sequence.%%d.jpg
REM Process a 4 digit padded image sequence:
@set ptscript=dome2rect
@set input=input\zosma.%%.4d.jpg
@set output=output\sequence.%%d.jpg
@set output=%outputFolder%\sequence.%%d.jpg

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\
Expand Down
4 changes: 2 additions & 2 deletions encodemovie.bat
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@ECHO OFF
@title Encode Movie v1.5 - immersive transformations
@title Encode Movie v1.6 - immersive transformations

echo Encode Movie v1.5 - 2016-03-29
echo Encode Movie v1.6 - 2016-08-18
echo script by Andrew Hazelden
echo ----------------------------------------------------------------------
echo This script will use ffmpeg to re-encode a mp4/mov/mkv/avi movie file
Expand Down
4 changes: 2 additions & 2 deletions imagesequence2movie.bat
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@ECHO OFF
@title Image Sequence To Movie v1.5
@title Image Sequence To Movie v1.6

echo Image Sequence To Movie v1.5 - 2016-03-30
echo Image Sequence To Movie v1.6 - 2016-08-18
echo script by Andrew Hazelden
echo ----------------------------------------------------------------------
echo This script will take an image sequence along with an
Expand Down
Binary file added input/back.1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added input/bottom.1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added input/front.1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added input/left.1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added input/playblastvr_roller_coaster_track.1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added input/right.1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added input/top.1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 15 additions & 9 deletions latlong2cubemap3x2.bat
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@ECHO OFF
@title latlong2cubemap3x2 v1.5 - immersive transformations
@title latlong2cubemap3x2 v1.6 - immersive transformations

echo latlong2cubemap3x2 v1.5 - 2016-03-28
echo latlong2cubemap3x2 v1.6 - 2016-08-18
echo script by Andrew Hazelden
echo ----------------------------------------------------------------------
echo latlong2cubemap3x2 converts a latlong formatted image sequence
Expand All @@ -15,6 +15,9 @@ 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
Expand All @@ -38,15 +41,18 @@ REM Output image extension:
@set output_ext=jpg

REM Output image - 6 extracted cubemap faces:
@set output_back=output\cubemap_back
@set output_bottom=output\cubemap_bottom
@set output_front=output\cubemap_front
@set output_left=output\cubemap_left
@set output_right=output\cubemap_right
@set output_top=output\cubemap_top
@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 3x2 cubemap
@set output_cube3x2=output\cubemap3x2
@set output_cube3x2=%outputFolder%\cubemap3x2

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\
Expand Down
34 changes: 20 additions & 14 deletions latlong2cubic.bat
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@ECHO OFF
@title latlong2cubic v1.5 - immersive transformations
@title latlong2cubic v1.6 - immersive transformations

echo latlong2cubic v1.5 - 2016-03-28
echo latlong2cubic v1.6 - 2016-08-18
echo script by Andrew Hazelden
echo ----------------------------------------------------------------------
echo latlong2cubic converts a latlong formatted image sequence
Expand All @@ -19,6 +19,9 @@ REM Use the exact image name for a single frame (eg. image.0009.jpg)
REM Use %%d.jpg for an unpadded image sequence (eg: 9.jpg)
REM Use %%.4d.jpg for a padded image sequence (eg: 0009.jpg)

REM output image folder
@set outputFolder=C:\dome2rect\output

REM PT Stitcher Scripts
@set ptscript_back=latlong2cubemap_back
@set ptscript_bottom=latlong2cubemap_bottom
Expand All @@ -30,23 +33,26 @@ REM PT Stitcher Scripts
REM Still images
@set input=input\latlong.jpg

@set output_back=output\cubemap_back.jpg
@set output_bottom=output\cubemap_bottom.jpg
@set output_front=output\cubemap_front.jpg
@set output_left=output\cubemap_left.jpg
@set output_right=output\cubemap_right.jpg
@set output_top=output\cubemap_top.jpg
@set output_back=%outputFolder%\back.jpg
@set output_bottom=%outputFolder%\bottom.jpg
@set output_front=%outputFolder%\front.jpg
@set output_left=%outputFolder%\left.jpg
@set output_right=%outputFolder%\right.jpg
@set output_top=%outputFolder%\top.jpg

REM Moving images
REM @set input=input\latlong.%%.4d.jpg
REM @set input=input\latlong_sequence.%%.1d.jpg

REM @set output_back=output\cubemap_back.%%.4d.jpg
REM @set output_bottom=output\cubemap_bottom.%%.4d.jpg
REM @set output_front=output\cubemap_front.%%.4d.jpg
REM @set output_left=output\cubemap_left.%%.4d.jpg
REM @set output_right=output\cubemap_right.%%.4d.jpg
REM @set output_top=output\cubemap_top.%%.4d.jpg
REM @set output_back=%outputFolder%\back.%%.4d.jpg
REM @set output_bottom=%outputFolder%\bottom.%%.4d.jpg
REM @set output_front=%outputFolder%\front.%%.4d.jpg
REM @set output_left=%outputFolder%\left.%%.4d.jpg
REM @set output_right=%outputFolder%\right.%%.4d.jpg
REM @set output_top=%outputFolder%\top.%%.4d.jpg

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\
Expand Down
Loading

0 comments on commit 0e9890e

Please sign in to comment.