├── Dockerfile ├── LICENSE ├── README.md ├── cmvs.patch ├── graclus.patch ├── nv.ini ├── pba.patch └── siftgpu.patch /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM tleyden5iwx/ubuntu-cuda 2 | MAINTAINER Ryan Baumann 3 | 4 | # Install dependencies 5 | RUN apt-get update 6 | RUN apt-get install -y libgtk2.0-dev glew-utils libglew-dev libmetis-dev libscotchparmetis-dev libdevil-dev libboost-all-dev libatlas-cpp-0.6-dev libatlas-dev imagemagick libatlas3gf-base libcminpack-dev libgfortran3 freeglut3-dev libgsl0-dev liblapack-dev unzip youtube-dl libav-tools dos2unix 7 | 8 | WORKDIR /root 9 | 10 | # Install VisualSFM 11 | ADD http://ccwu.me/vsfm/download/VisualSFM_linux_64bit.zip /root/VisualSFM_linux_64bit.zip 12 | RUN unzip VisualSFM_linux_64bit.zip 13 | RUN cd vsfm; make 14 | 15 | # Install PBA 16 | ADD http://grail.cs.washington.edu/projects/mcba/pba_v1.0.5.zip /root/pba.zip 17 | RUN unzip pba.zip 18 | ADD pba.patch /root/pba/pba.patch 19 | RUN cd pba; dos2unix makefile_no_gpu; patch -p1 < pba.patch 20 | RUN cd pba; make -f makefile_no_gpu; cp -v bin/libpba_no_gpu.so ../vsfm/bin/libpba.so 21 | 22 | # Install pmvs2 23 | # ADD http://www.di.ens.fr/pmvs/pmvs-2-fix0.tar.gz /root/pmvs-2.tar.gz 24 | ADD http://www.di.ens.fr/pmvs/pmvs-2.tar.gz /root/pmvs-2.tar.gz 25 | RUN tar xzf pmvs-2.tar.gz 26 | RUN cd pmvs-2/program/main/; cp mylapack.o mylapack.o.backup; make clean; cp mylapack.o.backup mylapack.o; make depend; make 27 | 28 | # Install Graclus 29 | ADD http://www.cs.utexas.edu/users/dml/Software/graclus1.2.tar.gz /root/graclus1.2.tar.gz 30 | RUN tar xzf graclus1.2.tar.gz 31 | ADD graclus.patch /root/graclus1.2/graclus.patch 32 | RUN cd graclus1.2; patch -p0 < graclus.patch; make 33 | 34 | # Install cmvs 35 | ADD http://www.di.ens.fr/cmvs/cmvs-fix2.tar.gz /root/cmvs.tar.gz 36 | RUN tar xzf cmvs.tar.gz 37 | ADD cmvs.patch /root/cmvs/cmvs.patch 38 | RUN cd cmvs; patch -p1 < cmvs.patch 39 | RUN cp -v ~/pmvs-2/program/main/mylapack.o ~/cmvs/program/main 40 | RUN cd cmvs/program/main; make; cp -v cmvs pmvs2 genOption ~/vsfm/bin 41 | 42 | # Install vlfeat 43 | ADD http://www.vlfeat.org/download/vlfeat-0.9.19-bin.tar.gz /root/vlfeat-0.9.19-bin.tar.gz 44 | RUN tar xzf vlfeat-0.9.19-bin.tar.gz 45 | RUN cp -v vlfeat-0.9.19/bin/glnxa64/* vsfm/bin/ 46 | ADD nv.ini /root/vsfm/bin/nv.ini 47 | 48 | ENV PATH $PATH:/root/vsfm/bin 49 | ENV LD_LIBRARY_PATH $LD_LIBRARY_PATH:/root/vsfm/bin 50 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Ryan Baumann 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | docker_visualsfm 2 | ================ 3 | 4 | An experimental Dockerfile for building [VisualSFM](http://ccwu.me/vsfm/) and its dependencies. 5 | 6 | * Test the build with `docker build .` 7 | * Tag the build with `docker build -t visualsfm .` 8 | * Run the build with `docker run -t -i visualsfm /bin/bash` 9 | 10 | Docker Hub: [ryanfb/visualsfm](https://registry.hub.docker.com/u/ryanfb/visualsfm/) 11 | 12 | Blog post: [Docker for VisualSFM](https://ryanfb.github.io/etc/2015/01/13/docker_for_visualsfm.html) 13 | 14 | See also: [Docker on AWS GPU Ubuntu 14.04 / CUDA 6.5](http://tleyden.github.io/blog/2014/10/25/docker-on-aws-gpu-ubuntu-14-dot-04-slash-cuda-6-dot-5/) 15 | 16 | Based on: [tleyden5iwx/ubuntu-cuda](https://registry.hub.docker.com/u/tleyden5iwx/ubuntu-cuda/) 17 | 18 | And: [Building VisualSFM on Ubuntu 12.04 (Precise Pangolin) Desktop 64-bit](http://www.10flow.com/2012/08/15/building-visualsfm-on-ubuntu-12-04-precise-pangolin-desktop-64-bit/) 19 | -------------------------------------------------------------------------------- /cmvs.patch: -------------------------------------------------------------------------------- 1 | diff -Naur cmvs/program/base/cmvs/bundle.cc cmvs-patched/program/base/cmvs/bundle.cc 2 | --- cmvs/program/base/cmvs/bundle.cc 2011-03-27 18:46:01.000000000 -0400 3 | +++ cmvs-patched/program/base/cmvs/bundle.cc 2015-01-12 20:20:31.000000000 -0500 4 | @@ -1,3 +1,5 @@ 5 | +#include 6 | +#include 7 | #include 8 | #include 9 | 10 | diff -Naur cmvs/program/main/Makefile cmvs-patched/program/main/Makefile 11 | --- cmvs/program/main/Makefile 2010-04-09 23:27:30.000000000 -0400 12 | +++ cmvs-patched/program/main/Makefile 2015-01-12 20:44:16.000000000 -0500 13 | @@ -7,14 +7,14 @@ 14 | ###################################################################### 15 | CXX = g++ 16 | 17 | -Your INCLUDE path (e.g., -I/usr/include) 18 | +# Your INCLUDE path (e.g., -I/usr/include) 19 | YOUR_INCLUDE_PATH = 20 | 21 | -Your metis directory (contains header files under graclus1.2/metisLib/) 22 | -YOUR_INCLUDE_METIS_PATH = 23 | +# Your metis directory (contains header files under graclus1.2/metisLib/) 24 | +YOUR_INCLUDE_METIS_PATH = -I/root/graclus1.2/metisLib 25 | 26 | -Your LDLIBRARY path (e.g., -L/usr/lib) 27 | -YOUR_LDLIB_PATH = 28 | +# Your LDLIBRARY path (e.g., -L/usr/lib) 29 | +YOUR_LDLIB_PATH = -L/root/graclus1.2 30 | 31 | ###################################################################### 32 | CXXFLAGS_PMVS = -O2 -Wall -Wno-deprecated ${YOUR_INCLUDE_PATH} 33 | diff -Naur cmvs/program/main/genOption.cc cmvs-patched/program/main/genOption.cc 34 | --- cmvs/program/main/genOption.cc 2010-04-05 00:27:19.000000000 -0400 35 | +++ cmvs-patched/program/main/genOption.cc 2015-01-12 20:20:56.000000000 -0500 36 | @@ -1,3 +1,4 @@ 37 | +#include 38 | #include 39 | #include 40 | #include 41 | -------------------------------------------------------------------------------- /graclus.patch: -------------------------------------------------------------------------------- 1 | --- Makefile.in 2008-10-27 16:46:58.000000000 -0400 2 | +++ Makefile.in.64 2015-01-12 16:57:17.000000000 -0500 3 | @@ -8,7 +8,7 @@ 4 | OPTFLAGS = -O2 -fPIC 5 | 6 | # What options to be used by the compiler 7 | -COPTIONS = -DNUMBITS=32 8 | +COPTIONS = -DNUMBITS=64 9 | 10 | # What options to be used by the loader 11 | LDOPTIONS = 12 | -------------------------------------------------------------------------------- /nv.ini: -------------------------------------------------------------------------------- 1 | ############################################ 2 | #Default ratio between focal length and max(width, height) 3 | #This parameter is very useful for wide angle images 4 | #Change this parameter before launching VisualSFM 5 | param_default_focal_ratio 1.2 6 | #Change this to 0 if the focal length from EXIF is too bad 7 | param_use_exif_focal_length 1 8 | #Enable radial distortion (1 to enable, 0 to disable) 9 | param_radial_distortion 1 10 | 11 | #Switch to preemptive matching mode when the number of images is large than 12 | #param_preemptive_switch and preemptive matching is enabled 13 | #(+subset for command-line or SfM->Pairwise Matching->Use Preemptive Matching) 14 | param_preemptive_switch 1000 15 | #Number of features used in preemptive matching (h in the 3DV2013 paper) 16 | param_preemptive_size 100 17 | #Threshold for preemptive matching (t_h in the 3DV2013 paper) 18 | param_preemptive_min 4 19 | 20 | #Bundle adjustment configuration 21 | param_bundle_full_step 5 22 | param_bundle_full_iteration 100 23 | param_bundle_part_size 20 24 | param_bundle_part_iteration 5 25 | param_bundle_stop_mse 0.25 26 | param_pba_prefer_gpu 1 27 | param_pba_use_schur 0 28 | 29 | #Skip visualization data as much as possible (use 1 to save memory) 30 | param_less_visualization_data 0 31 | #The number of images that allows thumbnail textures and pixel loading. 32 | param_visual_data_budget 500 33 | #Enable full resolution rendering for resolution larger than 4096. 34 | param_enable_huge_texture 0 35 | 36 | #The number of threads for image undistortion (0 means one-thread per core) 37 | param_undistortion_thread_num 0 38 | #Parameters for using CMVS/PMVS (by Yasutaka Furukawa) 39 | param_cmvs_max_images 50 40 | param_pmvs_min_image 3 41 | param_pmvs_level 1 42 | param_pmvs_csize 2 43 | param_pmvs_threshold 0.7 44 | param_pmvs_wsize 7 45 | param_pmvs_max_angle 10 46 | #Thread parameter for PMVS: 0 means one-thread per core. 47 | param_pmvs_max_cpus 0 48 | 49 | #GPS variance used for GPS-based 3D transformation (beta) 50 | param_gps_variance 10 51 | param_gps_ignore_exif_altitude 1 52 | #Do not transform the NVM or PLY. Save the transformation to aln instead. 53 | param_write_transformation_to_aln 0 54 | 55 | #Thresholds for triangulating a 3D point 56 | param_triangle_angle_min_new 4 57 | param_triangle_angle_min 2 58 | param_forward_motion_threshold 2 59 | #Threshold for adding a point to existing track and making new tracks 60 | param_projection_threshold 320 61 | param_new_track_threshold 320 62 | param_merge_track_threshold 32 63 | param_retriangulate_threshold 3200 64 | param_retriangulate_step 0.25 65 | #Threshold for removing tracks that have large projection errors 66 | param_track_threshold 8 67 | #Filter unstable points (small triangulation angle) 68 | param_remove_unstable_tracks 1 69 | 70 | #Threshold for the number of projections when adding a new camera 71 | param_new_cam_projection_min 20 72 | #Threshold for pose estimation 73 | param_pose_estimate_threshold 64 74 | #Adjust pose estimation threshold according to focal lengths 75 | param_pose_estimate_adaptive 1 76 | #Consider very large focal length as wrong 77 | param_pose_estimate_ratio_max 10 78 | param_p3p_inlier_ratio_min 0.4 79 | param_pose_inlier_ratio_min 0.2 80 | 81 | #The minimum inlier matches for a pair to be considered correct 82 | param_pair_inlier_num_min 15 83 | #Distance threshold in meter for pair-wise image matching (0 to disable) 84 | param_pair_gps_threshold 0 85 | #Aggressively include all putative matches in reconstruction 86 | param_aggressive_triangulation 0 87 | 88 | #The thresholds for selecting a starting pair 89 | #Homography threshold : the maximum percent of points on a plane 90 | param_init_h_ratio_max 0.4 91 | #Inlier count threshold : the minimum number of matches 92 | param_init_inlier_min 30 93 | #Triangulation angle threshold: minimum average triangulation angle 94 | param_init_angle_min 2 95 | 96 | #Reconstruct one model or multiple? 97 | param_search_multiple_models 1 98 | #Maximum images shared by two 3D models 99 | param_image_reuse_max 10 100 | 101 | #Save a temporary NVM file when finishes. 102 | param_model_auto_saving 0 103 | #Write the combined PLY file in ASCII or BINARY format 104 | param_write_ascii_ply 0 105 | #Write camera indices in PLY file 106 | param_write_cameras_in_ply 0 107 | #Parameters for Poisson Surface Reconstruction 108 | param_poisson_arguments --depth 10 109 | 110 | #Select the tool for feature detection 111 | #0: CPU (depending on param_use_vlfeat_or_lowe), 112 | #1: GLSL-based SiftGPU, 2 CUDA-based SiftPGU, 113 | #3: customized SiftGPU (depending on param_use_siftgpu_customize) 114 | param_use_siftgpu 0 115 | param_use_siftgpu_customize -fo -1 -v 0 -tc2 7680 -nomc 116 | #Use the original binary from Lowe if 0, and VLFeat binary otherwise 117 | param_use_vlfeat_or_lowe 1 118 | #Options for vlfeat sift (--peak-thresh=3.4 seems to be compatible with Lowe) 119 | param_vlfeat_options --peak-thresh=3.4 120 | 121 | #Select the device for feature matching 122 | #0: cpu, 1: glsl, 2+: cuda if compiled in SiftGPU.dll 123 | param_use_siftmatchgpu 0 124 | param_cpu_siftmatch_num_thread 2 125 | 126 | #Feature matching parameters 127 | #Max features used in gpu sift matching 128 | param_gpu_match_fmax 8192 129 | #Max sift matching distance 130 | param_sift_max_dist 0.7 131 | #Max sift matching distance ratio 132 | param_sift_max_dist_ratio 0.8 133 | #Mutual best match or not 134 | param_siftmatch_mbm 1 135 | #Filter the stationary point matching 136 | param_no_stationary_points 0 137 | 138 | #Two-view geometry estimation parameters 139 | #Threshold for estimating F in ransac 140 | param_ransac_f_threshold 2 141 | #Threshold for estimating H in ransac 142 | param_ransac_h_threshold 4 143 | #Maximum iterations in ransac 144 | param_ransac_max_sample 1000 145 | 146 | #Write matches asynchronously, which may be faster for NFS. 147 | param_asynchronous_write 1 148 | #Limit the number of worker threads (experimental) 149 | param_maximum_cpu_usage 0 150 | #Flush stdout for each line of log when set to 1 151 | param_stdout_line_flush 0 152 | #When set to 1, the program will try to be deterministic by using 153 | #fixed seed for randomness, and disable threading in a few places 154 | param_deterministic_behaviour 0 155 | 156 | #Configuration version 157 | param_config_version 51 158 | 159 | -------------------------------------------------------------------------------- /pba.patch: -------------------------------------------------------------------------------- 1 | diff -Naur pba/makefile_no_gpu pba.core2/makefile_no_gpu 2 | --- pba/makefile_no_gpu 2015-01-16 16:32:29.000000000 -0500 3 | +++ pba.core2/makefile_no_gpu 2015-01-16 16:32:34.000000000 -0500 4 | @@ -15,7 +15,7 @@ 5 | OUT_PBA = ./bin/out_no_gpu 6 | 7 | CC = g++ 8 | -CFLAGS = -DPBA_NO_GPU -fPIC -L/usr/lib64 -L/usr/lib -L$(BIN_DIR) -O2 -Wall -Wno-deprecated -pthread -march=native -mfpmath=sse -fpermissive 9 | +CFLAGS = -DPBA_NO_GPU -fPIC -L/usr/lib64 -L/usr/lib -L$(BIN_DIR) -O2 -Wall -Wno-deprecated -pthread -march=core2 -mfpmath=sse -fpermissive 10 | 11 | 12 | # siftgpu header files 13 | -------------------------------------------------------------------------------- /siftgpu.patch: -------------------------------------------------------------------------------- 1 | --- makefile 2015-01-13 12:56:59.000000000 -0500 2 | +++ makefile.cuda 2015-01-13 12:57:02.000000000 -0500 3 | @@ -7,12 +7,7 @@ 4 | siftgpu_enable_opencl = 0 5 | #------------------------------------------------------------------------------------------------ 6 | # enable CUDA-based SiftGPU? 7 | -simple_find_cuda = $(shell locate libcudart.so) 8 | -ifneq ($(simple_find_cuda), ) 9 | - siftgpu_enable_cuda = 1 10 | -else 11 | - siftgpu_enable_cuda = 0 12 | -endif 13 | +siftgpu_enable_cuda = 1 14 | 15 | CUDA_INSTALL_PATH = /usr/local/cuda 16 | #change additional settings, like SM version here if it is not 1.0 (eg. -arch sm_13 for GTX280) 17 | --------------------------------------------------------------------------------