diff --git a/Dome2rect readme.html b/Dome2rect readme.html index be4ec8e..7b145ac 100644 --- a/Dome2rect readme.html +++ b/Dome2rect readme.html @@ -291,16 +291,19 @@ -

Dome2rect v1.5.2 - 2016-03-30

+

Dome2rect v1.6 - 2016-08-18

by Andrew Hazelden

Overview

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 "flat screen" rectilinear format for posting on sites like YouTube.

Note: Windows 7 or higher is required to use the tools.

Dome2rect is distributed under the GPL v3 license.

+

Version History

+

Changes in Version 1.6

+

New in Dome2rect version 1.6 is a latlong2gearvrmono.bat script that converts latlong/equirectangular/spherical imagery into the Gear VR mono horizontal strip cubemap image format. The cubic2gearvrmono.bat 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.

Changes in Version 1.5

New in Dome2rect version 1.5 is a movie2imagesequence.bat script that makes it easy to extract image sequences from any .mp4 movies placed in the dome2rect input folder. Also added a script alphaextract.bat that extracts a transparent mask from footage and saves it into an RGB image file in the output folder. The encodemovie.bat 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 imagesequence2movie.bat script will turn your image sequence into an mp4 movie using ffmpeg.

Changes in Version 1.4

-

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.

+

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.

Changes in Version 1.3

New in Dome2rect version 1.3 is support for LatLong to cubic, horizontal cross, vertical cross, and cubemap3x2 conversions.

Download

@@ -341,39 +344,43 @@

Converting 1080p HD Media to Fulldome

Note: The Domemaster Stereo shader tool "Dome Viewer" was used to preview the rect to dome conversion.


Batch Script Notes

-

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.

+

Right now the only image format enabled for input/output is .jpg files and a UNIX .pnm image format.

I created the following example .bat scripts to show what is possible:

alphaextract.bat
This script extracts a transparent mask from footage and saves it into an RGB image file in the output folder.

angular2cyl.bat
Converts a an angular fisheye image to a cylindrical image.

angular2latlong.bat
-Converts an angular fisheye image to a latitude/longitude (equirectangular) image.

+Converts an angular fisheye image to a latlong/equirectangular/spherical image.

+

cubic2gearvrmono.bat
+Converts 6 cubemap images into a Gear VR mono horizontal strip cubemap.

dome2rect.bat
Converts a 180 degree domemaster format angular fisheye image to a rectilinear image format.

encodemovie.bat
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.

-

imagesequence2movie.bat +

imagesequence2movie.bat
This script will take an image sequence along with an audio file and create an mp4 movie file using ffmpeg.

latlong2cubemap3x2.bat
-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.

+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.

The Cubemap 3x2 format was popularized by Garden Gnome Software's Pano2VR Panoramic tools.

latlong2cubic.bat
-Converts a latitude/longitude image to a set of 6 cubic face images.

-

latlong2cyl.bat -Converts a latitude/longitude image to a cylindrical image.

+Converts a latlong/equirectangular/spherical image to a set of 6 cubic face images.

+

latlong2cyl.bat
+Converts a latlong/equirectangular/spherical image to a cylindrical image.

latlong2dome.bat
-Converts a latitude/longitude (equirectangular) image to a fulldome image.

+Converts a latlong/equirectangular/spherical image to a fulldome image.

+

latlong2gearvrmono.bat
+Converts latlong/equirectangular/spherical image into a Gear VR mono horizontal strip cubemap image format.

latlong2horizontalcross.bat
-Converts a latitude/longitude image to a cubic format that has a single image output with a horizontal cross arrangement.

+Converts a latlong/equirectangular/spherical image to a cubic format that has a single image output with a horizontal cross arrangement.

latlong2mentalrayhorizontalstripcube1.bat
-Converts a latitude/longitude image into a cubic format that has a single image output with a mental ray cube1 horizontal strip arrangement.

+Converts a latlong/equirectangular/spherical image into a cubic format that has a single image output with a mental ray cube1 horizontal strip arrangement.

latlong2rect.bat
-Converts a latitude/longitude (equirectangular) image to a rectilinear image.

+Converts a latlong/equirectangular/spherical image to a rectilinear image.

latlong2verticalcross.bat
-Converts a latitude/longitude image to a cubic format that has a single image output with a vertical cross arrangement.

+Converts a latlong/equirectangular/spherical image to a cubic format that has a single image output with a vertical cross arrangement.

latlongstereo2gearvrstereo.bat
-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.

+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.

The left LatLong frames in the image sequence should be named <name>_L.#.jpg, and the right LatLong frames in the image sequence should be named <name>_R.#.jpg.

movie2imagesequence.bat
Extract image sequence frames from all of the .mp4 movie files in the input folder using ffmpeg.

diff --git a/alphaextract.bat b/alphaextract.bat index d41cf22..a524996 100644 --- a/alphaextract.bat +++ b/alphaextract.bat @@ -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 diff --git a/angular2cyl.bat b/angular2cyl.bat index 4637cc1..a807b5c 100644 --- a/angular2cyl.bat +++ b/angular2cyl.bat @@ -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 @@ -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 diff --git a/angular2latlong.bat b/angular2latlong.bat index 1ac1636..f1cf52d 100644 --- a/angular2latlong.bat +++ b/angular2latlong.bat @@ -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 @@ -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 @@ -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\ diff --git a/cubic2gearvrmono.bat b/cubic2gearvrmono.bat new file mode 100644 index 0000000..c9e3ab0 --- /dev/null +++ b/cubic2gearvrmono.bat @@ -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% diff --git a/dome2rect.bat b/dome2rect.bat index 2c841d2..1ec3bc6 100644 --- a/dome2rect.bat +++ b/dome2rect.bat @@ -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 @@ -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 @@ -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\ diff --git a/encodemovie.bat b/encodemovie.bat index 7361da3..ab94c7f 100644 --- a/encodemovie.bat +++ b/encodemovie.bat @@ -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 diff --git a/imagesequence2movie.bat b/imagesequence2movie.bat index ccc4817..815ca0c 100644 --- a/imagesequence2movie.bat +++ b/imagesequence2movie.bat @@ -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 diff --git a/input/back.1.jpg b/input/back.1.jpg new file mode 100644 index 0000000..98c8b7c Binary files /dev/null and b/input/back.1.jpg differ diff --git a/input/bottom.1.jpg b/input/bottom.1.jpg new file mode 100644 index 0000000..4111702 Binary files /dev/null and b/input/bottom.1.jpg differ diff --git a/input/front.1.jpg b/input/front.1.jpg new file mode 100644 index 0000000..f0ccb77 Binary files /dev/null and b/input/front.1.jpg differ diff --git a/input/left.1.jpg b/input/left.1.jpg new file mode 100644 index 0000000..325daa1 Binary files /dev/null and b/input/left.1.jpg differ diff --git a/input/playblastvr_roller_coaster_track.1.jpg b/input/playblastvr_roller_coaster_track.1.jpg new file mode 100644 index 0000000..8b8dc3c Binary files /dev/null and b/input/playblastvr_roller_coaster_track.1.jpg differ diff --git a/input/right.1.jpg b/input/right.1.jpg new file mode 100644 index 0000000..1c3eb73 Binary files /dev/null and b/input/right.1.jpg differ diff --git a/input/top.1.jpg b/input/top.1.jpg new file mode 100644 index 0000000..46af47d Binary files /dev/null and b/input/top.1.jpg differ diff --git a/latlong2cubemap3x2.bat b/latlong2cubemap3x2.bat index e25d995..a25d41a 100644 --- a/latlong2cubemap3x2.bat +++ b/latlong2cubemap3x2.bat @@ -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 @@ -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 @@ -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\ diff --git a/latlong2cubic.bat b/latlong2cubic.bat index bd7fedc..4696c54 100644 --- a/latlong2cubic.bat +++ b/latlong2cubic.bat @@ -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 @@ -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 @@ -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\ diff --git a/latlong2cyl.bat b/latlong2cyl.bat index a88b4ac..82401a6 100644 --- a/latlong2cyl.bat +++ b/latlong2cyl.bat @@ -1,7 +1,7 @@ @ECHO OFF -@title latlong2cyl v1.5 - immersive transformations +@title latlong2cyl v1.6 - immersive transformations -echo latlong2rect v1.5 - 2016-03-28 +echo latlong2rect v1.6 - 2016-08-18 echo script by Andrew Hazelden echo ---------------------------------------------------------------------- echo latlong2cyl converts a latitude/longitude image sequence into a cylindrical @@ -18,15 +18,21 @@ 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=latlong2cyl @set input=input\latlong.jpg -@set output=output\sequence.%%d.jpg +@set output=%outputFolder%\sequence.%%d.jpg REM Process a 4 digit padded image sequence: REM @set ptscript=latlong2rect REM @set input=input\zosma.%%.4d.jpg -REM @set output=output\sequence.%%d.jpg +REM @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\ diff --git a/latlong2dome.bat b/latlong2dome.bat index 7672e1e..8b8b3a9 100644 --- a/latlong2dome.bat +++ b/latlong2dome.bat @@ -1,7 +1,7 @@ @ECHO OFF -@title latlong2dome v1.5 - immersive transformations +@title latlong2dome v1.6 - immersive transformations -echo latlong2dome v1.5 - 2016-03-28 +echo latlong2dome v1.6 - 2016-08-18 echo script by Andrew Hazelden echo ---------------------------------------------------------------------- echo latlong2dome converts a latitude/longitude image sequence into dome @@ -18,17 +18,23 @@ 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=latlong2rect @set ptscript=latlong2dome @set input=input\latlong.jpg -@set output=output\sequence.%%d.jpg +@set output=%outputFolder%\sequence.%%d.jpg REM Process a 4 digit padded image sequence: REM @set ptscript=latlong2rect REM @set input=input\zosma.%%.4d.jpg REM @set output=output\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\ diff --git a/latlong2gearvrmono.bat b/latlong2gearvrmono.bat new file mode 100644 index 0000000..f138a2a --- /dev/null +++ b/latlong2gearvrmono.bat @@ -0,0 +1,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% diff --git a/latlong2horizontalcross.bat b/latlong2horizontalcross.bat index 553775f..4898fe8 100644 --- a/latlong2horizontalcross.bat +++ b/latlong2horizontalcross.bat @@ -1,7 +1,7 @@ @ECHO OFF -@title latlong2horizontalcross v1.5 - immersive transformations +@title latlong2horizontalcross v1.6 - immersive transformations -echo latlong2horizontalcross v1.5 - 2016-03-28 +echo latlong2horizontalcross v1.6 - 2016-08-18 echo script by Andrew Hazelden echo ---------------------------------------------------------------------- echo latlong2horizontalcross converts a latlong formatted image sequence @@ -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 @@ -38,18 +41,22 @@ 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 This is the cubemap extracted face resolution and is defined in each of the PT Stitcher scripts on the "p" line @set cubemap_image_width_px=1024 REM Output image - final stitched horizontal cross -@set output_cube_horizontal=output\horizontalcross +@set output_cube_horizontal=%outputFolder%\horizontalcross + +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\ diff --git a/latlong2mentalrayhorizontalstripcube1.bat b/latlong2mentalrayhorizontalstripcube1.bat index 61cd490..041e061 100644 --- a/latlong2mentalrayhorizontalstripcube1.bat +++ b/latlong2mentalrayhorizontalstripcube1.bat @@ -1,7 +1,7 @@ @ECHO OFF -@title latlong2mentalrayhorizontalstripcube1 v1.5 - immersive transformations +@title latlong2mentalrayhorizontalstripcube1 v1.6 - immersive transformations -echo latlong2mentalrayhorizontalstripcube1 v1.5 - 2016-03-28 +echo latlong2mentalrayhorizontalstripcube1 v1.6 - 2016-08-18 echo script by Andrew Hazelden echo ---------------------------------------------------------------------- echo latlong2mentalrayhorizontalstripcube1 converts a latlong formatted image @@ -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 @@ -41,15 +44,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 mr horizontal strip cube1 -@set output_cube_mr_horizontal=output\mrhorizontalstrip +@set output_cube_mr_horizontal=%outputFolder%\mrhorizontalstrip + +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\ diff --git a/latlong2rect.bat b/latlong2rect.bat index fddc3d6..23e419a 100644 --- a/latlong2rect.bat +++ b/latlong2rect.bat @@ -1,7 +1,7 @@ @ECHO OFF -@title latlong2rect v1.5 - immersive transformations +@title latlong2rect v1.6 - immersive transformations -echo latlong2rect v1.5 - 2016-03-28 +echo latlong2rect v1.6 - 2016-08-18 echo script by Andrew Hazelden echo ---------------------------------------------------------------------- echo latlong2rect converts a LatLong image sequence into rectilinear @@ -18,15 +18,21 @@ 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=latlong2rect @set input=input\latlong.jpg -@set output=output\sequence.%%d.jpg +@set output=%outputFolder%\sequence.%%d.jpg REM Process a 4 digit padded image sequence: REM @set ptscript=latlong2rect REM @set input=input\zosma.%%.4d.jpg -REM @set output=output\sequence.%%d.jpg +REM @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\ diff --git a/latlong2verticalcross.bat b/latlong2verticalcross.bat index 166a058..5f5e24c 100644 --- a/latlong2verticalcross.bat +++ b/latlong2verticalcross.bat @@ -1,7 +1,7 @@ @ECHO OFF -@title latlong2verticalcross v1.5 - immersive transformations +@title latlong2verticalcross v1.6 - immersive transformations -echo latlong2verticalcross v1.5 - 2016-03-28 +echo latlong2verticalcross v1.6 - 2016-08-18 echo script by Andrew Hazelden echo ---------------------------------------------------------------------- echo latlong2verticalcross converts a latlong formatted image sequence @@ -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 @@ -38,18 +41,21 @@ 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 This is the cubemap extracted face resolution and is defined in each of the PT Stitcher scripts on the "p" line @set cubemap_image_width_px=1024 REM Output image - final stitched vertical cross -@set output_cube_vertical=output\verticalcross +@set output_cube_vertical=%outputFolder%\verticalcross + +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\ diff --git a/latlongstereo2gearvrstereo.bat b/latlongstereo2gearvrstereo.bat index f257a33..df3a138 100644 --- a/latlongstereo2gearvrstereo.bat +++ b/latlongstereo2gearvrstereo.bat @@ -1,7 +1,7 @@ @ECHO OFF -@title latlongstereo2gearvrstereo v1.5 - immersive transformations +@title latlongstereo2gearvrstereo v1.6 - immersive transformations -echo latlongstereo2gearvrstereo v1.5 - 2016-03-28 +echo latlongstereo2gearvrstereo v1.6 - 2016-08-18 echo script by Andrew Hazelden echo ---------------------------------------------------------------------- echo latlongstereo2gearvrstereo converts a left and right latlong stereo @@ -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 @@ -44,23 +47,25 @@ REM Output image extension: REM Output image - 6 extracted cubemap faces per Left/Right camera view: REM Right Cube Views -@set output_back_R=output\cubemap_back_R -@set output_bottom_R=output\cubemap_bottom_R -@set output_front_R=output\cubemap_front_R -@set output_left_R=output\cubemap_left_R -@set output_right_R=output\cubemap_right_R -@set output_top_R=output\cubemap_top_R +@set output_back_R=%outputFolder%\back_R +@set output_bottom_R=%outputFolder%\bottom_R +@set output_front_R=%outputFolder%\front_R +@set output_left_R=%outputFolder%\left_R +@set output_right_R=%outputFolder%\right_R +@set output_top_R=%outputFolder%\top_R REM Left Cube Views -@set output_back_L=output\cubemap_back_L -@set output_bottom_L=output\cubemap_bottom_L -@set output_front_L=output\cubemap_front_L -@set output_left_L=output\cubemap_left_L -@set output_right_L=output\cubemap_right_L -@set output_top_L=output\cubemap_top_L - - -REM Output image - final stitched cubic GearVR stereo horitzontal strip -@set output_gearvr=output\gearvr_stereo +@set output_back_L=%outputFolder%\back_L +@set output_bottom_L=%outputFolder%\bottom_L +@set output_front_L=%outputFolder%\front_L +@set output_left_L=%outputFolder%\left_L +@set output_right_L=%outputFolder%\right_L +@set output_top_L=%outputFolder%\top_L + +REM Output image - final stitched cubic GearVR stereo horizontal strip +@set output_gearvr=%outputFolder%\gearvr_stereo + +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\ diff --git a/movie2imagesequence.bat b/movie2imagesequence.bat index 6333777..19fa2ce 100644 --- a/movie2imagesequence.bat +++ b/movie2imagesequence.bat @@ -1,7 +1,7 @@ @ECHO OFF -@title Movie To Image Sequence v1.5 +@title Movie To Image Sequence v1.6 -echo Movie To Image Sequence Script v1.5 - 2016-03-28 +echo Movie To Image Sequence Script v1.6 - 2016-08-18 echo script by Andrew Hazelden echo ---------------------------------------------------------------------- echo This script will extract image sequence frames from all of the mp4 diff --git a/readme.md b/readme.md index 05f496f..bd0e9b0 100644 --- a/readme.md +++ b/readme.md @@ -1,4 +1,4 @@ -# Dome2rect v1.5.2 - 2016-03-30 # +# Dome2rect v1.6 - 2016-08-18 # by Andrew Hazelden ## Overview ## @@ -8,13 +8,19 @@ Dome2rect is a command line script that uses the open source Panotool library + *Dome2rect is distributed under the GPL v3 license.* +## Version History ## + +### Changes in Version 1.6 ### + +New in Dome2rect version 1.6 is a `latlong2gearvrmono.bat` script that converts latlong/equirectangular/spherical imagery into the Gear VR mono horizontal strip cubemap image format. The `cubic2gearvrmono.bat` 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. + ### Changes in Version 1.5 ### New in Dome2rect version 1.5 is a `movie2imagesequence.bat` script that makes it easy to extract image sequences from any .mp4 movies placed in the dome2rect input folder. Also added a script `alphaextract.bat` that extracts a transparent mask from footage and saves it into an RGB image file in the output folder. The `encodemovie.bat` 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 `imagesequence2movie.bat` script will turn your image sequence into an mp4 movie using ffmpeg. ### Changes in Version 1.4 ### -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. +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. ### Changes in Version 1.3 ### @@ -81,7 +87,7 @@ When the rect2dome output image is viewed in a fulldome simulator it looks like * * * ## Batch Script Notes ## -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. +Right now the only image format enabled for input/output is .jpg files and a UNIX .pnm image format. I created the following example .bat scripts to show what is possible: @@ -92,7 +98,10 @@ This script extracts a transparent mask from footage and saves it into an RGB im Converts a an angular fisheye image to a cylindrical image. **angular2latlong.bat** -Converts an angular fisheye image to a latitude/longitude (equirectangular) image. +Converts an angular fisheye image to a latlong/equirectangular/spherical image. + +**cubic2gearvrmono.bat** +Converts 6 cubemap images into a Gear VR mono horizontal strip cubemap. **dome2rect.bat** Converts a 180 degree domemaster format angular fisheye image to a rectilinear image format. @@ -100,37 +109,40 @@ Converts a 180 degree domemaster format angular fisheye image to a rectilinear i **encodemovie.bat** 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. -**imagesequence2movie.bat** +**imagesequence2movie.bat** This script will take an image sequence along with an audio file and create an mp4 movie file using ffmpeg. **latlong2cubemap3x2.bat** -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. +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. The Cubemap 3x2 format was popularized by [Garden Gnome Software's Pano2VR](http://ggnome.com/pano2vr) Panoramic tools. **latlong2cubic.bat** -Converts a latitude/longitude image to a set of 6 cubic face images. +Converts a latlong/equirectangular/spherical image to a set of 6 cubic face images. -**latlong2cyl.bat** -Converts a latitude/longitude image to a cylindrical image. +**latlong2cyl.bat** +Converts a latlong/equirectangular/spherical image to a cylindrical image. **latlong2dome.bat** -Converts a latitude/longitude (equirectangular) image to a fulldome image. +Converts a latlong/equirectangular/spherical image to a fulldome image. + +**latlong2gearvrmono.bat** +Converts latlong/equirectangular/spherical image into a Gear VR mono horizontal strip cubemap image format. **latlong2horizontalcross.bat** -Converts a latitude/longitude image to a cubic format that has a single image output with a horizontal cross arrangement. +Converts a latlong/equirectangular/spherical image to a cubic format that has a single image output with a horizontal cross arrangement. **latlong2mentalrayhorizontalstripcube1.bat** -Converts a latitude/longitude image into a cubic format that has a single image output with a mental ray cube1 horizontal strip arrangement. +Converts a latlong/equirectangular/spherical image into a cubic format that has a single image output with a mental ray cube1 horizontal strip arrangement. **latlong2rect.bat** -Converts a latitude/longitude (equirectangular) image to a rectilinear image. +Converts a latlong/equirectangular/spherical image to a rectilinear image. **latlong2verticalcross.bat** -Converts a latitude/longitude image to a cubic format that has a single image output with a vertical cross arrangement. +Converts a latlong/equirectangular/spherical image to a cubic format that has a single image output with a vertical cross arrangement. **latlongstereo2gearvrstereo.bat** -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. +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. The left LatLong frames in the image sequence should be named `_L.#.jpg`, and the right LatLong frames in the image sequence should be named `_R.#.jpg`. @@ -232,7 +244,6 @@ m i2 = smooth spline36 interpolation of the converted imagery - ### Changing Input & Output File Names ### To change the name of the input and output files you can edit the .bat scripts using a plain text editor. All image sequences start on frame number 0 (eg. 0.jpg) diff --git a/rect2dome.bat b/rect2dome.bat index 923c6a3..d9dce3c 100644 --- a/rect2dome.bat +++ b/rect2dome.bat @@ -1,7 +1,7 @@ @ECHO OFF -@title rect2dome v1.5 - immersive transformations +@title rect2dome v1.6 - immersive transformations -echo rect2dome v1.5 - 2016-03-28 +echo rect2dome v1.6 - 2016-08-18 echo script by Andrew Hazelden echo ---------------------------------------------------------------------- echo dome2rect converts a rectilinear image sequence into the fisheye format @@ -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=rect2dome REM @set input=input\rect.0001.jpg @@ -26,7 +29,10 @@ REM @set output=output\sequence.%%d.jpg REM Process a 4 digit padded image sequence: @set ptscript=rect2dome @set input=input\rect.%%.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\ diff --git a/review.bat b/review.bat index b33bacc..66dfdf9 100644 --- a/review.bat +++ b/review.bat @@ -1,7 +1,7 @@ @ECHO OFF -@title Review v1.5 - immersive transformations +@title Review v1.6 - immersive transformations -echo Review v1.5 - 2016-03-30 +echo Review v1.6 - 2016-08-18 echo --------------------------------- echo Show the converted imagery generated by dome2rect echo using the ffmpeg player utility