Skip to content

Commit

Permalink
Merge pull request OpenDroneMap#13 from OpenDroneMap/texturing_orthop…
Browse files Browse the repository at this point in the history
…hoto_spotscale_additions

add Spotscale orthophoto/textured mesh additions -- tested now on 12.04 and 14.04. Fingers crossed -- this is a big one... .
  • Loading branch information
Stephen Mather committed Jan 20, 2015
2 parents 2f9013b + 659f2bb commit b5c3843
Show file tree
Hide file tree
Showing 41 changed files with 7,762 additions and 25 deletions.
142 changes: 133 additions & 9 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,15 @@ echo " - script started - `date`"
VLFEAT_PATH="$TOOLS_SRC_PATH/vlfeat"
PARALLEL_PATH="$TOOLS_SRC_PATH/parallel"
PSR_PATH="$TOOLS_SRC_PATH/PoissonRecon"
GRACLUS_PATH="$TOOLS_SRC_PATH/graclus"

GRACLUS_PATH="$TOOLS_SRC_PATH/graclus"

PCL_PATH="$TOOLS_SRC_PATH/pcl"
ODM_MESHING_PATH="$TOOLS_SRC_PATH/odm_meshing"
ODM_TEXTURING_PATH="$TOOLS_SRC_PATH/odm_texturing"
ODM_ORTHOPHOTO_PATH="$TOOLS_SRC_PATH/odm_orthophoto"
ODM_EXTRACT_UTM_PATH="$TOOLS_SRC_PATH/odm_extract_utm"
ODM_GEOREF_PATH="$TOOLS_SRC_PATH/odm_georef"

## executables
EXTRACT_FOCAL="$TOOLS_BIN_PATH/extract_focal.pl"
MATCHKEYS="$TOOLS_BIN_PATH/KeyMatch"
Expand All @@ -54,6 +61,12 @@ echo " - script started - `date`"
PSR="$TOOLS_BIN_PATH/PoissonRecon"
VLSIFT_TO_LOWESIFT="$TOOLS_BIN_PATH/convert_vlsift_to_lowesift.pl"

ODM_MESHING="$TOOLS_BIN_PATH/odm_meshing"
ODM_TEXTURING="$TOOLS_BIN_PATH/odm_texturing"
ODM_ORTHOPHOTO="$TOOLS_BIN_PATH/odm_orthophoto"
ODM_EXTRACT_UTM="$TOOLS_BIN_PATH/odm_extract_utm"
ODM_GEOREF="$TOOLS_BIN_PATH/odm_georef"

## get sys vars
ARCH=`uname -m`
CORES=`grep -c processor /proc/cpuinfo`
Expand All @@ -75,6 +88,13 @@ mkdir -p "$TOOLS_LIB_PATH"
mkdir -p "$TOOLS_SRC_PATH"
mkdir -p "$TOOLS_LOG_PATH"

## Copy meshing and texturing to src folder
cp -rf "odm_meshing" "$TOOLS_SRC_PATH/"
cp -rf "odm_texturing" "$TOOLS_SRC_PATH/"
cp -rf "odm_orthophoto" "$TOOLS_SRC_PATH/"
cp -rf "odm_extract_utm" "$TOOLS_SRC_PATH/"
cp -rf "odm_georef" "$TOOLS_SRC_PATH/"

## output sys info
echo "System info:" > "$TOOLS_LOG_PATH/sysinfo.txt"
uname -a > "$TOOLS_LOG_PATH/sysinfo.txt"
Expand All @@ -88,14 +108,14 @@ sudo apt-get update --assume-yes > "$TOOLS_LOG_PATH/apt-get_get.log" 2>&1

echo " - installing"
sudo apt-get install --assume-yes --install-recommends \
build-essential cmake g++ gcc gFortran perl git \
build-essential cmake g++ gcc gFortran perl git autoconf \
curl wget \
unzip \
imagemagick jhead \
libjpeg-dev libboost-dev libgsl0-dev libx11-dev libxext-dev liblapack-dev \
imagemagick jhead proj-bin libproj-dev\
libjpeg-dev libboost1.48-all-dev libgsl0-dev libx11-dev libxext-dev liblapack-dev \
libeigen3-dev libflann-dev libvtk5-dev libqhull-dev libusb-1.0-0-dev\
libzip-dev \
libswitch-perl \
libcv-dev libcvaux-dev \
libcv-dev libcvaux-dev libopencv-dev \
> "$TOOLS_LOG_PATH/apt-get_install.log" 2>&1


Expand Down Expand Up @@ -129,6 +149,7 @@ PoissonRecon.zip http://www.cs.jhu.edu/~misha/Code/PoissonRecon/Version2/Poisson
vlfeat.tar.gz http://www.vlfeat.org/download/vlfeat-0.9.13-bin.tar.gz
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
EOF

echo " < done - `date`"
Expand All @@ -149,13 +170,15 @@ done

wait

mv -f graclus1.2 "$GRACLUS_PATH"
mv -f graclus1.2 "$GRACLUS_PATH"
mv -f clapack-3.2.1-CMAKE "$CLAPACK_PATH"
mv -f vlfeat-0.9.13 "$VLFEAT_PATH"
mv -f bundler-v0.4-source "$BUNDLER_PATH"
mv -f parallel-20141022 "$PARALLEL_PATH"
mv -f PoissonRecon "$PSR_PATH"
mv -f cmvs "$CMVS_PATH"
mv -f pcl-pcl-1.7.2 "$PCL_PATH"


echo " < done - `date`"

Expand All @@ -180,7 +203,6 @@ echo
sudo chown -R `id -u`:`id -g` *
#sudo chmod -R 777 *


echo " > graclus"
cd "$GRACLUS_PATH"

Expand Down Expand Up @@ -325,6 +347,108 @@ echo " > bundler"
echo " < done - `date`"
echo

echo " > pcl "
#cd "$PCL_PATH"

#Install pcl dependencies using the default package manager.
#sudo apt-get install libeigen3-dev libflann-dev libvtk5-dev libqhull-dev

#install the required boost version.
#sudo apt-get install libboost1.48-all-dev

mkdir -p "pcl"
mkdir -p "$TOOLS_LIB_PATH/pcl"
mkdir -p "$PCL_PATH/pcl_tmp"
mkdir -p "$PCL_PATH/pcl_build"

#mv -f "pcl-pcl-1.7.2" "$PCL_PATH/pcl_tmp"

cd "$PCL_PATH/pcl_build"

echo " - configuring pcl"

cmake .. -DCMAKE_INSTALL_PREFIX="$TOOLS_LIB_PATH/pcl" -DCMAKE_BUILD_TYPE=Release -DPCL_VERBOSITY_LEVEL=Error -DBUILD_features=OFF -DBUILD_filters=OFF -DBUILD_geometry=OFF -DBUILD_keypoints=OFF -DBUILD_outofcore=OFF -DBUILD_people=OFF -DBUILD_recognition=OFF -DBUILD_registration=OFF -DBUILD_sample_consensus=OFF -DBUILD_segmentation=OFF -DBUILD_features=OFF -DBUILD_surface_on_nurbs=OFF -DBUILD_tools=OFF -DBUILD_tracking=OFF -DBUILD_visualization=OFF -DWITH_QT=OFF -DBUILD_OPENNI=OFF -DBUILD_OPENNI2=OFF -DWITH_OPENNI=OFF -DWITH_OPENNI2=OFF -DWITH_FZAPI=OFF -DWITH_LIBUSB=OFF -DWITH_PCAP=OFF -DWITH_PXCAPI=OFF > "$TOOLS_LOG_PATH/pcl_1_build.log" 2>&1

echo " - building and installing pcl"
make install > "$TOOLS_LOG_PATH/pcl_2_build.log" 2>&1

echo " < done - `date`"
echo

echo " > meshing "
cd "$ODM_MESHING_PATH"

echo " - configuring odm_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

# copy output program to the binaries folder.
cp -f "odm_meshing" "$TOOLS_BIN_PATH/odm_meshing"

echo " < done - `date`"
echo

echo " > texturing "
cd "$ODM_TEXTURING_PATH"

echo " - configuring odm_texturing"
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

# copy output program to the binaries folder.
cp -f "odm_texturing" "$TOOLS_BIN_PATH/odm_texturing"

echo " < done - `date`"
echo

echo " > extract_utm "
cd "$ODM_EXTRACT_UTM_PATH"

echo " - configuring odm_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

# copy output program to the binaries folder.
cp -f "odm_extract_utm" "$TOOLS_BIN_PATH/odm_extract_utm"

echo " < done - `date`"
echo

echo " > georef "
cd "$ODM_GEOREF_PATH"

echo " - configuring odm_georef"
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

# copy output program to the binaries folder.
cp -f "odm_georef" "$TOOLS_BIN_PATH/odm_georef"

echo " < done - `date`"
echo

echo " > orthophoto "
cd "$ODM_ORTHOPHOTO_PATH"

echo " - configuring odm_orthophoto"
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

# copy output program to the binaries folder.
cp -f "odm_orthophoto" "$TOOLS_BIN_PATH/odm_orthophoto"

echo " < done - `date`"
echo

cd "$TOOLS_PATH"

Expand Down
18 changes: 18 additions & 0 deletions odm_extract_utm/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
project(odm_extract_utm)
cmake_minimum_required(VERSION 2.8)

set(PROJ4_INCLUDE_DIR "/usr/include/" CACHE "PROJ4_INCLUDE_DIR" "Path to the proj4 inlcude directory")
set(PROJ4_LIBRARY "/usr/lib/libproj.so" CACHE "PROJ4_LIBRARY" "Path to the proj4 library directory")

# Add compiler options.
add_definitions(-Wall -Wextra)

# Add source directory
aux_source_directory("./src" SRC_LIST)

# Add exectuteable
add_executable(${PROJECT_NAME} ${SRC_LIST})

# Link
target_link_libraries(${PROJECT_NAME} ${PROJ4_LIBRARY})

31 changes: 31 additions & 0 deletions odm_extract_utm/src/Logger.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#include "Logger.hpp"


Logger::Logger(bool isPrintingInCout) : isPrintingInCout_(isPrintingInCout)
{

}

Logger::~Logger()
{

}

void Logger::printToFile(std::string filePath)
{
std::ofstream file(filePath.c_str(), std::ios::binary);
file << logStream_.str();
file.close();
}

bool Logger::isPrintingInCout() const
{
return isPrintingInCout_;
}

void Logger::setIsPrintingInCout(bool isPrintingInCout)
{
isPrintingInCout_ = isPrintingInCout;
}


68 changes: 68 additions & 0 deletions odm_extract_utm/src/Logger.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
#pragma once

// STL
#include <string>
#include <sstream>
#include <fstream>
#include <iostream>

/*!
* \brief The Logger class is used to store program messages in a log file.
* \details By using the << operator while printInCout is set, the class writes both to
* cout and to file, if the flag is not set, output is written to file only.
*/
class Logger
{
public:
/*!
* \brief Logger Contains functionality for printing and displaying log information.
* \param printInCout Flag toggling if operator << also writes to cout.
*/
Logger(bool isPrintingInCout = true);

/*!
* \brief Destructor.
*/
~Logger();

/*!
* \brief print Prints the contents of the log to file.
* \param filePath Path specifying where to write the log.
*/
void printToFile(std::string filePath);

/*!
* \brief isPrintingInCout Check if console printing flag is set.
* \return Console printing flag.
*/
bool isPrintingInCout() const;

/*!
* \brief setIsPrintingInCout Set console printing flag.
* \param isPrintingInCout Value, if true, messages added to the log are also printed in cout.
*/
void setIsPrintingInCout(bool isPrintingInCout);

/*!
* Operator for printing messages to log and in the standard output stream if desired.
*/
template<class T>
friend Logger& operator<< (Logger &log, T t)
{
// If console printing is enabled.
if (log.isPrintingInCout_)
{
std::cout << t;
std::cout.flush();
}
// Write to log.
log.logStream_ << t;

return log;
}

private:
bool isPrintingInCout_; /*!< If flag is set, log is printed in cout and written to the log. */

std::stringstream logStream_; /*!< Stream for storing the log. */
};
Loading

0 comments on commit b5c3843

Please sign in to comment.