SHOGUN v0.9.0
|
00001 /* 00002 * This program is free software; you can redistribute it and/or modify 00003 * it under the terms of the GNU General Public License as published by 00004 * the Free Software Foundation; either version 3 of the License, or 00005 * (at your option) any later version. 00006 * 00007 * Written (W) 2010 Vojtech Franc, Soeren Sonnenburg 00008 * Copyright (C) 2010 Vojtech Franc, xfrancv@cmp.felk.cvut.cz 00009 * Copyright (C) 2010 Berlin Institute of Technology 00010 */ 00011 #ifndef _LBP_PYR_DOTFEATURES__H__ 00012 #define _LBP_PYR_DOTFEATURES__H__ 00013 00014 #include "lib/common.h" 00015 #include "features/DotFeatures.h" 00016 #include "features/SimpleFeatures.h" 00017 00018 namespace shogun 00019 { 00025 class CLBPPyrDotFeatures : public CDotFeatures 00026 { 00027 public: 00029 CLBPPyrDotFeatures(void); 00030 00035 CLBPPyrDotFeatures(CSimpleFeatures<uint32_t>* images, uint16_t num_pyramids); 00036 00037 virtual ~CLBPPyrDotFeatures(); 00038 00045 CLBPPyrDotFeatures(const CLBPPyrDotFeatures & orig){ 00046 SG_PRINT("CLBPPyrDotFeatures:\n"); 00047 SG_NOTIMPLEMENTED;}; 00048 00053 inline virtual int32_t get_dim_feature_space() 00054 { 00055 return vec_nDim; 00056 } 00057 00063 virtual inline int32_t get_nnz_features_for_vector(int32_t num) 00064 { 00065 return vec_nDim; 00066 } 00067 00072 inline virtual EFeatureType get_feature_type() 00073 { 00074 return F_UNKNOWN; 00075 } 00076 00081 inline virtual EFeatureClass get_feature_class() 00082 { 00083 return C_POLY; 00084 } 00085 00090 inline virtual int32_t get_num_vectors() 00091 { 00092 if (m_feat) 00093 return m_feat->get_num_vectors(); 00094 else 00095 return 0; 00096 00097 } 00098 00106 virtual float64_t dot(int32_t vec_idx1, CDotFeatures* df, int32_t vec_idx2); 00107 00112 inline virtual int32_t get_size() 00113 { 00114 return sizeof(float64_t); 00115 } 00116 00126 virtual void* get_feature_iterator(int32_t vector_index) 00127 { 00128 SG_NOTIMPLEMENTED; 00129 return NULL; 00130 } 00131 00142 virtual bool get_next_feature(int32_t& index, float64_t& value, void* iterator) 00143 { 00144 SG_NOTIMPLEMENTED; 00145 return NULL; 00146 } 00147 00153 virtual void free_feature_iterator(void* iterator) 00154 { 00155 SG_NOTIMPLEMENTED; 00156 } 00157 00162 CFeatures* duplicate() const; 00163 00168 inline virtual const char* get_name() const { return "LBPPyrDotFeatures"; } 00169 00177 virtual float64_t dense_dot(int32_t vec_idx1, const float64_t* vec2, int32_t vec2_len); 00178 00187 virtual void add_to_dense_vec(float64_t alpha, int32_t vec_idx1, float64_t* vec2, int32_t vec2_len, bool abs_val=false); 00188 protected: 00189 uint32_t liblbp_pyr_get_dim(uint16_t nPyramids); 00190 00191 protected: 00193 CSimpleFeatures<uint32_t>* m_feat; 00194 00195 uint32_t* img; 00196 int32_t img_nRows; 00197 int32_t img_nCols; 00198 int32_t vec_nDim; 00199 }; 00200 } 00201 #endif /* _LBP_PYR_DOTFEATURES__H__ */