Go to the documentation of this file.00001
00009 #ifndef DESCRIPTORIMAGEPOINTSIMU_H_
00010 #define DESCRIPTORIMAGEPOINTSIMU_H_
00011
00012 #include "boost/shared_ptr.hpp"
00013
00014
00015 #include "rtslam/observationAbstract.hpp"
00016 #include "rtslam/observationPinHoleEuclideanPoint.hpp"
00017 #include "rtslam/observationPinHoleAnchoredHomogeneous.hpp"
00018
00019
00020 #include "rtslam/descriptorAbstract.hpp"
00021 #include "rtslam/featurePoint.hpp"
00022 #include "rtslam/appearanceImage.hpp"
00023
00024 namespace jafar {
00025 namespace rtslam {
00026
00027 class DescriptorImagePointFirstView;
00028 typedef boost::shared_ptr<DescriptorImagePointFirstView> desc_img_pnt_fv_ptr_t;
00029 class DescriptorImagePointMultiView;
00030 typedef boost::shared_ptr<DescriptorImagePointMultiView> desc_img_pnt_mv_ptr_t;
00031
00036 class FeatureView
00037 {
00038 public:
00039 jblas::vec7 senPose;
00040 appearance_ptr_t appearancePtr;
00041 observation_model_ptr_t obsModelPtr;
00042 jblas::vec measurement;
00043 unsigned frame;
00044 bool used;
00045
00046 void clear()
00047 {
00048 appearancePtr.reset();
00049 obsModelPtr.reset();
00050 }
00051
00052 bool initFromObs(const observation_ptr_t & obsPtr, int descSize);
00053 };
00054
00055 std::ostream& operator <<(std::ostream & s, FeatureView const & fv);
00056 image::oimstream& operator <<(image::oimstream & s, FeatureView const & fv);
00057
00063 class DescriptorImagePointFirstView: public DescriptorAbstract {
00064 protected:
00065 FeatureView view;
00066 protected:
00067 int descSize;
00068 public:
00069 DescriptorImagePointFirstView(int descSize);
00070 virtual ~DescriptorImagePointFirstView();
00071
00072 virtual std::string typeName() const {
00073 return "Image-Point-First-View";
00074 }
00075
00076 virtual bool addObservation(const observation_ptr_t & obsPtr);
00077 virtual bool predictAppearance(const observation_ptr_t & obsPtrNew);
00078 virtual bool isPredictionValid(const observation_ptr_t & obsPtr) { return true; }
00079
00080 virtual void desc_text(std::ostream& os) const;
00081 virtual void desc_image(image::oimstream& os) const;
00082 };
00083
00084 class DescriptorImagePointFirstViewFactory: public DescriptorFactoryAbstract
00085 {
00086 protected:
00087 int descSize;
00088 public:
00089 DescriptorImagePointFirstViewFactory(int descSize):
00090 descSize(descSize) {}
00091 DescriptorAbstract *createDescriptor()
00092 { return new DescriptorImagePointFirstView(descSize); }
00093 };
00094
00095
00096
00097
00103 class DescriptorImagePointMultiView: public DescriptorAbstract
00104 {
00105 public:
00106 typedef std::vector<FeatureView> FeatureViewList;
00107 enum PredictionType { ptNone = 0, ptAffine, ptHomographic };
00108
00109 protected:
00110 FeatureViewList views;
00111 FeatureView lastValidView;
00112 bool lastObsFailed;
00113 protected:
00114 int descSize;
00115 double scaleStep;
00116 double angleStep;
00117 PredictionType predictionType;
00118 private:
00119 double cosAngleStep;
00120 public:
00121 DescriptorImagePointMultiView(int descSize, double scaleStep, double angleStep, PredictionType predictionType);
00122 virtual ~DescriptorImagePointMultiView() {}
00123
00124 virtual std::string typeName() const {
00125 return "Image-Point-Multi-View";
00126 }
00127
00128 virtual bool addObservation(const observation_ptr_t & obsPtr);
00129 virtual bool predictAppearance(const observation_ptr_t & obsPtr);
00130 virtual bool isPredictionValid(const observation_ptr_t & obsPtr);
00131
00132 virtual void desc_text(std::ostream& os) const;
00133 virtual void desc_image(image::oimstream& os) const;
00134 protected:
00138 inline void checkView(jblas::vec const ¤t_pov, double const ¤t_pov_norm2, jblas::vec const &lmk, FeatureView &view, double &cosClosestAngle, FeatureView* &closestView) const;
00139 bool getClosestView(const observation_ptr_t & obsPtr, FeatureView* &closestView);
00140 };
00141
00142 class DescriptorImagePointMultiViewFactory: public DescriptorFactoryAbstract
00143 {
00144 protected:
00145 int descSize;
00146 double scaleStep;
00147 double angleStep;
00148 DescriptorImagePointMultiView::PredictionType predictionType;
00149 public:
00150 DescriptorImagePointMultiViewFactory(int descSize, double scaleStep, double angleStep, DescriptorImagePointMultiView::PredictionType predictionType):
00151 descSize(descSize), scaleStep(scaleStep), angleStep(angleStep), predictionType(predictionType) {}
00152 DescriptorAbstract *createDescriptor()
00153 { return new DescriptorImagePointMultiView(descSize, scaleStep, angleStep, predictionType); }
00154 };
00155
00156 }
00157 }
00158 #endif