Merge pull request #7 from alexhagiopol/feature-better-docker

Improved Docker build and run system with instructions.
pull/347/head
Dakota Benjamin 2016-07-25 14:51:42 -04:00 zatwierdzone przez GitHub
commit 6ec59ab3ec
7 zmienionych plików z 211 dodań i 198 usunięć

Wyświetl plik

@ -1,6 +1,11 @@
Dockerfile
tests/test_data
SuperBuild/build
SuperBuild/download
SuperBuild/install
SuperBuild/src
build
opensfm
pmvs
odm_orthophoto
odm_texturing
odm_meshing
odm_georeferencing
images_resize

Wyświetl plik

@ -1,80 +1,32 @@
FROM ubuntu:14.04
MAINTAINER Danilo Bargen <mail@dbrgn.ch>
# Env variables
ENV DEBIAN_FRONTEND noninteractive
# Install dependencies
RUN apt-get update \
&& sudo apt-get remove libdc1394-22-dev \
&& apt-get install -y --install-recommends \
build-essential \
cmake \
git \
python-pip \
libgdal-dev \
libgeotiff-dev \
pkg-config \
libgtk2.0-dev \
libavcodec-dev \
libavformat-dev \
libswscale-dev \
python-dev \
python-numpy \
libtbb2 \
libtbb-dev \
libjpeg-dev \
libpng-dev \
libtiff-dev \
libjasper-dev \
libflann-dev \
libproj-dev \
libxext-dev \
liblapack-dev \
libeigen3-dev \
libvtk5-dev \
python-networkx \
libgoogle-glog-dev \
libsuitesparse-dev \
libboost-filesystem-dev \
libboost-iostreams-dev \
libboost-regex-dev \
libboost-python-dev \
libboost-date-time-dev \
libboost-thread-dev \
python-empy \
python-nose \
python-pyside \
python-pyexiv2 \
python-scipy \
jhead \
liblas-bin \
&& apt-get autoremove \
&& apt-get clean
# Add users
RUN useradd -m -U odm
#Pull in previously built packages image with lots of libraries.
FROM packages
# Prepare directories
RUN mkdir /code
WORKDIR /code
# Add repository files
ADD . /code/
# Copy repository files
COPY ccd_defs_check.py /code/ccd_defs_check.py
COPY CMakeLists.txt /code/CMakeLists.txt
COPY configure.sh /code/configure.sh
COPY /.git/ /code/.git/
COPY .gitignore /code/.gitignore
COPY .gitmodules /code/.gitmodules
COPY /modules/ /code/modules/
COPY /opendm/ /code/opendm/
COPY /patched_files/ /code/patched_files/
COPY run.py /code/run.py
COPY /scripts/ /code/scripts/
COPY /SuperBuild/cmake/ /code/SuperBuild/cmake/
COPY /SuperBuild/CMakeLists.txt /code/SuperBuild/CMakeLists.txt
COPY /tests/ /code/tests/
# Update submodules
RUN git submodule init && git submodule update
# Build OpenDroneMap
RUN bash ./configure.sh && \
mkdir build && cd build && cmake .. && make && cd .. && \
chown -R odm:odm /code
USER odm
ENV PYTHONPATH=${PYTHONPATH}:/code/SuperBuild/install/lib/python2.7/dist-packages:/code/SuperBuild/src/opensfm \
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/code/SuperBuild/install/lib
#Compile code in SuperBuild and root directories
RUN cd SuperBuild && mkdir build && cd build && cmake .. && make -j$(nproc) \
&& cd ../.. && mkdir build && cd build && cmake .. && make -j$(nproc)
# Entry point
VOLUME ["/images"]
# WORKDIR /images
ENTRYPOINT ["python", "/code/run.py", "--project-path", "/images"]
ENTRYPOINT ["python", "/code/run.py", "--project-path", "/code/"]

104
README.md
Wyświetl plik

@ -2,8 +2,7 @@
![](https://raw.githubusercontent.com/OpenDroneMap/OpenDroneMap/master/img/odm_image.png)
What is it?
===========
## What is it?
OpenDroneMap is an open source toolkit for processing aerial drone imagery. Typical drones use simple point-and-shoot cameras, so the images from drones, while from a different perspective, are similar to any pictures taken from point-and-shoot cameras, i.e. non-metric imagery. OpenDroneMap turns those simple images into three dimensional geographic data that can be used in combination with other geographic datasets.
@ -27,8 +26,7 @@ Developers' mailing list: http://lists.osgeo.org/cgi-bin/mailman/listinfo/opendr
Overview video: https://www.youtube.com/watch?v=0UctfoeNB_Y
Developers
=================
## Developers
Help improve our software!
@ -37,40 +35,44 @@ Help improve our software!
1. Try to keep commits clean and simple
2. Submit a pull request with detailed changes and test results
Steps to get OpenDroneMap running:
==================================
## Build and Run OpenDroneMap in Ubuntu:
(Requires Ubuntu 14.04 or later, see https://github.com/OpenDroneMap/odm_vagrant for running on Windows in a VM)
Support for Ubuntu 12.04 is currently BROKEN with the addition of OpenSfM and Ceres-Solver. We are working hard to get it working again in the future.
#### Building OpenDroneMap using git
### Build OpenDroneMap
Start with the following:
cd path/to/odm/dir
git clone https://github.com/OpenDroneMap/OpenDroneMap.git .
export PYTHONPATH=$PYTHONPATH:`pwd`/SuperBuild/install/lib/python2.7/dist-packages:`pwd`/SuperBuild/src/opensfm
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:`pwd`/SuperBuild/install/lib
git clone https://github.com/OpenDroneMap/OpenDroneMap.git
Next, open the ~/.bashrc file on your machine and add the following 3 lines at the end. The file can be opened with ```gedit ~/.bashrc```. Be sure to replace the "/your/path/" with the correct path to the location where you cloned OpenDroneMap:
export PYTHONPATH=$PYTHONPATH:/your/path/OpenDroneMap/SuperBuild/install/lib/python2.7/dist-packages
export PYTHONPATH=$PYTHONPATH:/your/path/OpenDroneMap/SuperBuild/src/opensfm
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/your/path/OpenDroneMap/SuperBuild/install/lib
Now, enter the OpenDroneMap directory and compile all of the code by executing a single configuration script:
cd OpenDroneMap
bash configure.sh
mkdir build && cd build && cmake .. && make && cd ..
For Ubuntu 15.10 users, this will help you get running:
For Ubuntu 15.10 users, this will help you get running:
sudo apt-get install python-xmltodict
sudo ln -s /usr/lib/x86_64-linux-gnu/libproj.so.9 /usr/lib/libproj.so
#### Running OpenDroneMap
### Run OpenDroneMap
First you need a set of images, which may or may not be georeferenced. There are two ways OpenDroneMap can understand geographic coordinates. First, the images can be geotagged in their EXIF data. This is the default. Alternatively, you can create a GCP file, [a process detailed here](https://github.com/OpenDroneMap/OpenDroneMap/wiki/2.-Running-OpenDroneMap#running-odm-with-ground-control)
Create a project folder and places your images in an "images" directory:
|-- /path/to/project/
|-- images/
|-- img-1234.jpg
|-- ...
Example data can be cloned from https://github.com/OpenDroneMap/odm_data
Then run:
@ -79,11 +81,9 @@ Then run:
There are many options for tuning your project. See the [wiki](https://github.com/OpenDroneMap/OpenDroneMap/wiki/3.-Run-Time-Parameters) or run `python run.py -h`
<<<<<<< HEAD
When the process finishes, the results will be organized as follows
=======
Long term, the aim is for the toolchain to also be able to optionally push to a variety of online data repositories, pushing hi-resolution aerials to [OpenAerialMap](https://openaerialmap.org/), point clouds to [OpenTopography](http://opentopography.org/), and pushing digital elevation models to an emerging global repository (yet to be named...). That leaves only digital surface model meshes and UV textured meshes with no global repository home.
>>>>>>> Update master to become default branch (#302)
### View Results
When the process finishes, the results will be organized as follows:
|-- images/
|-- img-1234.jpg
@ -116,45 +116,65 @@ Long term, the aim is for the toolchain to also be able to optionally push to a
|-- odm_orthophoto_log.txt # Log file
|-- gdal_translate_log.txt # Log for georeferencing the png file
##### Viewing your results
Any file ending in .obj or .ply can be opened and viewed in [MeshLab](http://meshlab.sourceforge.net/) or similar software. That includes `pmvs/recon0/models/option-000.ply`, `odm_meshing/odm_mesh.ply`, `odm_texturing/odm_textured_model[_geo].obj`, or `odm_georeferencing/odm_georeferenced_model.ply`. Below is an example textured mesh:
![](https://raw.githubusercontent.com/OpenDroneMap/OpenDroneMap/master/img/tol_text.png)
![](https://raw.githubusercontent.com/alexhagiopol/OpenDroneMap/feature-better-docker/toledo_dataset_example_mesh.jpg)
You can also view the orthophoto GeoTIFF in QGIS or other mapping software:
![](https://raw.githubusercontent.com/OpenDroneMap/OpenDroneMap/master/img/bellus_map.png)
#### Using Docker
## Build and Run Using Docker
You can build and run OpenDroneMap in a Docker container:
(Instructions below apply to Ubuntu 14.04, but the Docker image workflow
has equivalent procedures for Mac OS X and Windows. See [docs.docker.com](docs.docker.com))
export IMAGES=/absolute/path/to/your/project
docker build -t opendronemap:latest .
docker run -v $IMAGES:/images opendronemap:latest
OpenDroneMap is Dockerized, meaning you can use containerization to build and run it without tampering with the configuration of libraries and packages already
installed on your machine. Docker software is free to install and use in this context. If you don't have it installed,
see the [Docker Ubuntu installation tutorial] (https://docs.docker.com/engine/installation/linux/ubuntulinux/) and follow the
instructions up until "Create a Docker group" inclusive. Once Docker is installed, an OpenDroneMap Docker image can be created
like so:
Replace /absolute/path/to/your/images with an absolute path to the directory containing your project (where the images are)
To pass in custom parameters to the `run.py` script, simply pass it as arguments to the `docker run` command.
git clone https://github.com/OpenDroneMap/OpenDroneMap.git
cd OpenDroneMap
docker build -t packages -f packages.Dockerfile .
docker build -t odm_image .
docker run -it --user root\
-v $(pwd)/images:/code/images\
-v $(pwd)/odm_orthophoto:/code/odm_orthophoto\
-v $(pwd)/odm_texturing:/code/odm_texturing\
--rm odm_image
---
Using this method, the containerized ODM will process the images in the OpenDroneMap/images directory and output results
to the OpenDroneMao/odm_orthophoto and OpenDroneMap/odm_texturing directories as described in the **Viewing Results** section.
If you want to view other results outside the Docker image simply add which directories you're interested in to the run command in the same pattern
established above. For example, if you're interested in the dense cloud results generated by PMVS and in the orthophoto,
simply use the following `docker run` command after building the image:
docker run -it --user root\
-v $(pwd)/images:/code/images\
-v $(pwd)/pmvs:/code/pmvs\
-v $(pwd)/odm_orthophoto:/code/odm_orthophoto\
--rm odm_image
To pass in custom parameters to the run.py script, simply pass it as arguments to the `docker run` command.
## Examples
Here are some other videos, which may be outdated:
- https://www.youtube.com/watch?v=7ZTufQkODLs (2015-01-30)
- https://www.youtube.com/watch?v=m0i4GQdfl8A (2015-03-15)
Now that texturing is in the code base, you can access the full textured meshes using MeshLab. Open MeshLab, choose `File:Import Mesh` and choose your textured mesh from a location similar to the following: `reconstruction-with-image-size-1200-results\odm_texturing\odm_textured_model.obj`
Now that texturing is in the code base, you can access the full textured meshes using MeshLab.
Open MeshLab, choose `File:Import Mesh` and choose your textured mesh from a location similar to the following:
`reconstruction-with-image-size-1200-results\odm_texturing\odm_textured_model.obj`. Long term, the aim is for
the toolchain to also be able to optionally push to a variety of online data repositories, pushing hi-resolution
aerials to [OpenAerialMap](http://opentopography.org/), point clouds to [OpenTopography](http://opentopography.org/),
and pushing digital elevation models to an emerging global repository (yet to be named...). That leaves only
digital surface model meshes and UV textured meshes with no global repository home.
Long term, the aim is for the toolchain to also be able to optionally push to a variety of online data repositories, pushing hi-resolution aerials to [OpenAerialMap](http://opentopography.org/), point clouds to [OpenTopography](http://opentopography.org/), and pushing digital elevation models to an emerging global repository (yet to be named...). That leaves only digital surface model meshes and UV textured meshes with no global repository home.
---
Documentation:
==============
## Documentation:
For documentation, please take a look at our [wiki](https://github.com/OpenDroneMap/OpenDroneMap/wiki).

Wyświetl plik

@ -1,50 +1,27 @@
#!/bin/bash
# Check OS
if [ ! $(command -v apt-get) ]; then
echo -e "\e[1;31mERROR: Not a Debian-based linux system.
Impossible to install OpenCV with this script\e[0;39m"
exit 1
fi
## Before installing
echo -e "\e[1;34mUpdating the system\e[0;39m"
echo "Updating the system"
sudo apt-get update
END_CMD1=$?
# sudo apt-get upgrade -y
# END_CMD2=$?
if [ $END_CMD1 -ne 0 ]
then
echo -e "\e[1;31mERROR: \e[39mWhen Updating the system\e[0m"
exit 1
fi
## Install Required Requisites
echo -e "\e[1;34mInstalling Required Requisites\e[0;39m"
sudo apt-get install build-essential \
cmake \
echo "Installing Required Requisites"
sudo apt-get install -y -qq build-essential \
git \
cmake \
python-pip \
libgdal-dev \
gdal-bin \
libgeotiff-dev \
pkg-config -y -qq
pkg-config
# If we have ubuntu version 14.04, the cmake version in apt-get is too low for mvs-texturing.
if [[ `lsb_release -rs` == "14.04" ]];
then
bash upgradecmake.sh
fi
echo "Getting CMake 3.1 for MVS-Texturing"
sudo apt-get install -y software-properties-common python-software-properties
sudo add-apt-repository -y ppa:george-edison55/cmake-3.x
sudo apt-get update -y
sudo apt-get install -y --only-upgrade cmake
if [ $? -ne 0 ]
then
echo -e "\e[1;31mERROR: \e[39mWhen Installing Required Requisites\e[0m"
exit 1
fi
## Installing Optional Requisites
echo -e "\e[1;34mInstalling OpenCV Dependencies\e[0;39m"
sudo apt-get install libgtk2.0-dev \
echo "Installing OpenCV Dependencies"
sudo apt-get install -y -qq libgtk2.0-dev \
libavcodec-dev \
libavformat-dev \
libswscale-dev \
@ -61,20 +38,14 @@ sudo apt-get install libgtk2.0-dev \
libxext-dev \
liblapack-dev \
libeigen3-dev \
libvtk5-dev -y -qq
if [ $? -ne 0 ]
then
echo -e "\e[1;31mERROR: \e[39mError when Installing Dependencies Requisites\e[0m"
exit 1
fi
libvtk5-dev
## Remove libdc1394-22-dev due to python opencv issue
echo -e "\e[1;34mRemoving libdc1394-22-dev\e[0;39m"
echo "Removing libdc1394-22-dev due to python opencv issue"
sudo apt-get remove libdc1394-22-dev
## Installing OpenSfM Requisites
echo -e "\e[1;34mInstalling OpenSfM Dependencies\e[0;39m"
sudo apt-get install python-networkx \
echo "Installing OpenSfM Dependencies"
sudo apt-get install -y -qq python-networkx \
libgoogle-glog-dev \
libsuitesparse-dev \
libboost-filesystem-dev \
@ -82,51 +53,33 @@ sudo apt-get install python-networkx \
libboost-regex-dev \
libboost-python-dev \
libboost-date-time-dev \
libboost-thread-dev -y -qq
libboost-thread-dev
sudo pip install -U PyYAML \
exifread \
gpxpy \
xmltodict
if [ $? -ne 0 ]
then
echo -e "\e[1;31mERROR: \e[39mError when Installing OpenSfM Dependencies\e[0m"
exit 1
fi
## Installing Ecto Requisites
echo -e "\e[1;34mInstalling Ecto Dependencies\e[0;39m"
echo "Installing Ecto Dependencies"
sudo pip install -U catkin-pkg
sudo apt-get install python-empy \
sudo apt-get install -y -qq python-empy \
python-nose \
python-pyside -y -qq
if [ $? -ne 0 ]
then
echo -e "\e[1;31mERROR: \e[39mError when Installing Ecto Dependencies\e[0m"
exit 1
fi
python-pyside
## Installing OpenDroneMap Requisites
echo -e "\e[1;34mInstalling OpenDroneMap Dependencies\e[0;39m"
sudo apt-get install python-pyexiv2 \
echo "Installing OpenDroneMap Dependencies"
sudo apt-get install -y python-pyexiv2 \
python-scipy \
jhead \
liblas-bin -y -qq
if [ $? -ne 0 ]
then
echo -e "\e[1;31mERROR: \e[39mError when Installing OpenDroneMap Dependencies\e[0m"
exit 1
fi
## Get sys vars
NUM_CORES=`grep -c processor /proc/cpuinfo`
## Add SuperBuild path to the python path
export PYTHONPATH=$PYTHONPATH:`pwd`/SuperBuild/install/lib/python2.7/dist-packages:`pwd`/SuperBuild/src/opensfm
## Compile SuperBuild
echo "Compiling SuperBuild"
cd SuperBuild
mkdir -p build && cd build
cmake .. && make -j${NUM_CORES}
cmake .. && make -j$(nproc)
echo -e "\e[1;34mScript finished\e[0;39m"
echo "Compiling build"
cd ../..
mkdir -p build && cd build
cmake .. && make -j$(nproc)
echo "Configuration Finished"

Wyświetl plik

@ -0,0 +1,90 @@
FROM ubuntu:14.04
MAINTAINER Alex Hagiopol <alex.hagiopol@icloud.com>
# Env variables
ENV DEBIAN_FRONTEND noninteractive
#Install dependencies
#Required Requisites
RUN apt-get update \
&& apt-get install -y -qq \
build-essential \
cmake \
git \
python-pip \
libgdal-dev \
gdal-bin \
libgeotiff-dev \
pkg-config
#CMake 3.1 for MVS-Texturing
RUN sudo apt-get install -y software-properties-common python-software-properties
RUN sudo add-apt-repository -y ppa:george-edison55/cmake-3.x
RUN sudo apt-get update -y
RUN sudo apt-get install -y --only-upgrade cmake
#Installing OpenCV Dependencies
RUN sudo apt-get install -y -qq libgtk2.0-dev \
libavcodec-dev \
libavformat-dev \
libswscale-dev \
python-dev \
python-numpy \
libtbb2 \
libtbb-dev \
libjpeg-dev \
libpng-dev \
libtiff-dev \
libjasper-dev \
libflann-dev \
libproj-dev \
libxext-dev \
liblapack-dev \
libeigen3-dev \
libvtk5-dev
#Removing libdc1394-22-dev due to python opencv issue
RUN sudo apt-get remove libdc1394-22-dev
#Installing OpenSfM Dependencies
RUN sudo apt-get install -y -qq python-networkx \
libgoogle-glog-dev \
libsuitesparse-dev \
libboost-filesystem-dev \
libboost-iostreams-dev \
libboost-regex-dev \
libboost-python-dev \
libboost-date-time-dev \
libboost-thread-dev
RUN sudo pip install -U PyYAML \
exifread \
gpxpy \
xmltodict \
catkin-pkg
#Installing Ecto Dependencies
RUN sudo apt-get install -y -qq python-empy \
python-nose \
python-pyside
#"Installing OpenDroneMap Dependencies"
RUN sudo apt-get install -y python-pyexiv2 \
python-scipy \
jhead \
liblas-bin -y -qq
RUN sudo apt-get install -y python-empy \
python-nose \
python-pyside \
python-pyexiv2 \
python-scipy \
jhead \
liblas-bin \
python-matplotlib \
libatlas-base-dev \
libatlas3gf-base
ENV PYTHONPATH="$PYTHONPATH:/code/SuperBuild/install/lib/python2.7/dist-packages"
ENV PYTHONPATH="$PYTHONPATH:/code/SuperBuild/src/opensfm"
ENV LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/code/SuperBuild/install/lib"

Plik binarny nie jest wyświetlany.

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 193 KiB

Wyświetl plik

@ -1,7 +0,0 @@
# Install cmake 3.2 since cmake > 3.1 is is required by mvs-texturing.
# Installation as proposed by:
# http://askubuntu.com/questions/610291/how-to-install-cmake-3-2-on-ubuntu-14-04
sudo add-apt-repository ppa:george-edison55/cmake-3.x -y
sudo apt-get update -y
sudo apt-get install cmake -y