arm_obj_segmentation.h
Go to the documentation of this file.
00001 // OpenCV
00002 #include <opencv2/core/core.hpp>
00003 #include <tabletop_pushing/extern/graphcut/graph.h>
00004 #include <tabletop_pushing/extern/gmm/gmm.h>
00005 
00006 #ifndef arm_obj_segmentation_h_DEFINED
00007 #define arm_obj_segmentation_h_DEFINED 1
00008 namespace tabletop_pushing
00009 {
00010 
00011 typedef Graph<float, float, float> GraphType;
00012 class NodeTable;
00013 
00014 class ArmObjSegmentation
00015 {
00016  public:
00017   ArmObjSegmentation(float fg_tied_weight = 10.0, float bg_tied_weight = 10.0, float bg_enlarge_size = 100,
00018                      float arm_enlarge_width = 15, float arm_shrink_width_ = 15,float sigma = 1.0, float lambda = 5.0);
00019   cv::Mat segment(cv::Mat& color_img, cv::Mat& depth_img, cv::Mat& self_mask, cv::Mat& table_mask,
00020                   bool init_color_models=true);
00021   static cv::Mat getArmBand(cv::Mat& input_mask, int enlarge_width, int shrink_width, bool input_inverted=true);
00022   static cv::Mat getArmBand(cv::Mat& input_mask, int enlarge_width, int shrink_width, bool input_inverted,
00023                             cv::Mat& larger_mask,  cv::Mat& smaller_mask);
00024   void loadArmColorModel(std::string file_path);
00025   void loadBGColorModel(std::string file_path);
00026   void setBGColorModel(GMM& new_bg_model);
00027   void buildBGColorModel(GMM& table_color_model, GMM& obj_color_model);
00028  protected:
00029   cv::Mat getXImageDeriv(cv::Mat& color_img);
00030   cv::Mat getYImageDeriv(cv::Mat& color_img);
00031   static cv::Mat getMorphCross(int img_size, int cross_width);
00032   static cv::Mat convertFlowToMat(tabletop_pushing::GraphType *g, tabletop_pushing::NodeTable& nt, int R, int C);
00033 
00034   static float getUnaryWeight(cv::Vec3f sample, GMM& fg_color_model);
00035   static GMM getGMMColorModel(cv::Mat& samples, cv::Mat& mask, int nc=10);
00036 
00037   float getEdgeWeightBoundary(float c0, float d0, float c1, float d1);
00038 
00039   // Members
00040   float fg_tied_weight_;
00041   float bg_tied_weight_;
00042   float bg_enlarge_size_;
00043   float arm_enlarge_width_;
00044   float arm_shrink_width_;
00045   float sigma_d_;
00046   float pairwise_lambda_;
00047   cv::Mat dy_kernel_;
00048   cv::Mat dx_kernel_;
00049   GMM arm_color_model_;
00050   GMM bg_color_model_;
00051   bool have_arm_color_model_;
00052   bool have_bg_color_model_;
00053 };
00054 };
00055 #endif // arm_obj_segmentation_h_DEFINED


tabletop_pushing
Author(s): Tucker Hermans
autogenerated on Wed Nov 27 2013 11:59:43