Vagrantを使ったOpenDroneMapの実行環境構築

  • 7
    いいね
  • 0
    コメント

注意:仮想環境に6GB割り当ててます。その負荷に耐えられるPCを準備してください。

構築環境

  • Vagrant
  • VirtualBox
  • Ubuntu14.04
  • メモリ割当 6GB

Vagrantの準備

①Vagrant Boxの準備

ターミナルを開いて、Ubuntuの仮想環境をVagrantで構築する。

$ vagrant plugin install vagrant-vbguest
$ vagrant box add ubuntu14_04_64 https://github.com/kraksoft/vagrant-box-ubuntu/releases/download/14.04/ubuntu-14.04-amd64.box
$ mkdir odm_JapanPack
$ cd odm_JapanPack/
$ vagrant init ubuntu14_04_64 

②Vagrantfileの編集

メモリとネットワークの共有を設定

$ vi Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :

# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure(2) do |config|
  # The most common configuration options are documented and commented below.
  # For a complete reference, please see the online documentation at
  # https://docs.vagrantup.com.

  # Every Vagrant development environment requires a box. You can search for
  # boxes at https://atlas.hashicorp.com/search.
  config.vm.box = "ubuntu14_04_64"

  # Disable automatic box update checking. If you disable this, then
  # boxes will only be checked for updates when the user runs
  # `vagrant box outdated`. This is not recommended.
  # config.vm.box_check_update = false

  # Create a forwarded port mapping which allows access to a specific port
  # within the machine from a port on the host machine. In the example below,
  # accessing "localhost:8080" will access port 80 on the guest machine.
   config.vm.network "forwarded_port", guest: 80, host: 80

  # Create a private network, which allows host-only access to the machine
  # using a specific IP.
   config.vm.network "private_network", ip: "192.168.33.10"

  # Create a public network, which generally matched to bridged network.
  # Bridged networks make the machine appear as another physical device on
  # your network.
  # config.vm.network "public_network"

  # Share an additional folder to the guest VM. The first argument is
  # the path on the host to the actual folder. The second argument is
  # the path on the guest to mount the folder. And the optional third
  # argument is a set of non-required options.
  # config.vm.synced_folder "../data", "/vagrant_data"

  # Provider-specific configuration so you can fine-tune various
  # backing providers for Vagrant. These expose provider-specific options.
  # Example for VirtualBox:
  #
   config.vm.provider "virtualbox" do |vb|
  #   # Display the VirtualBox GUI when booting the machine
  #   vb.gui = true
  #
  #   # Customize the amount of memory on the VM:
     vb.memory = "2048"
   end
  #
  # View the documentation for the provider you are using for more
  # information on available options.

  # Define a Vagrant Push strategy for pushing to Atlas. Other push strategies
  # such as FTP and Heroku are also available. See the documentation at
  # https://docs.vagrantup.com/v2/push/atlas.html for more information.
  # config.push.define "atlas" do |push|
  #   push.app = "YOUR_ATLAS_USERNAME/YOUR_APPLICATION_NAME"
  # end

  # Enable provisioning with a shell script. Additional provisioners such as
  # Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the
  # documentation for more information about their specific syntax and use.
  # config.vm.provision "shell", inline: <<-SHELL
  #   sudo apt-get update
  #   sudo apt-get install -y apache2
  # SHELL
end 

$ vagrant ssh

OpenDroneMapのインストール

①ソースコードをGitHubよりClone

$ sudo apt-get update
$ sudo apt-get install git
$ cd /vagrant
$ git clone https://github.com/OpenDroneMap/OpenDroneMap.git

②OpenDroneMapをインストール

$ cd OpenDroneMap/
$ ./install.sh

         created by Daniel Schwarz/daniel.schwarz@topoi.org
         released under Creative Commons/CC-BY
         Attribution

         if the script doesn't finish properly
         (i.e. it doesn't print "script finished" at the end)
         please email me the content of the logs folder


      - script started - Tue Mar  8 03:23:20 GMT 2016

      > installing required packages
        - updating
        - installing
    Downloading/unpacking networkx
      Downloading networkx-1.11-py2.py3-none-any.whl (1.3MB): 1.3MB downloaded
    Downloading/unpacking exifread
      Downloading ExifRead-2.1.2-py2-none-any.whl (47kB): 47kB downloaded
    Downloading/unpacking xmltodict
      Downloading xmltodict-0.10.1.tar.gz
      Running setup.py (path:/tmp/pip_build_root/xmltodict/setup.py) egg_info for package xmltodict

    Requirement already satisfied (use --upgrade to upgrade): decorator>=3.4.0 in /usr/lib/python2.7/dist-packages (from networkx)
    Installing collected packages: networkx, exifread, xmltodict
      Running setup.py install for xmltodict

    Successfully installed networkx exifread xmltodict
    Cleaning up...
        - installing git submodules
    Submodule 'src/bundler' (https://github.com/chris-cooper/bundler_sfm) registered for path 'src/bundler'
    Cloning into 'src/bundler'...
    remote: Counting objects: 1394, done.
    remote: Total 1394 (delta 0), reused 0 (delta 0), pack-reused 1394
    Receiving objects: 100% (1394/1394), 6.02 MiB | 1.00 MiB/s, done.
    Resolving deltas: 100% (443/443), done.
    Checking connectivity... done.
    Submodule path 'src/bundler': checked out 'b34cc5dcd54345272028b68f82fa4d0ae8a103c9'
      < done - Tue Mar  8 03:30:03 GMT 2016

      > getting the sources
        - getting http://ftp.gnu.org/gnu/parallel/parallel-20141022.tar.bz2
    ######################################################################## 100.0%
        - finished parallel.tar.bz2

        - already downloaded http://www.netlib.org/clapack/clapack-3.2.1-CMAKE.tgz
        - already downloaded http://www.cs.jhu.edu/~misha/Code/PoissonRecon/Version2/PoissonRecon.zip
        - already downloaded http://www.vlfeat.org/download/vlfeat-0.9.13-bin.tar.gz
        - already downloaded http://www.di.ens.fr/cmvs/cmvs-fix2.tar.gz
        - already downloaded http://smathermather.github.io/BundlerTools/patched_files/src/graclus/graclus1.2.tar.gz
        - getting https://github.com/PointCloudLibrary/pcl/archive/pcl-1.7.2.tar.gz
    ######################################################################## 100.0%
        - finished pcl.tar.gz

        - getting http://ceres-solver.org/ceres-solver-1.10.0.tar.gz
    ######################################################################## 100.0%
        - finished ceres-solver.tar.gz

        - getting http://lastools.org/download/LAStools.zip
    ######################################################################## 100.0%
        - finished LAStools.zip

    Cloning into '/vagrant/OpenDroneMap/src/opengv'...
    remote: Counting objects: 6491, done.
    remote: Total 6491 (delta 0), reused 0 (delta 0), pack-reused 6491
    Receiving objects: 100% (6491/6491), 6.56 MiB | 855.00 KiB/s, done.
    Resolving deltas: 100% (3422/3422), done.
    Checking connectivity... done.
    Checking out files: 100% (4357/4357), done.
    Cloning into '/vagrant/OpenDroneMap/src/OpenSfM'...
    remote: Counting objects: 5380, done.
    remote: Total 5380 (delta 0), reused 0 (delta 0), pack-reused 5380
    Receiving objects: 100% (5380/5380), 18.58 MiB | 2.84 MiB/s, done.
    Resolving deltas: 100% (3534/3534), done.
    Checking connectivity... done.
      < done - Tue Mar  8 03:32:31 GMT 2016

      - unzipping sources
      < done - Tue Mar  8 03:32:45 GMT 2016

      - copying patches

      < done - Tue Mar  8 03:32:45 GMT 2016

      - building

      > graclus
        - cleaning graclus
        - building graclus
      < done - Tue Mar  8 03:32:58 GMT 2016

      > poisson surface reconstruction 
        - building poisson surface reconstruction
      < done - Tue Mar  8 03:33:03 GMT 2016

      > parallel
        - configuring parallel
        - building paralel
      < done - Tue Mar  8 03:33:04 GMT 2016

      > clapack
        - building clapack
        - installing clapack
      < done - Tue Mar  8 03:37:43 GMT 2016

      > vlfeat
        - installing vlfeat
      < done - Tue Mar  8 03:37:43 GMT 2016

      > LAStools
        - installing LAStools
      < done - Tue Mar  8 03:38:10 GMT 2016

      > cmvs/pmvs
        - cleaning cmvs
        - building cmvs
        - make depend cmvs
      < done - Tue Mar  8 03:38:31 GMT 2016

      > ceres
        - configuring ceres
        - building ceres
      < done - Tue Mar  8 03:41:55 GMT 2016

      > bundler
        - cleaning bundler
        - building bundler
      < done - Tue Mar  8 03:42:42 GMT 2016

      > pcl 
        - configuring pcl
        - building and installing pcl
      < done - Tue Mar  8 03:51:05 GMT 2016

      > meshing 
        - configuring odm_meshing
        - building odm_meshing
      < done - Tue Mar  8 03:51:24 GMT 2016

      > texturing 
        - configuring odm_texturing
        - building odm_texturing
      < done - Tue Mar  8 03:51:52 GMT 2016

      > extract_utm 
        - configuring odm_extract_utm
        - building odm_extract_utm
      < done - Tue Mar  8 03:51:54 GMT 2016

      > georef 
        - configuring odm_georef
        - building odm_georef
      < done - Tue Mar  8 03:52:17 GMT 2016

      > orthophoto 
        - configuring odm_orthophoto
        - building odm_orthophoto
      < done - Tue Mar  8 03:52:33 GMT 2016

      > OpenGV
        - configuring opengv
    Branch python-wrapper set up to track remote branch python-wrapper from origin.
    Switched to a new branch 'python-wrapper'
        - building opengv
      < done - Tue Mar  8 03:58:16 GMT 2016

      > OpenSfM
        - configuring opensfm
    Note: checking out 'odm-2'.

    You are in 'detached HEAD' state. You can look around, make experimental
    changes and commit them, and you can discard any commits you make in this
    state without impacting any branches by performing another checkout.

    If you want to create a new branch to retain commits you create, you may
    do so (now or later) by using -b with the checkout command again. Example:

      git checkout -b new_branch_name

    HEAD is now at a0671c4... Ignore matching_gps_neighbors if any image has no GPS data
        - building opensfm
      < done - Tue Mar  8 03:58:48 GMT 2016

      - script finished - Tue Mar  8 03:58:52 GMT 2016

③OpenDroneMapのコマンド確認

./run.py -hが立ち上がれば起動完了

$ ./run.py -h
    usage: run.py [-h] [--resize-to <integer>] [--job-dir-name <string>]
                  [--start-with <task>] [--end-with <task>] [--run-only <task>]
                  [--use-opensfm | --use-bundler] [--force-focal <positive float>]
                  [--force-ccd <positive float>] [--min-num-features <integer>]
                  [--matcher-threshold <percent>] [--matcher-ratio <float>]
                  [--matcher-neighbors <integer>] [--matcher-distance <integer>]
                  [--cmvs-maxImages <integer>] [--pmvs-level <positive integer>]
                  [--pmvs-csize < positive integer>]
                  [--pmvs-threshold <float: -1.0 <= x <= 1.0>]
                  [--pmvs-wsize <positive integer>]
                  [--pmvs-minImageNum <positive integer>]
                  [--odm_meshing-maxVertexCount <positive integer>]
                  [--odm_meshing-octreeDepth <positive integer>]
                  [--odm_meshing-samplesPerNode <float >= 1.0>]
                  [--odm_meshing-solverDivide <positive integer>]
                  [--odm_texturing-textureResolution <positive integer>]
                  [--odm_texturing-textureWithSize <positive integer>]
                  [--odm_georeferencing-gcpFile <path string>]
                  [--odm_georeferencing-useGcp]
                  [--odm_orthophoto-resolution <float > 0.0>] [--zip-results]

    OpenDroneMap

    optional arguments:
      -h, --help            show this help message and exit
      --resize-to <integer>
                            Resizes images by the largest side. Default: 2400
      --job-dir-name <string>
                            Name of the output folder, only ASCII charaters can be
                            used. If not provided "reconstruction-with-image-size
                            -[resize-to]" will be used
      --start-with <task>, -s <task>
                            Start with the provided task. Can be one of: resize |
                            opensfm | getKeypoints | match | bundler | cmvs | pmvs
                            | odm_meshing | odm_texturing | odm_georeferencing |
                            odm_orthophoto
      --end-with <task>, -e <task>
                            Finish at the provided task. Can be one of: resize |
                            opensfm | getKeypoints | match | bundler | cmvs | pmvs
                            | odm_meshing | odm_texturing | odm_georeferencing |
                            odm_orthophoto
      --run-only <task>     Run only one task. Can be one of: resize | opensfm |
                            getKeypoints | match | bundler | cmvs | pmvs |
                            odm_meshing | odm_texturing | odm_georeferencing |
                            odm_orthophoto
      --use-opensfm         use OpenSfM to find the camera positions (replaces
                            getKeypoints, match and bundler steps)
      --use-bundler         use Bundler to find the camera positions.
      --force-focal <positive float>
                            Override the focal length information for the images
      --force-ccd <positive float>
                            Override the ccd width information for the images
      --min-num-features <integer>
                            Minimum number of features to extract per image. More
                            features leads to better results but slower execution.
                            Default: 6000
      --matcher-threshold <percent>
                            Ignore matched keypoints if the two images share less
                            than <float> percent of keypoints. Default: 2.0
      --matcher-ratio <float>
                            Ratio of the distance to the next best matched
                            keypoint. Default: 0.6
      --matcher-neighbors <integer>
                            Number of nearest images to pre-match based on GPS
                            exif data. Set to 0 to skip pre-matching. Neighbors
                            works together with Distance parameter, set both to 0
                            to not use pre-matching. OpenSFM uses both parameters
                            at the same time, Bundler uses only one which has
                            value, prefering the Neighbors parameter. Default: 8
      --matcher-distance <integer>
                            Distance threshold in meters to find pre-matching
                            images based on GPS exif data. Set to 0 to skip pre-
                            matching. Default: 0
      --cmvs-maxImages <integer>
                            The maximum number of images per cluster. Default: 500
      --pmvs-level <positive integer>
                            The level in the image pyramid that is used for the
                            computation. see
                            http://www.di.ens.fr/pmvs/documentation.html for more
                            pmvs documentation. Default: 1
      --pmvs-csize < positive integer>
                            Cell size controls the density of reconstructions.
                            Default: 2
      --pmvs-threshold <float: -1.0 <= x <= 1.0>
                            A patch reconstruction is accepted as a success and
                            kept, if its associcated photometric consistency
                            measure is above this threshold. Default: 0.7
      --pmvs-wsize <positive integer>
                            pmvs samples wsize x wsize pixel colors from each
                            image to compute photometric consistency score. For
                            example, when wsize=7, 7x7=49 pixel colors are sampled
                            in each image. Increasing the value leads to more
                            stable reconstructions, but the program becomes
                            slower. Default: 7
      --pmvs-minImageNum <positive integer>
                            Each 3D point must be visible in at least minImageNum
                            images for being reconstructed. 3 is suggested in
                            general.
      --odm_meshing-maxVertexCount <positive integer>
                            The maximum vertex count of the output mesh. Default:
                            100000
      --odm_meshing-octreeDepth <positive integer>
                            Oct-tree depth used in the mesh reconstruction,
                            increase to get more vertices, recommended values are
                            8-12, the default is 9
      --odm_meshing-samplesPerNode <float >= 1.0>
                            Number of points per octree node, recommended and
                            default value: 1.0
      --odm_meshing-solverDivide <positive integer>
                            Oct-tree depth at which the Laplacian equation is
                            solved in the surface reconstruction step. Increasing
                            this value increases computation times slightly but
                            helps reduce memory usage. Default: 9
      --odm_texturing-textureResolution <positive integer>
                            The resolution of the output textures. Must be greater
                            than textureWithSize. Default: 4096
      --odm_texturing-textureWithSize <positive integer>
                            The resolution to rescale the images performing the
                            texturing. Default: 3600
      --odm_georeferencing-gcpFile <path string>
                            path to the file containing the ground control points
                            used for georeferencing. The default file is
                            gcp_list.txt. The file needs to be on the following
                            line format: easting northing height pixelrow pixelcol
                            imagename
      --odm_georeferencing-useGcp
                            Enabling GCPs from the file above. The GCP file is not
                            used by default.
      --odm_orthophoto-resolution <float > 0.0>
                            Orthophoto ground resolution in pixels/meter. Default:
                            20.0
      --zip-results         Compress the results using gunzip