NASA Astrobee Robot Software  0.19.1
Flight software for the Astrobee robots operating inside the International Space Station.
build_map.cc File Reference
#include <ff_common/init.h>
#include <ff_common/thread.h>
#include <ff_common/utils.h>
#include <config_reader/config_reader.h>
#include <camera/camera_params.h>
#include <sparse_mapping/sparse_map.h>
#include <sparse_mapping/reprojection.h>
#include <sparse_mapping/tensor.h>
#include <sparse_mapping/sparse_mapping.h>
#include <opencv2/features2d/features2d.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <sparse_map.pb.h>
#include <gflags/gflags.h>
#include <glog/logging.h>
#include <iostream>
#include <fstream>
#include <algorithm>
#include <thread>
Include dependency graph for build_map.cc:

Functions

 DEFINE_string (output_map, "", "Output file containing the matches and control network.")
 
 DEFINE_int32 (sample_rate, 1, "Add one of every n input frames to the map.")
 
 DEFINE_bool (save_individual_maps, false, "Save separately the maps after detection, matching, track building, " "incremental bundle adjustment, and global bundle adjustment.")
 
 DEFINE_string (detector, "SURF", "Feature detector to use. Options are: SURF, ORGBRISK, TEBLID512, TEBLID256.")
 
 DEFINE_string (rebuild_detector, "TEBLID512", "Feature detector to use. Options are: SURF, ORGBRISK, TEBLID512, TEBLID256.")
 
 DEFINE_bool (feature_detection, false, "Compute features for input images.")
 
 DEFINE_bool (feature_matching, false, "Perform feature matching.")
 
 DEFINE_bool (track_building, false, "Perform track building.")
 
 DEFINE_bool (incremental_ba, false, "Perform incremental bundle adjustment.")
 
 DEFINE_bool (loop_closure, false, "Take a map where images start repeating, and close the loop.")
 
 DEFINE_bool (bundle_adjustment, false, "Perform bundle adjustment.")
 
 DEFINE_bool (rebuild, false, "Rebuild the map with BRISK features.")
 
 DEFINE_bool (rebuild_replace_camera, false, "During rebuilding replace the camera with the one from ASTROBEE_ROBOT.")
 
 DEFINE_bool (vocab_db, false, "Build the map with a vocabulary database.")
 
 DEFINE_bool (registration, false, "Register the map to world coordinates(requires control points and their xyz coordinates). " "This new data is used to redo the bundle adjustment")
 
 DEFINE_bool (verification, false, "Verify how an already registered map performs on an independently " "acquired set of control points and 3D measurements.")
 
 DEFINE_bool (registration_skip_bundle_adjustment, false, "Skip bundle adjustment during the registration step.")
 
 DEFINE_bool (prune, false, "Prune the map (the vocab db is unchanged).")
 
 DEFINE_bool (info, false, "Print some information on the existing map.")
 
 DEFINE_bool (save_poses, false, "Save the camera to world transform and its inverse for each image in the map.")
 
 DEFINE_bool (save_xyz, false, "Save the sparse set of points obtained by triangulating the interest point matches.")
 
 DEFINE_int32 (num_repeat_images, 0, "How many images from the beginning of the sequence to repeat at the end " "of the sequence, to help with loop closure (assuming first and last images " "are similar).")
 
 DEFINE_bool (fix_cameras, false, "Keep the cameras fixed during bundle adjustment.")
 
 DEFINE_bool (rebuild_refloat_cameras, false, "Optimize the cameras as well as part of rebuilding. Usually that is " "avoided when rebuilding with binary features, but could be useful with SURF.")
 
 DEFINE_int32 (db_restarts, 1, "Number of restarts when building the tree.")
 
 DEFINE_int32 (db_depth, 0, "Depth of the tree to build. Default: 4")
 
 DEFINE_int32 (db_branching_factor, 0, "Branching factor of the tree to build. " "Default: 10")
 
 DEFINE_string (robot_camera, "nav_cam", "Which of bot's cameras to use for map-building. Anything except nav_cam is experimental.")
 
 DEFINE_string (undistorted_camera_params, "", "Assume that the camera has no distortion and given intrinsics. " "Specify as: 'image_wid_x image_wid_y focal_length optical_center_x " "optical_center_y'.")
 
void DetectAllFeatures (int argc, char **argv)
 
void MatchFeatures ()
 
void BuildTracks ()
 
void IncrementalBA ()
 
void CloseLoop ()
 
void BundleAdjust ()
 
void Rebuild ()
 
void PruneMap ()
 
void VocabDB ()
 
void RegistrationOrVerification (std::vector< std::string > const &data_files)
 
void MapInfo ()
 
void SavePoses ()
 
void SaveXYZ ()
 
int main (int argc, char **argv)
 

Variables

bool g_pruning_was_done = false
 

Function Documentation

◆ BuildTracks()

void BuildTracks ( )

◆ BundleAdjust()

void BundleAdjust ( )

◆ CloseLoop()

void CloseLoop ( )

◆ DEFINE_bool() [1/19]

DEFINE_bool ( bundle_adjustment  ,
false  ,
"Perform bundle adjustment."   
)

◆ DEFINE_bool() [2/19]

DEFINE_bool ( feature_detection  ,
false  ,
"Compute features for input images."   
)

◆ DEFINE_bool() [3/19]

DEFINE_bool ( feature_matching  ,
false  ,
"Perform feature matching."   
)

◆ DEFINE_bool() [4/19]

DEFINE_bool ( fix_cameras  ,
false  ,
"Keep the cameras fixed during bundle adjustment."   
)

◆ DEFINE_bool() [5/19]

DEFINE_bool ( incremental_ba  ,
false  ,
"Perform incremental bundle adjustment."   
)

◆ DEFINE_bool() [6/19]

DEFINE_bool ( info  ,
false  ,
"Print some information on the existing map."   
)

◆ DEFINE_bool() [7/19]

DEFINE_bool ( loop_closure  ,
false  ,
"Take a map where images start  repeating,
and close the loop."   
)

◆ DEFINE_bool() [8/19]

DEFINE_bool ( prune  ,
false  ,
"Prune the map (the vocab db is unchanged)."   
)

◆ DEFINE_bool() [9/19]

DEFINE_bool ( rebuild  ,
false  ,
"Rebuild the map with BRISK features."   
)

◆ DEFINE_bool() [10/19]

DEFINE_bool ( rebuild_refloat_cameras  ,
false  ,
"Optimize the cameras as well as part of rebuilding. Usually that is " "avoided when rebuilding with binary  features,
but could be useful with SURF."   
)

◆ DEFINE_bool() [11/19]

DEFINE_bool ( rebuild_replace_camera  ,
false  ,
"During rebuilding replace the camera with the one from ASTROBEE_ROBOT."   
)

◆ DEFINE_bool() [12/19]

DEFINE_bool ( registration  ,
false  ,
"Register the map to world coordinates(requires control points and their xyz coordinates). " "This new data is used to redo the bundle adjustment"   
)

◆ DEFINE_bool() [13/19]

DEFINE_bool ( registration_skip_bundle_adjustment  ,
false  ,
"Skip bundle adjustment during the registration step."   
)

◆ DEFINE_bool() [14/19]

DEFINE_bool ( save_individual_maps  ,
false  ,
"Save separately the maps after  detection,
matching  ,
track  building,
" "incremental bundle  adjustment,
and global bundle adjustment."   
)

◆ DEFINE_bool() [15/19]

DEFINE_bool ( save_poses  ,
false  ,
"Save the camera to world transform and its inverse for each image in the map."   
)

◆ DEFINE_bool() [16/19]

DEFINE_bool ( save_xyz  ,
false  ,
"Save the sparse set of points obtained by triangulating the interest point matches."   
)

◆ DEFINE_bool() [17/19]

DEFINE_bool ( track_building  ,
false  ,
"Perform track building."   
)

◆ DEFINE_bool() [18/19]

DEFINE_bool ( verification  ,
false  ,
"Verify how an already registered map performs on an independently " "acquired set of control points and 3D measurements."   
)

◆ DEFINE_bool() [19/19]

DEFINE_bool ( vocab_db  ,
false  ,
"Build the map with a vocabulary database."   
)

◆ DEFINE_int32() [1/5]

DEFINE_int32 ( db_branching_factor  ,
,
"Branching factor of the tree to build. " "Default: 10"   
)

◆ DEFINE_int32() [2/5]

DEFINE_int32 ( db_depth  ,
,
"Depth of the tree to build. Default: 4"   
)

◆ DEFINE_int32() [3/5]

DEFINE_int32 ( db_restarts  ,
,
"Number of restarts when building the tree."   
)

◆ DEFINE_int32() [4/5]

DEFINE_int32 ( num_repeat_images  ,
,
"How many images from the beginning of the sequence to repeat at the end " "of the  sequence,
to help with loop closure(assuming first and last images " "are similar)."   
)

◆ DEFINE_int32() [5/5]

DEFINE_int32 ( sample_rate  ,
,
"Add one of every n input frames to the map."   
)

◆ DEFINE_string() [1/5]

DEFINE_string ( detector  ,
"SURF"  ,
"Feature detector to use. Options are:  SURF,
ORGBRISK  ,
TEBLID512  ,
TEBLID256."   
)

◆ DEFINE_string() [2/5]

DEFINE_string ( output_map  ,
""  ,
"Output file containing the matches and control network."   
)

◆ DEFINE_string() [3/5]

DEFINE_string ( rebuild_detector  ,
"TEBLID512"  ,
"Feature detector to use. Options are:  SURF,
ORGBRISK  ,
TEBLID512  ,
TEBLID256."   
)

◆ DEFINE_string() [4/5]

DEFINE_string ( robot_camera  ,
"nav_cam"  ,
"Which of bot's cameras to use for map-building. Anything except nav_cam is experimental."   
)

◆ DEFINE_string() [5/5]

DEFINE_string ( undistorted_camera_params  ,
""  ,
"Assume that the camera has no distortion and given intrinsics. " "Specify as: 'image_wid_x image_wid_y focal_length optical_center_x " "optical_center_y'."   
)

◆ DetectAllFeatures()

void DetectAllFeatures ( int  argc,
char **  argv 
)

◆ IncrementalBA()

void IncrementalBA ( )

◆ main()

int main ( int  argc,
char **  argv 
)

◆ MapInfo()

void MapInfo ( )

◆ MatchFeatures()

void MatchFeatures ( )

◆ PruneMap()

void PruneMap ( )

◆ Rebuild()

void Rebuild ( )

◆ RegistrationOrVerification()

void RegistrationOrVerification ( std::vector< std::string > const &  data_files)

◆ SavePoses()

void SavePoses ( )

◆ SaveXYZ()

void SaveXYZ ( )

◆ VocabDB()

void VocabDB ( )

Variable Documentation

◆ g_pruning_was_done

bool g_pruning_was_done = false