00001 #ifndef rgrl_feature_face_pt_h_ 00002 #define rgrl_feature_face_pt_h_ 00003 //: 00004 // \file 00005 // \brief Class to represent a N-d face edge element. 00006 // It has 1 normal direction and N-1 tangent directions. 00007 // There could be a defined image region surrounding these. 00008 // \author Chuck Stewart 00009 // \date 16 Sep 2003 00010 // \verbatim 00011 // Modifications 00012 // 17 Oct 2006 GY: put in signature error vector 00013 // Nov 2008 J Becker: Added a clone function. 00014 // \endverbatim 00015 00016 #include <rgrl/rgrl_feature.h> 00017 #include <vcl_iosfwd.h> 00018 00019 class rgrl_feature_face_pt 00020 : public rgrl_feature 00021 { 00022 public: 00023 rgrl_feature_face_pt( vnl_vector< double > const& location, 00024 vnl_vector< double > const& normal ); 00025 00026 //: read in feature 00027 virtual 00028 bool read( vcl_istream& is, bool skip_tag=false ); 00029 00030 //: write out feature 00031 virtual 00032 void write( vcl_ostream& os ) const; 00033 00034 virtual 00035 vnl_matrix<double> const& 00036 error_projector() const; 00037 00038 virtual 00039 vnl_matrix<double> const& 00040 error_projector_sqrt() const; 00041 00042 virtual unsigned int num_constraints() const; 00043 00044 // Defines type-related functions 00045 rgrl_type_macro( rgrl_feature_face_pt, rgrl_feature ); 00046 00047 virtual vnl_vector<double> const& normal() const; 00048 00049 //: Return a matrix whose columns form the subspace tangent to the face normal 00050 virtual vnl_matrix<double> const& 00051 tangent_subspace(); 00052 00053 //: Result is a rgrl_feature_face_pt 00054 virtual rgrl_feature_sptr transform( rgrl_transformation const& xform ) const; 00055 00056 //: Compute the signature weight between two features. 00057 virtual double absolute_signature_weight( rgrl_feature_sptr other ) const; 00058 00059 //: Compute the signature error vector between two features. 00060 virtual vnl_vector<double> signature_error_vector( rgrl_feature const& other ) const; 00061 00062 //: the dimensions of the signature error vector. 00063 virtual unsigned signature_error_dimension( const vcl_type_info& other_feature_type ) const; 00064 00065 //: make a clone copy 00066 virtual rgrl_feature_sptr clone() const; 00067 00068 protected: 00069 friend class rgrl_feature_reader; 00070 //: 00071 // Create an uninitialized face_pt of dimension dim 00072 // 00073 rgrl_feature_face_pt( ); 00074 00075 // to be able to use the protected constructor 00076 friend rgrl_feature_sptr 00077 rgrl_feature_reader( vcl_istream& is ); 00078 00079 //: Apply transformation to the scale property 00080 virtual double 00081 transform_scale( rgrl_transformation const& xform ) const; 00082 00083 //: The location, the normal, and the error projector. 00084 vnl_vector<double> normal_; 00085 mutable vnl_matrix<double> err_proj_, err_proj_sqrt_; 00086 00087 private: 00088 00089 //: The basis for the subspace of vectors normal to the normal direction. 00090 // This is tangent subspace. It is computed once, when first needed, and cached. 00091 // This is because the feature 00092 // location and tangent are fixed. 00093 bool subspace_cached_; 00094 vnl_matrix< double > tangent_subspace_; 00095 }; 00096 00097 00098 #endif