SHOGUN
v3.2.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 * Written (W) 2013 Evangelos Anagnostopoulos 00009 * Copyright (C) 2010 Vojtech Franc, xfrancv@cmp.felk.cvut.cz 00010 * Copyright (C) 2010 Berlin Institute of Technology 00011 */ 00012 #ifndef _LBP_PYR_DOTFEATURES__H__ 00013 #define _LBP_PYR_DOTFEATURES__H__ 00014 00015 #include <shogun/lib/common.h> 00016 #include <shogun/features/DotFeatures.h> 00017 #include <shogun/features/DenseFeatures.h> 00018 00019 namespace shogun 00020 { 00027 class CLBPPyrDotFeatures : public CDotFeatures 00028 { 00029 public: 00031 CLBPPyrDotFeatures(); 00032 00041 CLBPPyrDotFeatures(CDenseFeatures<uint32_t>* image_set, int32_t image_w, int32_t image_h, 00042 uint16_t num_pyramids); 00043 00045 virtual ~CLBPPyrDotFeatures(); 00046 00053 CLBPPyrDotFeatures(const CLBPPyrDotFeatures & orig); 00054 00059 virtual int32_t get_dim_feature_space() const; 00060 00066 virtual int32_t get_nnz_features_for_vector(int32_t num); 00067 00072 virtual EFeatureType get_feature_type() const; 00073 00078 virtual EFeatureClass get_feature_class() const; 00079 00084 virtual int32_t get_num_vectors() const; 00085 00093 virtual float64_t dot(int32_t vec_idx1, CDotFeatures* df, int32_t vec_idx2); 00094 00104 virtual void* get_feature_iterator(int32_t vector_index); 00105 00116 virtual bool get_next_feature(int32_t& index, float64_t& value, void* iterator); 00117 00123 virtual void free_feature_iterator(void* iterator); 00124 00129 CFeatures* duplicate() const; 00130 00135 virtual const char* get_name() const { return "LBPPyrDotFeatures"; } 00136 00144 virtual float64_t dense_dot(int32_t vec_idx1, float64_t* vec2, int32_t vec2_len); 00145 00154 virtual void add_to_dense_vec(float64_t alpha, int32_t vec_idx1, 00155 float64_t* vec2, int32_t vec2_len, bool abs_val=false); 00156 00164 uint32_t* get_image(int32_t index, int32_t& width, int32_t& height); 00165 00170 SGVector<char> get_transformed_image(int32_t index); 00171 protected: 00172 00176 uint32_t liblbp_pyr_get_dim(uint16_t nPyramids); 00177 00184 uint8_t create_lbp_pattern(uint32_t* img, int32_t x, int32_t y); 00185 00186 private: 00187 00189 void init(CDenseFeatures<uint32_t>* image_set, int32_t image_w, 00190 int32_t image_h); 00191 00192 protected: 00194 CDenseFeatures<uint32_t>* images; 00195 00197 int32_t image_width; 00198 00200 int32_t image_height; 00201 00203 int32_t vec_nDim; 00204 }; 00205 } 00206 #endif /* _LBP_PYR_DOTFEATURES__H__ */