1 #ifndef bstm_util_h 2 #define bstm_util_h 3 //: 4 // \file 5 #include <iostream> 6 #include <bstm/bstm_scene.h> 7 #include <bstm/io/bstm_cache.h> 8 #ifdef _MSC_VER 9 # include <vcl_msvc_warnings.h> 10 #endif 11 #include <vgl/vgl_point_3d.h> 12 #include <vil/vil_image_view.h> 13 #include <vil/vil_load.h> 14 15 //: Utility class with static methods 16 class bstm_util { 17 public: 18 static vnl_vector_fixed<float, 3> 19 expected_color(vnl_vector_fixed<unsigned char, 8> mog); 20 21 static bool query_point(bstm_scene_sptr &scene, 22 bstm_cache_sptr &cache, 23 const vgl_point_3d<double> &point, 24 unsigned time, 25 float &prob, 26 float &intensity); 27 28 static bool query_point_color(bstm_scene_sptr &scene, 29 bstm_cache_sptr &cache, 30 const vgl_point_3d<double> &point, 31 unsigned time, 32 float &prob, 33 vnl_vector_fixed<unsigned char, 3> &rgb); 34 35 // verifies that a scene has a valid appearance, spits out data type and 36 // appearance type size 37 static bool verify_appearance(const std::vector<std::string> &apps, 38 const std::vector<std::string> &valid_types, 39 std::string &data_type, 40 int &appTypeSize); 41 static bool verify_appearance(const bstm_scene &scene, 42 const std::vector<std::string> &valid_types, 43 std::string &data_type, 44 int &appTypeSize); 45 46 static vil_image_view_base_sptr 47 prepare_input_image(const vil_image_view_base_sptr& loaded_image, 48 bool force_grey = true); 49 static vil_image_view_base_sptr prepare_input_image(std::string filename, 50 bool force_grey = true) { 51 vil_image_view_base_sptr loaded_image = vil_load(filename.c_str()); 52 return bstm_util::prepare_input_image(loaded_image, force_grey); 53 } 54 }; 55 56 #endif // bstm_util_h 57