pull/1/head
Daniel 2010-10-30 13:49:56 +02:00
commit ba25e13ec6
13 zmienionych plików z 745 dodań i 0 usunięć

0
README 100644
Wyświetl plik

198
install.sh 100755
Wyświetl plik

@ -0,0 +1,198 @@
#!/bin/bash
echo "created by Daniel Schwarz/daniel.schwarz@topoi.org"
echo "released under Creative Commons/CC-BY-NC"
echo "Attribution Non-Commercial"
ARCH=`uname -m`
TOOLS_PATH=$PWD
TOOLS_BIN_PATH=$TOOLS_PATH/bin
INC_PATH="/usr/include"
LIB_PATH="/usr/lib"
BIN_PATH="/usr/bin"
BUNDLER_PATH="$TOOLS_PATH/bundler"
CMVS_PATH="$TOOLS_PATH/cmvs"
PMVS_PATH="$TOOLS_PATH/pmvs"
SIFT_PATH="$TOOLS_PATH/lib/sift"
SIFTFEAT_PATH="$TOOLS_PATH/lib/siftfeat"
GRACLUS_PATH="$TOOLS_PATH/lib/graclus"
CLAPACK_PATH="$TOOLS_PATH/lib/clapack"
OPENCV_PATH="$TOOLS_PATH/lib/openCv"
echo
echo ---- installing required packages ----
echo
sudo apt-get update
sudo apt-get install --assume-yes --install-recommends \
gcc g++ gFortran cmake build-essential \
imagemagick unzip wget \
libzip-dev libjpeg-dev libtiff-dev libpng-dev libjasper-dev libann-dev \
libavformat-dev ffmpeg python-opencv opencv-doc libcv-dev libcvaux-dev libhighgui-dev \
libgsl0-dev libgsl0ldbl \
libblas-dev libblas3gf \
libhighgui-dev libcvaux-dev libcv-dev \
liblapack-dev liblapack3gf \
libx11-data libx11-dev libx11-6 \
jhead \
gtk2-engines doxygen \
libpthread-stubs0 libpthread-stubs0-dev \
libxext-dev libxext6 \
libboost-dev
echo
echo ---- getting the tools ----
echo
wget --no-check-certificate http://www.netlib.org/clapack/clapack-3.2.1-CMAKE.tgz \
http://phototour.cs.washington.edu/bundler/distr/bundler-v0.4-source.zip \
http://www.cs.ubc.ca/~lowe/keypoints/siftDemoV4.zip \
http://grail.cs.washington.edu/software/pmvs/pmvs-2.tar.gz \
https://www.topoi.hu-berlin.de/graclus1.2.tar.gz \
http://grail.cs.washington.edu/software/cmvs/cmvs.tar.gz \
http://sourceforge.net/projects/opencvlibrary/files/opencv-unix/2.1/OpenCV-2.1.0.tar.bz2/download \
http://web.engr.oregonstate.edu/~hess/downloads/sift/sift-latest.tar.gz
echo
echo ---- unzipping ----
echo
tar -xzf clapack-3.2.1-CMAKE.tgz& PID_CLAPACK=$!
unzip -q bundler-v0.4-source.zip& PID_BUNDLER=$!
tar -xzf pmvs-2.tar.gz& PID_PMVS=$!
tar -xzf cmvs.tar.gz& PID_CMVS=$!
tar -xzf graclus1.2.tar.gz& PID_GRACLUS=$!
unzip -q siftDemoV4.zip& PID_SIFT=$!
tar -xf OpenCV-2.1.0.tar.bz2& PID_OPENCV=$!
tar -xzf sift-latest.tar.gz& PID_SIFTFEAT=$!
wait $PID_CLAPACK
wait $PID_BUNDLER
wait $PID_PMVS
wait $PID_CMVS
wait $PID_GRACLUS
wait $PID_SIFT
wait $PID_OPENCV
wait $PID_SIFTFEAT
rm clapack-3.2.1-CMAKE.tgz
rm bundler-v0.4-source.zip
rm pmvs-2.tar.gz
rm graclus1.2.tar.gz
rm cmvs.tar.gz
rm siftDemoV4.zip
rm OpenCV-2.1.0.tar.bz2
rm sift-latest.tar.gz
echo
echo ---- renaming ----
echo
mkdir -p $TOOLS_PATH/lib
mv -f clapack-3.2.1-CMAKE $CLAPACK_PATH
mv -f bundler-v0.4-source $BUNDLER_PATH
mv -f graclus1.2 $GRACLUS_PATH
mv -f siftDemoV4 $SIFT_PATH
mv -f pmvs-2 $PMVS_PATH
mv -f cmvs $CMVS_PATH
mv -f sift $SIFTFEAT_PATH
mv -f OpenCV-2.1.0 $OPENCV_PATH
sudo cp -R $CLAPACK_PATH/INCLUDE $INC_PATH/clapack
echo
echo ---- fixing ----
echo
sed -i $CMVS_PATH/program/main/genOption.cc -e "5c\#include <stdlib.h>\n"
sed -i $CMVS_PATH/program/base/cmvs/bundle.cc -e "3c\#include <numeric>\n"
sed -i $CMVS_PATH/program/main/Makefile -e "10c\#Your INCLUDE path (e.g., -I\/usr\/include)"
sed -i $CMVS_PATH/program/main/Makefile -e "11c\YOUR_INCLUDE_PATH =-I$INC_PATH"
sed -i $CMVS_PATH/program/main/Makefile -e "13c\#Your metis directory (contains header files under graclus1.2/metisLib/)"
sed -i $CMVS_PATH/program/main/Makefile -e "14c\YOUR_INCLUDE_METIS_PATH = -I$GRACLUS_PATH/metisLib/"
sed -i $CMVS_PATH/program/main/Makefile -e "16c\#Your LDLIBRARY path (e.g., -L/usr/lib)"
sed -i $CMVS_PATH/program/main/Makefile -e "17c\YOUR_LDLIB_PATH = -L$LIB_PATH"
if [ "$ARCH" = "i686" ]; then
sed -i $CMVS_PATH/program/main/Makefile -e "22c\CXXFLAGS_CMVS = -O2 -Wall -Wno-deprecated -DNUMBITS=32 \\\\"
sed -i $CMVS_PATH/program/main/Makefile -e '24c\ -fopenmp -DNUMBITS=32 ${OPENMP_FLAG}'
fi
if [ "$ARCH" = "x86_64" ]; then
sed -i $CMVS_PATH/program/main/Makefile -e "22c\CXXFLAGS_CMVS = -O2 -Wall -Wno-deprecated -DNUMBITS=64 \\\\"
sed -i $CMVS_PATH/program/main/Makefile -e '24c\ -fopenmp -DNUMBITS=64 ${OPENMP_FLAG}'
fi
sed -i $PMVS_PATH/program/main/Makefile -e "11c\#Your INCLUDE path (e.g., -I\/usr\/include)"
sed -i $PMVS_PATH/program/main/Makefile -e "12c\YOUR_INCLUDE_PATH =-I$INC_PATH"
sed -i $PMVS_PATH/program/main/Makefile -e "14c\#Your LDLIBRARY path (e.g., -L/usr/lib)"
sed -i $PMVS_PATH/program/main/Makefile -e "15c\YOUR_LDLIB_PATH = -L$LIB_PATH"
sed -i $BUNDLER_PATH/bin/extract_focal.pl -e '18c\ $JHEAD_EXE = "jhead";'
sed -i $BUNDLER_PATH/bin/ToSift.sh -e '36c\ echo "SIFT -o $key_file -x $d; gzip -f $key_file"'
echo
echo ---- building ----
echo
sudo chown -R $USER:$USER *
sudo chmod -R 755 *
cd $OPENCV_PATH
cmake .
sudo make
sudo make install
cd $SIFTFEAT_PATH
sudo make
cd $CLAPACK_PATH
cp make.inc.example make.inc
sudo make
sudo make lapack_install
cd $BUNDLER_PATH
rm -f bin/bundler bin/Bundle2PMVS bin/Bundle2Vis bin/bundler bin/jhead bin/jhead.exe bin/KeyMatchFull bin/libANN_char.so bin/RadialUndistort bin/zlib1.dll
sudo make clean
sudo make
cd $GRACLUS_PATH
sudo make
sudo cp lib* /usr/lib/
cd $PMVS_PATH/program/main
sudo make clean
sudo make depend
sudo make
cd $CMVS_PATH/program/main
sudo make clean
sudo make depend
sudo make
cd $TOOLS_PATH
echo
echo ---- copying to dest loactions ----
echo
mkdir $TOOLS_BIN_PATH
cd $TOOLS_BIN_PATH
wget --no-check-certificate https://www.topoi.hu-berlin.de/run.sh
sudo chmod a+x $TOOLS_BIN_PATH/run.sh
cp $SIFT_PATH/sift $TOOLS_BIN_PATH/
cp $SIFTFEAT_PATH/bin/siftfeat $TOOLS_BIN_PATH/
cp $BUNDLER_PATH/bin/Bundle2PMVS $BUNDLER_PATH/bin/Bundle2Vis $BUNDLER_PATH/bin/KeyMatchFull $BUNDLER_PATH/bin/bundler $BUNDLER_PATH/bin/extract_focal.pl $BUNDLER_PATH/bin/RadialUndistort $TOOLS_BIN_PATH/
cp $CMVS_PATH/program/main/cmvs $CMVS_PATH/program/main/pmvs2 $CMVS_PATH/program/main/genOption $TOOLS_BIN_PATH/
sudo cp $BUNDLER_PATH/lib/libANN_char.so $LIB_PATH/
exit

34
run-0-mogrify.sh 100644
Wyświetl plik

@ -0,0 +1,34 @@
#!/bin/bash
BASE_PATH=$(dirname $(which $0));
IMAGE_DIR="."
EXTRACT_FOCAL=$BASE_PATH/extract_focal.pl
MATCHKEYS=$BASE_PATH/KeyMatchFull
BUNDLER=$BASE_PATH/bundler
BUNDLE2PVMS=$BASE_PATH/Bundle2PMVS
CMVS=$BASE_PATH/cmvs
PMVS=$BASE_PATH/pmvs2
GENOPTION=$BASE_PATH/genOption
SIFT=$BASE_PATH/sift
SIFTFEAT=$BASE_PATH/siftfeat
if [ $# -eq 1 ]
then
echo "Using directory '$1'"
IMAGE_DIR=$1
fi
# Rename ".JPG" to ".jpg"
for d in `ls -1 $IMAGE_DIR | egrep ".JPG$"`
do
mv $d `echo $d | sed 's/\.JPG/\.jpg/'`
done
echo
echo '[- Scaling images -]'
echo
mogrify -resize 1600x1200 -quality 100 *
exit

Wyświetl plik

@ -0,0 +1,48 @@
#!/bin/bash
BASE_PATH=$(dirname $(which $0));
IMAGE_DIR="."
EXTRACT_FOCAL=$BASE_PATH/extract_focal.pl
MATCHKEYS=$BASE_PATH/KeyMatchFull
BUNDLER=$BASE_PATH/bundler
BUNDLE2PVMS=$BASE_PATH/Bundle2PMVS
CMVS=$BASE_PATH/cmvs
PMVS=$BASE_PATH/pmvs2
GENOPTION=$BASE_PATH/genOption
SIFT=$BASE_PATH/sift
SIFTFEAT=$BASE_PATH/siftfeat
if [ $# -eq 1 ]
then
echo "Using directory '$1'"
IMAGE_DIR=$1
fi
# Rename ".JPG" to ".jpg"
for d in `ls -1 $IMAGE_DIR | egrep ".JPG$"`
do
mv $d `echo $d | sed 's/\.JPG/\.jpg/'`
done
# Create the list of images
find $IMAGE_DIR -maxdepth 1 | egrep ".jpg$" | sort > list_tmp.txt
$EXTRACT_FOCAL list_tmp.txt
cp prepare/list.txt .
echo
echo '[- Extracting keypoints -]'
echo
for d in `ls -1 $IMAGE_DIR | egrep "jpg$"`
do
key_file=`echo $d | sed 's/jpg$/key/'`
pgm_file=`echo $d | sed 's/jpg$/pgm/'`
jpg_file=`echo $d`
# SIFT_CMD="$SIFTFEAT -o $IMAGE_DIR/$key_file -x $IMAGE_DIR/$jpg_file; gzip -f $IMAGE_DIR/$key_file"
SIFT_CMD="mogrify -format pgm $IMAGE_DIR/$jpg_file; $SIFT < $IMAGE_DIR/$pgm_file > $IMAGE_DIR/$key_file; rm $IMAGE_DIR/$pgm_file; gzip -f $IMAGE_DIR/$key_file"
eval $SIFT_CMD
done
exit

124
run-1.sh 100644
Wyświetl plik

@ -0,0 +1,124 @@
BASE_PATH=$(dirname $(which $0));
IMAGE_DIR="."
EXTRACT_FOCAL=$BASE_PATH/extract_focal.pl
MATCHKEYS=$BASE_PATH/KeyMatchFull
BUNDLER=$BASE_PATH/bundler
BUNDLE2PVMS=$BASE_PATH/Bundle2PMVS
CMVS=$BASE_PATH/cmvs
PMVS=$BASE_PATH/pmvs2
GENOPTION=$BASE_PATH/genOption
SIFT=$BASE_PATH/sift
SIFTFEAT=$BASE_PATH/siftfeat
if [ $# -eq 1 ]
then
echo "Using directory '$1'"
IMAGE_DIR=$1
fi
# Rename ".JPG" to ".jpg"
for d in `ls -1 $IMAGE_DIR | egrep ".JPG$"`
do
mv $d `echo $d | sed 's/\.JPG/\.jpg/'`
done
echo
echo '[- Scaling images -]'
echo
mogrify -resize 1600x1200 -quality 100 *
# Create the list of images
find $IMAGE_DIR -maxdepth 1 | egrep ".jpg$" | sort > list_tmp.txt
$EXTRACT_FOCAL list_tmp.txt
cp prepare/list.txt .
echo
echo '[- Extracting keypoints -]'
echo
for d in `ls -1 $IMAGE_DIR | egrep "jpg$"`
do
key_file=`echo $d | sed 's/jpg$/key/'`
pgm_file=`echo $d | sed 's/jpg$/pgm/'`
jpg_file=`echo $d`
SIFT_CMD="$SIFTFEAT -o $IMAGE_DIR/$key_file -x $IMAGE_DIR/$jpg_file; gzip -f $IMAGE_DIR/$key_file"
# SIFT_CMD="mogrify -format pgm $IMAGE_DIR/$jpg_file; $SIFT < $IMAGE_DIR/$pgm_file > $IMAGE_DIR/$key_file; rm $IMAGE_DIR/$pgm_file; gzip -f $IMAGE_DIR/$key_file"
eval $SIFT_CMD
done
# Match images (can take a while)
echo
echo '[- Matching keypoints (this can take a while) -]'
echo
sed 's/\.jpg$/\.key/' $IMAGE_DIR/list_tmp.txt > $IMAGE_DIR/list_keys.txt
echo $MATCHKEYS $IMAGE_DIR/list_keys.txt $IMAGE_DIR/matches.init.txt
$MATCHKEYS $IMAGE_DIR/list_keys.txt $IMAGE_DIR/matches.init.txt
mkdir bundle
rm -f $IMAGE_DIR/options.txt
echo "--match_table matches.init.txt" >> options.txt
echo "--output bundle.out" >> options.txt
echo "--output_all bundle_" >> options.txt
echo "--output_dir bundle" >> options.txt
echo "--variable_focal_length" >> options.txt
echo "--use_focal_estimate" >> options.txt
echo "--constrain_focal" >> options.txt
echo "--constrain_focal_weight 0.0001" >> options.txt
echo "--estimate_distortion" >> options.txt
echo "--run_bundle" >> options.txt
# Run Bundler!
echo
echo '[- Running Bundler -]'
echo
rm -f $IMAGE_DIR/constraints.txt
rm -f $IMAGE_DIR/pairwise_scores.txt
$BUNDLER $IMAGE_DIR/list.txt --options_file $IMAGE_DIR/options.txt > $IMAGE_DIR/bundle/out
# Run Bundle2PMVS!
echo
echo '[- Running Bundle2PMVS -]'
echo
$BUNDLE2PVMS list.txt bundle/bundle.out
# Run prep_pmvs!
echo
echo '[- Running prep_pmvs -]'
echo
sed -i $IMAGE_DIR/pmvs/prep_pmvs.sh -e "4c\BUNDLER_BIN_PATH=\"$BASE_PATH\""
sh pmvs/prep_pmvs.sh
# Run cmvs!
echo
echo '[- Running cmvs -]'
echo
$CMVS pmvs/ 20
# Run pmvs!
echo
echo '[- Running genOption -]'
echo
$GENOPTION pmvs/
# Run prep_pmvs!
echo
echo '[- Running pmvs -]'
echo
$PMVS pmvs/ option-0000
#sh pmvs/pmvs.sh
echo
echo '[- Done -]'
echo

Wyświetl plik

@ -0,0 +1,38 @@
#!/bin/bash
BASE_PATH=$(dirname $(which $0));
IMAGE_DIR="."
EXTRACT_FOCAL=$BASE_PATH/extract_focal.pl
MATCHKEYS=$BASE_PATH/KeyMatchFull
BUNDLER=$BASE_PATH/bundler
BUNDLE2PVMS=$BASE_PATH/Bundle2PMVS
CMVS=$BASE_PATH/cmvs
PMVS=$BASE_PATH/pmvs2
GENOPTION=$BASE_PATH/genOption
SIFT=$BASE_PATH/sift
SIFTFEAT=$BASE_PATH/siftfeat
if [ $# -eq 1 ]
then
echo "Using directory '$1'"
IMAGE_DIR=$1
fi
# Rename ".JPG" to ".jpg"
for d in `ls -1 $IMAGE_DIR | egrep ".JPG$"`
do
mv $d `echo $d | sed 's/\.JPG/\.jpg/'`
done
# Match images (can take a while)
echo
echo '[- Matching keypoints (this can take a while) -]'
echo
sed 's/\.jpg$/\.key/' $IMAGE_DIR/list_tmp.txt > $IMAGE_DIR/list_keys.txt
echo $MATCHKEYS $IMAGE_DIR/list_keys.txt $IMAGE_DIR/matches.init.txt
$MATCHKEYS $IMAGE_DIR/list_keys.txt $IMAGE_DIR/matches.init.txt
exit

45
run-3-bundler.sh 100644
Wyświetl plik

@ -0,0 +1,45 @@
#!/bin/bash
BASE_PATH=$(dirname $(which $0));
IMAGE_DIR="."
EXTRACT_FOCAL=$BASE_PATH/extract_focal.pl
MATCHKEYS=$BASE_PATH/KeyMatchFull
BUNDLER=$BASE_PATH/bundler
BUNDLE2PVMS=$BASE_PATH/Bundle2PMVS
CMVS=$BASE_PATH/cmvs
PMVS=$BASE_PATH/pmvs2
GENOPTION=$BASE_PATH/genOption
SIFT=$BASE_PATH/sift
SIFTFEAT=$BASE_PATH/siftfeat
if [ $# -eq 1 ]
then
echo "Using directory '$1'"
IMAGE_DIR=$1
fi
# Run Bundler!
echo
echo '[- Running Bundler -]'
echo
mkdir bundle
rm -f $IMAGE_DIR/options.txt
echo "--match_table matches.init.txt" >> options.txt
echo "--output bundle.out" >> options.txt
echo "--output_all bundle_" >> options.txt
echo "--output_dir bundle" >> options.txt
echo "--variable_focal_length" >> options.txt
echo "--use_focal_estimate" >> options.txt
echo "--constrain_focal" >> options.txt
echo "--constrain_focal_weight 0.0001" >> options.txt
echo "--estimate_distortion" >> options.txt
echo "--run_bundle" >> options.txt
rm -f $IMAGE_DIR/constraints.txt
rm -f $IMAGE_DIR/pairwise_scores.txt
$BUNDLER $IMAGE_DIR/list.txt --options_file $IMAGE_DIR/options.txt > $IMAGE_DIR/bundle/out
exit

Wyświetl plik

@ -0,0 +1,32 @@
#!/bin/bash
BASE_PATH=$(dirname $(which $0));
IMAGE_DIR="."
EXTRACT_FOCAL=$BASE_PATH/extract_focal.pl
MATCHKEYS=$BASE_PATH/KeyMatchFull
BUNDLER=$BASE_PATH/bundler
BUNDLE2PVMS=$BASE_PATH/Bundle2PMVS
CMVS=$BASE_PATH/cmvs
PMVS=$BASE_PATH/pmvs2
GENOPTION=$BASE_PATH/genOption
SIFT=$BASE_PATH/sift
SIFTFEAT=$BASE_PATH/siftfeat
if [ $# -eq 1 ]
then
echo "Using directory '$1'"
IMAGE_DIR=$1
fi
# Run Bundle2PMVS!
echo
echo '[- Running Bundle2PMVS -]'
echo
$BUNDLE2PVMS list.txt bundle/bundle.out
sed -i $IMAGE_DIR/pmvs/prep_pmvs.sh -e "4c\BUNDLER_BIN_PATH=\"$BASE_PATH\""
sh pmvs/prep_pmvs.sh#!/bin/bash
exit

29
run-5-cmvs.sh 100644
Wyświetl plik

@ -0,0 +1,29 @@
#!/bin/bash
BASE_PATH=$(dirname $(which $0));
IMAGE_DIR="."
EXTRACT_FOCAL=$BASE_PATH/extract_focal.pl
MATCHKEYS=$BASE_PATH/KeyMatchFull
BUNDLER=$BASE_PATH/bundler
BUNDLE2PVMS=$BASE_PATH/Bundle2PMVS
CMVS=$BASE_PATH/cmvs
PMVS=$BASE_PATH/pmvs2
GENOPTION=$BASE_PATH/genOption
SIFT=$BASE_PATH/sift
SIFTFEAT=$BASE_PATH/siftfeat
if [ $# -eq 1 ]
then
echo "Using directory '$1'"
IMAGE_DIR=$1
fi
# Run cmvs!
echo
echo '[- Running cmvs -]'
echo
$CMVS pmvs/ 20
exit

29
run-6-genOption.sh 100644
Wyświetl plik

@ -0,0 +1,29 @@
#!/bin/bash
BASE_PATH=$(dirname $(which $0));
IMAGE_DIR="."
EXTRACT_FOCAL=$BASE_PATH/extract_focal.pl
MATCHKEYS=$BASE_PATH/KeyMatchFull
BUNDLER=$BASE_PATH/bundler
BUNDLE2PVMS=$BASE_PATH/Bundle2PMVS
CMVS=$BASE_PATH/cmvs
PMVS=$BASE_PATH/pmvs2
GENOPTION=$BASE_PATH/genOption
SIFT=$BASE_PATH/sift
SIFTFEAT=$BASE_PATH/siftfeat
if [ $# -eq 1 ]
then
echo "Using directory '$1'"
IMAGE_DIR=$1
fi
# Run genOption!
echo
echo '[- Running genOption -]'
echo
$GENOPTION pmvs/
exit

30
run-7-pmvs.sh 100644
Wyświetl plik

@ -0,0 +1,30 @@
#!/bin/bash
BASE_PATH=$(dirname $(which $0));
IMAGE_DIR="."
EXTRACT_FOCAL=$BASE_PATH/extract_focal.pl
MATCHKEYS=$BASE_PATH/KeyMatchFull
BUNDLER=$BASE_PATH/bundler
BUNDLE2PVMS=$BASE_PATH/Bundle2PMVS
CMVS=$BASE_PATH/cmvs
PMVS=$BASE_PATH/pmvs2
GENOPTION=$BASE_PATH/genOption
SIFT=$BASE_PATH/sift
SIFTFEAT=$BASE_PATH/siftfeat
if [ $# -eq 1 ]
then
echo "Using directory '$1'"
IMAGE_DIR=$1
fi
# Run pmvs!
echo
echo '[- Running pmvs -]'
echo
$PMVS pmvs/ option-0000
#sh pmvs/pmvs.sh
exit

14
run-all.sh 100644
Wyświetl plik

@ -0,0 +1,14 @@
#!/bin/bash
BASE_PATH=$(dirname $(which $0));
sh $BASE_PATH/run-0-mogrify.sh
sh $BASE_PATH/run-1-get-keypoints.sh
sh $BASE_PATH/run-2-match-keypoints.sh
sh $BASE_PATH/run-3-bundler.sh
sh $BASE_PATH/run-4-bundle2pmvs.sh
sh $BASE_PATH/run-5-cmvs.sh
sh $BASE_PATH/run-6-genOption.sh
sh $BASE_PATH/run-7-pmvs.sh
exit

124
run.sh 100755
Wyświetl plik

@ -0,0 +1,124 @@
BASE_PATH=$(dirname $(which $0));
IMAGE_DIR="."
EXTRACT_FOCAL=$BASE_PATH/extract_focal.pl
MATCHKEYS=$BASE_PATH/KeyMatchFull
BUNDLER=$BASE_PATH/bundler
BUNDLE2PVMS=$BASE_PATH/Bundle2PMVS
CMVS=$BASE_PATH/cmvs
PMVS=$BASE_PATH/pmvs2
GENOPTION=$BASE_PATH/genOption
SIFT=$BASE_PATH/sift
SIFTFEAT=$BASE_PATH/siftfeat
if [ $# -eq 1 ]
then
echo "Using directory '$1'"
IMAGE_DIR=$1
fi
# Rename ".JPG" to ".jpg"
for d in `ls -1 $IMAGE_DIR | egrep ".JPG$"`
do
mv $d `echo $d | sed 's/\.JPG/\.jpg/'`
done
echo
echo '[- Scaling images -]'
echo
mogrify -resize 1600x1200 -quality 100 *
# Create the list of images
find $IMAGE_DIR -maxdepth 1 | egrep ".jpg$" | sort > list_tmp.txt
$EXTRACT_FOCAL list_tmp.txt
cp prepare/list.txt .
echo
echo '[- Extracting keypoints -]'
echo
for d in `ls -1 $IMAGE_DIR | egrep "jpg$"`
do
key_file=`echo $d | sed 's/jpg$/key/'`
pgm_file=`echo $d | sed 's/jpg$/pgm/'`
jpg_file=`echo $d`
SIFT_CMD="$SIFTFEAT -o $IMAGE_DIR/$key_file -x $IMAGE_DIR/$jpg_file; gzip -f $IMAGE_DIR/$key_file"
# SIFT_CMD="mogrify -format pgm $IMAGE_DIR/$jpg_file; $SIFT < $IMAGE_DIR/$pgm_file > $IMAGE_DIR/$key_file; rm $IMAGE_DIR/$pgm_file; gzip -f $IMAGE_DIR/$key_file"
eval $SIFT_CMD
done
# Match images (can take a while)
echo
echo '[- Matching keypoints (this can take a while) -]'
echo
sed 's/\.jpg$/\.key/' $IMAGE_DIR/list_tmp.txt > $IMAGE_DIR/list_keys.txt
echo $MATCHKEYS $IMAGE_DIR/list_keys.txt $IMAGE_DIR/matches.init.txt
$MATCHKEYS $IMAGE_DIR/list_keys.txt $IMAGE_DIR/matches.init.txt
mkdir bundle
rm -f $IMAGE_DIR/options.txt
echo "--match_table matches.init.txt" >> options.txt
echo "--output bundle.out" >> options.txt
echo "--output_all bundle_" >> options.txt
echo "--output_dir bundle" >> options.txt
echo "--variable_focal_length" >> options.txt
echo "--use_focal_estimate" >> options.txt
echo "--constrain_focal" >> options.txt
echo "--constrain_focal_weight 0.0001" >> options.txt
echo "--estimate_distortion" >> options.txt
echo "--run_bundle" >> options.txt
# Run Bundler!
echo
echo '[- Running Bundler -]'
echo
rm -f $IMAGE_DIR/constraints.txt
rm -f $IMAGE_DIR/pairwise_scores.txt
$BUNDLER $IMAGE_DIR/list.txt --options_file $IMAGE_DIR/options.txt > $IMAGE_DIR/bundle/out
# Run Bundle2PMVS!
echo
echo '[- Running Bundle2PMVS -]'
echo
$BUNDLE2PVMS list.txt bundle/bundle.out
# Run prep_pmvs!
echo
echo '[- Running prep_pmvs -]'
echo
sed -i $IMAGE_DIR/pmvs/prep_pmvs.sh -e "4c\BUNDLER_BIN_PATH=\"$BASE_PATH\""
sh pmvs/prep_pmvs.sh
# Run cmvs!
echo
echo '[- Running cmvs -]'
echo
$CMVS pmvs/ 20
# Run pmvs!
echo
echo '[- Running genOption -]'
echo
$GENOPTION pmvs/
# Run prep_pmvs!
echo
echo '[- Running pmvs -]'
echo
$PMVS pmvs/ option-0000
#sh pmvs/pmvs.sh
echo
echo '[- Done -]'
echo