Last active
May 29, 2018 08:37
-
-
Save alkavan/9833004ca62948453695734f1628e95f to your computer and use it in GitHub Desktop.
OpenMVG Command CheatSheet
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # This are "easy to use" instructions how to create point cloud data files | |
| # extracting from a set of images using a technique called SfM or Structure from Motion: | |
| # http://openmvg.readthedocs.io/en/latest/software/SfM/SfM/ | |
| # FFMPEG HELPERS: | |
| # ffmpeg -i video.webm -vf fps=1 image%07d.jpg | |
| export SFM_OUT_DIR=".sfm" | |
| # Init SfM with OpenMVG | |
| mkdir $SFM_OUT_DIR | |
| openMVG_main_SfMInit_ImageListing --imageDirectory=. -o $SFM_OUT_DIR \ | |
| -d ../../sensor_width_camera_database.txt | |
| # With manual focal value | |
| #openMVG_main_SfMInit_ImageListing --imageDirectory=. -o $SFM_OUT_DIR -f 1714.285714 | |
| # Calculation of focal | |
| # -f|--focal = ( std::max ( image_width, image_height ) * exifReader->getFocal() ) / ccdw; | |
| # With camera databse -d ../sensor_database_detailed.csv (???) don't seemed to work... | |
| # Filter distorted images | |
| # This application export undistorted images from known camera parameter intrinsic. | |
| echo -e "Filtering image distortion...\n" | |
| mkdir $SFM_OUT_DIR/filter | |
| openMVG_main_ExportUndistortedImages -i $SFM_OUT_DIR/sfm_data.json -o $SFM_OUT_DIR/filter -r 1 -n 2 | |
| #echo -e "Deleting old SfM Data file...\n" | |
| #rm $SFM_OUT_DIR/sfm_data.json | |
| #openMVG_main_SfMInit_ImageListing --imageDirectory=$SFM_OUT_DIR/filter -o $SFM_OUT_DIR -f 2758 | |
| # Compute features | |
| mkdir $SFM_OUT_DIR/matches | |
| openMVG_main_ComputeFeatures -i $SFM_OUT_DIR/sfm_data.json -o $SFM_OUT_DIR/matches -p NORMAL -n 2 -u 1 | |
| #openMVG_main_ComputeFeatures -i $SFM_OUT_DIR/sfm_data.json -o $SFM_OUT_DIR/matches -p HIGH -n 1 | |
| #openMVG_main_ComputeFeatures -i $SFM_OUT_DIR/sfm_data.json -o $SFM_OUT_DIR/matches -p ULTRA -n 1 | |
| # | |
| # [-m|--describerMethod] | |
| # (method to use to describe an image): | |
| # SIFT (default), | |
| # SIFT_ANATOMY, | |
| # AKAZE_FLOAT: AKAZE with floating point descriptors, | |
| # AKAZE_MLDB: AKAZE with binary descriptors | |
| # | |
| # [-u|--upright] Use Upright feature 0 or 1 | |
| # | |
| # [-p|--describerPreset] | |
| # (used to control the Image_describer configuration): | |
| # NORMAL (default), | |
| # HIGH, | |
| # ULTRA: !!Can take long time!! | |
| # [-n|--numThreads] number of parallel computations | |
| # Compute matches | |
| openMVG_main_ComputeMatches -i $SFM_OUT_DIR/sfm_data.json -o $SFM_OUT_DIR/matches -n ANNL2 -g e -v 2 | |
| # [-n|--nearest_matching_method] | |
| # AUTO: auto choice from regions type, | |
| # For Scalar based regions descriptor: | |
| # BRUTEFORCEL2: L2 BruteForce matching, | |
| # ANNL2: L2 Approximate Nearest Neighbor matching, | |
| # CASCADEHASHINGL2: L2 Cascade Hashing matching. | |
| # FASTCASCADEHASHINGL2: (default) | |
| # L2 Cascade Hashing with precomputed hashed regions | |
| # (faster than CASCADEHASHINGL2 but use more memory). | |
| # For Binary based descriptor: | |
| # BRUTEFORCEHAMMING: BruteForce Hamming matching. | |
| # | |
| # [-g|--geometric_model] | |
| # (pairwise correspondences filtering thanks to robust model estimation): | |
| # f: (default) fundamental matrix, | |
| # e: essential matrix, | |
| # h: homography matrix. | |
| # a: essential matrix with an angular parametrization, | |
| # o: orthographic essential matrix. | |
| # | |
| # [-v|--video_mode_matching] | |
| # (sequence matching with an overlap of X images) | |
| # X: with match 0 with (1->X), ...] | |
| # 2: will match 0 with (1,2), 1 with (2,3), ... | |
| # 3: will match 0 with (1,2,3), 1 with (2,3,4), ... | |
| # | |
| # [-m|--guided_matching] | |
| # use the found model to improve the pairwise correspondences. | |
| # | |
| # [-r|--ratio] Distance ratio to discard non meaningful matches 0.8: (default). | |
| # Generate Incremental SfM | |
| mkdir $SFM_OUT_DIR/incremental | |
| openMVG_main_IncrementalSfM \ | |
| -i $SFM_OUT_DIR/sfm_data.json \ | |
| -m $SFM_OUT_DIR/matches/ \ | |
| -o $SFM_OUT_DIR/incremental/ \ | |
| -M $SFM_OUT_DIR/matches/matches.putative.bin | |
| # Generate Global SfM | |
| mkdir $SFM_OUT_DIR/global | |
| openMVG_main_GlobalSfM \ | |
| -i $SFM_OUT_DIR/sfm_data.json \ | |
| -m $SFM_OUT_DIR/matches/ \ | |
| -M $SFM_OUT_DIR/matches/matches.putative.bin \ | |
| -o $SFM_OUT_DIR/global/ \ | |
| -r 2 -t 3 | |
| # ^^^^^ This does not work right now for me. | |
| # Compute the color of the Structure of a sfm_data scene. | |
| mkdir $SFM_OUT_DIR/out | |
| openMVG_main_ComputeSfM_DataColor \ | |
| -i $SFM_OUT_DIR/incremental/sfm_data.bin \ | |
| -o $SFM_OUT_DIR/out/model_color.ply | |
| # ComputeStructureFromKnownPoses | |
| openMVG_main_ComputeStructureFromKnownPoses \ | |
| -i $SFM_OUT_DIR/incremental/sfm_data.bin \ | |
| -m $SFM_OUT_DIR/matches/ \ | |
| -f $SFM_OUT_DIR/matches/matches.putative.bin \ | |
| -o $SFM_OUT_DIR/out/robust.bin | |
| # Compute the color of the Structure of a robust scene. | |
| openMVG_main_ComputeSfM_DataColor \ | |
| -i $SFM_OUT_DIR/out/robust.bin \ | |
| -o $SFM_OUT_DIR/out/model_color_robust.ply | |
| # Export to WebGL | |
| mkdir $SFM_OUT_DIR/out/html | |
| openMVG_main_openMVG2WebGL \ | |
| -i $SFM_OUT_DIR/sfm_data.json \ | |
| -o $SFM_OUT_DIR/out/html | |
| # Convert to PCD | |
| pcl_ply2pcd $SFM_OUT_DIR/out/model_color_robust.ply $SFM_OUT_DIR/out/model_color_robust.pcd | |
| pcl_ply2pcd $SFM_OUT_DIR/out/model_color.ply $SFM_OUT_DIR/out/model_color.pcd | |
| pcl_ply2pcd $SFM_OUT_DIR/out/robust.ply $SFM_OUT_DIR/out/robust.pcd | |
| # Convert to VTK | |
| pcl_ply2vtk $SFM_OUT_DIR/out/model_color_robust.ply $SFM_OUT_DIR/out/model_color_robust.vtk | |
| pcl_ply2vtk $SFM_OUT_DIR/out/model_color.ply $SFM_OUT_DIR/out/model_color.vtk | |
| pcl_ply2vtk $SFM_OUT_DIR/out/robust.ply $SFM_OUT_DIR/out/robust.vtk | |
| # MVE - Convert the openMVG SfM scene to the MVE format | |
| mkdir $SFM_OUT_DIR/mve && cd $SFM_OUT_DIR/mve | |
| openMVG_main_openMVG2MVE2 -i ../sfm_data.json -o . | |
| dmrecon -s2 MVE/ | |
| scene2pset -ddepth-L2 -iundist-L2 -n -s -c MVE/ ../out/model_color_robust.ply | |
| fssrecon ../out/model_color_robust.ply output.ply | |
| meshclean output.ply output_clean.ply | |
| cd .. | |
| ls -alh $SFM_OUT_DIR/mve |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment