Snippets

WeberCode Bash Stereo Alignment

Created by Troy Weber
#!/usr/bin/env bash

# This simple script takes a project name, the left, and the right image, and creates a variety of formats for your 3D pleasure
#
# Global Dependencies:
#   - hugin: supplies the align_image_stack script
#   - image-magik: has a composite command for creating the anaglyph and the convert command for creating .jps
#
# If you want to create a .mpo for this to view on a 3DS or other, it is recommended at this time to use 
# Stereo Photo Maker which can be found at http://stereo.jpn.org/eng/stphmkr/

PROJ=$1
LEFT=$2
RIGHT=$3

echo $PROJ $LEFT $RIGHT

# create project folder
if [[ ! -d $PROJ ]]; then mkdir -p $PROJ; fi

# align iamges using hugin align_image_stack
align_image_stack -p $PROJ/$PROJ.pto -a ${PROJ}_ -m -i -P -C $LEFT $RIGHT

# copy extra files project folder and cd to folder
mv ${PROJ}_* $PROJ/
cd $PROJ

# create our stereo image types
ALIGN1=${PROJ}_0000.tif
ALIGN2=${PROJ}_0001.tif

composite -stereo 0 $ALIGN1 $ALIGN2 ${PROJ}_anaglyph.jpg
convert $ALIGN1 $ALIGN2 +append ${PROJ}.jps
convert $ALIGN2 $ALIGN1 +append ${PROJ}_xeye.jps

Comments (0)

HTTPS SSH

You can clone a snippet to your computer for local editing. Learn more.