Go to the documentation of this file.00001
00002 #ifndef bsta_mean_shift_h_
00003 #define bsta_mean_shift_h_
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #include <bsta/bsta_parzen_sphere.h>
00019 #include <bsta/bsta_mixture.h>
00020 #include <bsta/bsta_attributes.h>
00021 #include <bsta/bsta_gaussian_sphere.h>
00022 #include <bsta/bsta_gaussian_full.h>
00023 #include <vnl/vnl_random.h>
00024 #include <vcl_utility.h>
00025 #include <bsta/algo/bsta_sample_set.h>
00026
00027 template <class T, unsigned n>
00028 class bsta_mean_shift
00029 {
00030 public:
00031 typedef typename bsta_parzen_sphere<T,n>::vector_type vector_;
00032
00033
00034
00035 bsta_mean_shift() : max_iter_(1000) {}
00036
00037
00038
00039
00040 bool find_modes(bsta_sample_set<T,n>& set, vnl_random & rng, float percentage = 10.0f, T epsilon = 10e-3);
00041
00042
00043 bool find_modes(bsta_sample_set<T,n>& set, T epsilon = 10e-3);
00044
00045
00046
00047 bool trim_modes(bsta_sample_set<T,n>& set, T epsilon = 10e-3);
00048
00049
00050 bool merge_modes(bsta_sample_set<T,n>& set, int cnt, T epsilon);
00051
00052 void clear() { modes_.clear(); }
00053
00054 unsigned size() const { return modes_.size(); }
00055 vcl_vector<vector_ >& modes() { return modes_; }
00056
00057
00058 void set_max_iter(unsigned iter) { max_iter_ = iter; }
00059
00060 private:
00061
00062 vcl_vector<vector_ > modes_;
00063
00064 unsigned max_iter_;
00065 };
00066
00067 #endif // bsta_mean_shift_h_