Merge branch 'paulinus-update-opensfm' into python-port

pull/206/merge
Dakota Benjamin 2015-11-12 14:00:40 +00:00
commit 0b03e484b9
3 zmienionych plików z 68 dodań i 51 usunięć

Wyświetl plik

@ -301,6 +301,7 @@
"SONY DSC-W5": 7.176,
"SONY DSC-W7": 7.176,
"SONY DSC-W80": 5.75,
"SONY DSC-WX220": 7.70,
"SONY ILCE-7S": 35.8,
"SONY ILCE-5100": 23.5,
"SONY NEX-5T": 23.4,

Wyświetl plik

@ -22,7 +22,7 @@ echo " - script started - `date`"
TOOLS_BIN_PATH="$TOOLS_PATH/bin"
TOOLS_INC_PATH="$TOOLS_PATH/include"
TOOLS_LIB_PATH="$TOOLS_PATH/lib"
TOOLS_SRC_PATH="$TOOLS_PATH/src"
TOOLS_SRC_PATH="$TOOLS_PATH/src"
TOOLS_LOG_PATH="$TOOLS_PATH/logs"
TOOLS_PATCHED_PATH="$TOOLS_PATH/patched_files"
@ -40,8 +40,7 @@ echo " - script started - `date`"
PSR_PATH="$TOOLS_SRC_PATH/PoissonRecon"
GRACLUS_PATH="$TOOLS_SRC_PATH/graclus"
CERES_PATH="$TOOLS_SRC_PATH/ceres-solver"
OPENCV_PATH="$TOOLS_SRC_PATH/opencv"
PCL_PATH="$TOOLS_SRC_PATH/pcl"
LASTOOLS_PATH="$TOOLS_SRC_PATH/lastools"
ODM_MESHING_PATH="$TOOLS_SRC_PATH/odm_meshing"
@ -50,6 +49,7 @@ echo " - script started - `date`"
ODM_EXTRACT_UTM_PATH="$TOOLS_SRC_PATH/odm_extract_utm"
ODM_GEOREF_PATH="$TOOLS_SRC_PATH/odm_georef"
OPENGV_PATH="$TOOLS_SRC_PATH/opengv"
OPENSFM_PATH="$TOOLS_SRC_PATH/OpenSfM"
## executables
@ -108,17 +108,12 @@ uname -a > "$TOOLS_LOG_PATH/sysinfo.txt"
echo
echo " > installing required packages"
echo " - installing git submodules"
git submodule init
git submodule update
echo " - updating"
sudo apt-get update --assume-yes > "$TOOLS_LOG_PATH/apt-get_get.log" 2>&1
echo " - installing"
if [[ `lsb_release -rs` == "12.04" ]];
then
then
sudo apt-get install --assume-yes --install-recommends \
build-essential cmake g++ gcc gFortran perl git autoconf \
curl wget \
@ -128,6 +123,7 @@ sudo apt-get install --assume-yes --install-recommends \
libeigen3-dev libflann-dev libvtk5-dev libqhull-dev libusb-1.0-0-dev\
libzip-dev \
libswitch-perl libjson-perl \
libcv-dev libcvaux-dev libopencv-dev \
gdal-bin \
exiv2 \
libgoogle-glog-dev libatlas-base-dev libsuitesparse-dev \
@ -143,17 +139,21 @@ sudo apt-get install --assume-yes --install-recommends \
libjson-perl \
libzip-dev \
libswitch-perl \
libcv-dev libcvaux-dev libopencv-dev \
libgoogle-glog-dev libatlas-base-dev libeigen3-dev libsuitesparse-dev \
python-dev python-pip libboost-python-dev \
python-numpy-dev python-scipy python-yaml \
python-opencv \
python-pyexiv2 \
python-opencv python-pyexiv2 \
gdal-bin \
exiv2 \
> "$TOOLS_LOG_PATH/apt-get_install.log" 2>&1
fi
sudo pip install networkx exifread
sudo pip install networkx exifread xmltodict
echo " - installing git submodules"
git submodule init
git submodule update
echo " < done - `date`"
@ -186,9 +186,9 @@ cmvs.tar.gz http://www.di.ens.fr/cmvs/cmvs-fix2.tar.gz
graclus.tar.gz http://smathermather.github.io/BundlerTools/patched_files/src/graclus/graclus1.2.tar.gz
pcl.tar.gz https://github.com/PointCloudLibrary/pcl/archive/pcl-1.7.2.tar.gz
ceres-solver.tar.gz http://ceres-solver.org/ceres-solver-1.10.0.tar.gz
opencv.zip https://github.com/Itseez/opencv/archive/2.4.11.zip
LAStools.zip http://lastools.org/download/LAStools.zip
EOF
git clone https://github.com/paulinus/opengv.git $OPENGV_PATH
git clone https://github.com/mapillary/OpenSfM.git $OPENSFM_PATH
echo " < done - `date`"
@ -217,7 +217,6 @@ mv -f PoissonRecon "$PSR_PATH"
mv -f cmvs "$CMVS_PATH"
mv -f pcl-pcl-1.7.2 "$PCL_PATH"
mv -f ceres-solver-1.10.0 "$CERES_PATH"
mv -f opencv-2.4.11 "$OPENCV_PATH"
mv -f LAStools "$LASTOOLS_PATH"
@ -260,7 +259,7 @@ echo " > graclus"
make clean > "$TOOLS_LOG_PATH/graclus_1_clean.log" 2>&1
echo " - building graclus"
make -j > "$TOOLS_LOG_PATH/graclus_2_build.log" 2>&1
make -j$CORES > "$TOOLS_LOG_PATH/graclus_2_build.log" 2>&1
mkdir "$TOOLS_INC_PATH/metisLib"
cp -f "$GRACLUS_PATH/metisLib/"*.h "$TOOLS_INC_PATH/metisLib/"
@ -275,7 +274,7 @@ echo " > poisson surface reconstruction "
sed -i "$PSR_PATH/Makefile" -e "21c\BIN = ./"
echo " - building poisson surface reconstruction"
make -j > "$TOOLS_LOG_PATH/poisson_1_build.log" 2>&1
make -j$CORES > "$TOOLS_LOG_PATH/poisson_1_build.log" 2>&1
cp -f "$PSR_PATH/PoissonRecon" "$TOOLS_BIN_PATH/PoissonRecon"
@ -290,7 +289,7 @@ echo " > parallel"
./configure > "$TOOLS_LOG_PATH/parallel_1_build.log" 2>&1
echo " - building paralel"
make -j > "$TOOLS_LOG_PATH/parallel_2_build.log" 2>&1
make -j$CORES> "$TOOLS_LOG_PATH/parallel_2_build.log" 2>&1
cp -f src/parallel "$TOOLS_BIN_PATH/"
@ -304,11 +303,11 @@ echo " > clapack"
set +e
echo " - building clapack"
make all -j > "$TOOLS_LOG_PATH/clapack_1_build.log" 2>&1
make -j$CORES all > "$TOOLS_LOG_PATH/clapack_1_build.log" 2>&1
set -e
echo " - installing clapack"
make lapack_install > "$TOOLS_LOG_PATH/clapack_2_install.log" 2>&1
make -j$CORES lapack_install > "$TOOLS_LOG_PATH/clapack_2_install.log" 2>&1
sudo cp -Rf INCLUDE "$INC_PATH/clapack"
@ -338,7 +337,7 @@ echo " > LAStools"
echo " - installing LAStools"
make > "$TOOLS_LOG_PATH/lastools_1_build.log" 2>&1
make -j$CORES > "$TOOLS_LOG_PATH/lastools_1_build.log" 2>&1
if [ "$ARCH" = "i686" ]; then
cp -f "$LASTOOLS_PATH/bin/txt2las" "$TOOLS_BIN_PATH/txt2las"
@ -378,7 +377,7 @@ echo " > cmvs/pmvs"
make clean > "$TOOLS_LOG_PATH/cmvs_1_clean.log" 2>&1
echo " - building cmvs"
make -j > "$TOOLS_LOG_PATH/cmvs_2_build.log" 2>&1
make -j$CORES > "$TOOLS_LOG_PATH/cmvs_2_build.log" 2>&1
echo " - make depend cmvs"
sudo make depend > "$TOOLS_LOG_PATH/cmvs_3_depend.log" 2>&1
@ -399,21 +398,7 @@ echo " > ceres"
-DBUILD_EXAMPLES=OFF -DBUILD_TESTING=OFF > "$TOOLS_LOG_PATH/ceres_1_config.log" 2>&1
echo " - building ceres"
make install > "$TOOLS_LOG_PATH/ceres_1_build.log" 2>&1
echo " < done - `date`"
echo
echo " > opencv"
cd "$OPENCV_PATH"
echo " - configuring opencv"
mkdir -p build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX=$TOOLS_PATH > "$TOOLS_LOG_PATH/opencv_1_config.log" 2>&1
echo " - building opencv"
make install > "$TOOLS_LOG_PATH/opencv_1_build.log" 2>&1
make -j$CORES install > "$TOOLS_LOG_PATH/ceres_1_build.log" 2>&1
echo " < done - `date`"
echo
@ -425,7 +410,7 @@ echo " > bundler"
make clean > "$TOOLS_LOG_PATH/bundler_1_clean.log" 2>&1
echo " - building bundler"
make -j > "$TOOLS_LOG_PATH/bundler_2_build.log" 2>&1
make -j$CORES > "$TOOLS_LOG_PATH/bundler_2_build.log" 2>&1
ln -s "$BUNDLER_PATH/bin/Bundle2PMVS" "$BUNDLER_PATH/bin/Bundle2Vis" "$BUNDLER_PATH/bin/KeyMatchFull" "$BUNDLER_PATH/bin/KeyMatch" "$BUNDLER_PATH/bin/bundler" "$BUNDLER_PATH/bin/RadialUndistort" "$TOOLS_BIN_PATH/"
@ -468,7 +453,7 @@ echo " > meshing "
cmake . -DPCL_DIR="$TOOLS_LIB_PATH/pcl" > "$TOOLS_LOG_PATH/odm_meshing_1_build.log" 2>&1
echo " - building odm_meshing"
make > "$TOOLS_LOG_PATH/odm_meshing_2_build.log" 2>&1
make -j$CORES > "$TOOLS_LOG_PATH/odm_meshing_2_build.log" 2>&1
# copy output program to the binaries folder.
cp -f "odm_meshing" "$TOOLS_BIN_PATH/odm_meshing"
@ -480,10 +465,10 @@ echo " > texturing "
cd "$ODM_TEXTURING_PATH"
echo " - configuring odm_texturing"
cmake . -DPCL_DIR="$TOOLS_LIB_PATH/pcl" -DOPENCV_DIR="$TOOLS_PATH/share/OpenCV" > "$TOOLS_LOG_PATH/odm_texturing_1_build.log" 2>&1
cmake . -DPCL_DIR="$TOOLS_LIB_PATH/pcl" > "$TOOLS_LOG_PATH/odm_texturing_1_build.log" 2>&1
echo " - building odm_texturing"
make > "$TOOLS_LOG_PATH/odm_texturing_2_build.log" 2>&1
make -j$CORES > "$TOOLS_LOG_PATH/odm_texturing_2_build.log" 2>&1
# copy output program to the binaries folder.
cp -f "odm_texturing" "$TOOLS_BIN_PATH/odm_texturing"
@ -498,7 +483,7 @@ echo " > extract_utm "
cmake . > "$TOOLS_LOG_PATH/odm_extract_utm_1_build.log" 2>&1
echo " - building odm_extract_utm"
make > "$TOOLS_LOG_PATH/odm_extract_utm_2_build.log" 2>&1
make -j$CORES > "$TOOLS_LOG_PATH/odm_extract_utm_2_build.log" 2>&1
# copy output program to the binaries folder.
cp -f "odm_extract_utm" "$TOOLS_BIN_PATH/odm_extract_utm"
@ -510,10 +495,10 @@ echo " > georef "
cd "$ODM_GEOREF_PATH"
echo " - configuring odm_georef"
cmake . -DPCL_DIR="$TOOLS_LIB_PATH/pcl" -DOPENCV_DIR="$TOOLS_PATH/share/OpenCV" > "$TOOLS_LOG_PATH/odm_georef_1_build.log" 2>&1
cmake . -DPCL_DIR="$TOOLS_LIB_PATH/pcl" > "$TOOLS_LOG_PATH/odm_georef_1_build.log" 2>&1
echo " - building odm_georef"
make > "$TOOLS_LOG_PATH/odm_georef_2_build.log" 2>&1
make -j$CORES > "$TOOLS_LOG_PATH/odm_georef_2_build.log" 2>&1
# copy output program to the binaries folder.
cp -f "odm_georef" "$TOOLS_BIN_PATH/odm_georef"
@ -525,10 +510,10 @@ echo " > orthophoto "
cd "$ODM_ORTHOPHOTO_PATH"
echo " - configuring odm_orthophoto"
cmake . -DPCL_DIR="$TOOLS_LIB_PATH/pcl" -DOPENCV_DIR="$TOOLS_PATH/share/OpenCV" > "$TOOLS_LOG_PATH/odm_orthophoto_1_build.log" 2>&1
cmake . -DPCL_DIR="$TOOLS_LIB_PATH/pcl" > "$TOOLS_LOG_PATH/odm_orthophoto_1_build.log" 2>&1
echo " - building odm_orthophoto"
make > "$TOOLS_LOG_PATH/odm_orthophoto_2_build.log" 2>&1
make -j$CORES > "$TOOLS_LOG_PATH/odm_orthophoto_2_build.log" 2>&1
# copy output program to the binaries folder.
cp -f "odm_orthophoto" "$TOOLS_BIN_PATH/odm_orthophoto"
@ -536,12 +521,25 @@ echo " > orthophoto "
echo " < done - `date`"
echo
echo " > OpenGV"
cd "$OPENGV_PATH"
echo " - configuring opengv"
git checkout python-wrapper
mkdir -p build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX=$TOOLS_PATH -DBUILD_TESTS=OFF -DBUILD_PYTHON=ON > "$TOOLS_LOG_PATH/opengv_1_build.log" 2>&1
echo " - building opengv"
make install > "$TOOLS_LOG_PATH/opengv_2_build.log" 2>&1
echo " < done - `date`"
echo
echo " > OpenSfM"
cd "$OPENSFM_PATH"
echo " - configuring opensfm"
git checkout odm-1
git checkout odm-2
echo " - building opensfm"
CERES_ROOT_DIR=$TOOLS_PATH python setup.py build > "$TOOLS_LOG_PATH/opensfm_1_build.log" 2>&1

28
run.py
Wyświetl plik

@ -81,6 +81,14 @@ parser.add_argument('--force-ccd',
type=float,
help='Override the ccd width information for the images')
parser.add_argument('--min-num-features',
metavar='<integer>',
default=4000,
type=int,
help=('Minimum number of features to extract per image. '
'More features leads to better results but slower '
'execution.'))
parser.add_argument('--matcher-threshold',
metavar='<percent>',
default=2.0,
@ -98,7 +106,7 @@ parser.add_argument('--matcher-ratio',
parser.add_argument('--matcher-preselect',
type=bool,
metavar='',
default=True,
default=False,
help=('use GPS exif data, if available, to match each '
'image only with its k-nearest neighbors, or all '
'images within a certain distance threshold'))
@ -117,6 +125,13 @@ parser.add_argument('--matcher-kDistance',
type=int,
help='')
parser.add_argument('--matcher-k',
metavar='<integer>',
default=8,
type=int,
help='Number of k-nearest images to match '
'when using OpenSfM')
parser.add_argument('--cmvs-maxImages',
metavar='<integer>',
default=500,
@ -229,7 +244,7 @@ parser.add_argument('--zip-results',
parser.add_argument('--use-opensfm',
type=bool,
default=False,
default=True,
help='use OpenSfM instead of Bundler to find the camera positions '
'(replaces getKeypoints, match and bundler steps)')
@ -562,7 +577,7 @@ def match():
# Match all image pairs
else:
if args.matcher_preselect == "true":
if args.matcher_preselect:
print "Failed to run pair preselection, proceeding with exhaustive matching."
for i in range(0, objectStats["good"]):
for j in range(i + 1, objectStats["good"]):
@ -685,10 +700,13 @@ def opensfm():
# Configure OpenSfM
config = [
"use_exif_size: no",
"features_process_size: {}".format(jobOptions["resizeTo"]),
"preemptive_threshold: 5",
"feature_process_size: {}".format(jobOptions["resizeTo"]),
"feature_min_frames: {}".format(args.min_num_features),
"processes: {}".format(CORES),
]
if args.matcher_preselect:
config.append("matching_gps_neighbors: {}".format(args.matcher_k))
with open('opensfm/config.yaml', 'w') as fout:
fout.write("\n".join(config))