00001
00012 #include "rtslam/observationFactory.hpp"
00013 #include "rtslam/featurePoint.hpp"
00014 #include "rtslam/descriptorImagePoint.hpp"
00015 #include "rtslam/descriptorImageSeg.hpp"
00016 #include "rtslam/descriptorSeg.hpp"
00017 #include "rtslam/simuData.hpp"
00018
00019 namespace jafar {
00020 namespace rtslam {
00021
00022 template<class ObsType, class SenType, class LmkType, class AppType,
00023 SensorAbstract::type_enum SenTypeId, LandmarkAbstract::type_enum LmkTypeId>
00024 class ImagePointObservationMaker
00025 : public ObservationMakerAbstract
00026 {
00027 private:
00028 double dmin;
00029 int patchSize;
00030 public:
00031
00032 ImagePointObservationMaker(double _dmin, int _patchSize):
00033 ObservationMakerAbstract(SenTypeId, LmkTypeId), dmin(_dmin), patchSize(_patchSize) {}
00034
00035 observation_ptr_t create(const sensor_ptr_t &senPtr, const landmark_ptr_t &lmkPtr)
00036 {
00037 boost::shared_ptr<ObsType> res(new ObsType(senPtr, lmkPtr));
00038 if (boost::is_same<AppType,AppearanceImagePoint>::value)
00039 {
00040 res->predictedAppearance.reset(new AppearanceImagePoint(patchSize, patchSize, CV_8U));
00041 res->observedAppearance.reset(new AppearanceImagePoint(patchSize, patchSize, CV_8U));
00042 } else
00043 if (boost::is_same<AppType,simu::AppearanceSimu>::value)
00044 {
00045 res->predictedAppearance.reset(new simu::AppearanceSimu());
00046 res->observedAppearance.reset(new simu::AppearanceSimu());
00047 }
00048 res->setup(dmin);
00049 return res;
00050 }
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065 };
00066
00067 #ifdef HAVE_MODULE_DSEG
00068
00069 template<class ObsType, class SenType, class LmkType, class AppType,
00070 SensorAbstract::type_enum SenTypeId, LandmarkAbstract::type_enum LmkTypeId>
00071 class ImageSegmentObservationMaker
00072 : public ObservationMakerAbstract
00073 {
00074 private:
00075 double reparTh;
00076 int killSizeTh;
00077 int killSearchTh;
00078 double killMatchTh;
00079 double killConsistencyTh;
00080 double dmin;
00081 int patchSize;
00082 public:
00083
00084 ImageSegmentObservationMaker(double _reparTh, int _killSizeTh, int _killSearchTh, double _killMatchTh, double _killConsistencyTh, double _dmin, int _patchSize):
00085 ObservationMakerAbstract(SenTypeId, LmkTypeId), reparTh(_reparTh), killSizeTh(_killSizeTh), killSearchTh(_killSearchTh),
00086 killMatchTh(_killMatchTh), killConsistencyTh(_killConsistencyTh), dmin(_dmin), patchSize(_patchSize) {}
00087
00088 observation_ptr_t create(const sensor_ptr_t &senPtr, const landmark_ptr_t &lmkPtr)
00089 {
00090 boost::shared_ptr<ObsType> res(new ObsType(senPtr, lmkPtr));
00091 if (boost::is_same<AppType,AppearanceImageSegment>::value)
00092 {
00093 res->predictedAppearance.reset(new AppearanceImageSegment(patchSize, patchSize, CV_8U));
00094 res->observedAppearance.reset(new AppearanceImageSegment(patchSize, patchSize, CV_8U));
00095 } else
00096 if (boost::is_same<AppType,simu::AppearanceSimu>::value)
00097 {
00098 res->predictedAppearance.reset(new simu::AppearanceSimu());
00099 res->observedAppearance.reset(new simu::AppearanceSimu());
00100 }
00101 res->setup(reparTh, killSizeTh, killSearchTh, killMatchTh, killConsistencyTh, dmin);
00102 return res;
00103 }
00104 };
00105
00106
00107 template<class ObsType, class SenType, class LmkType, class AppType,
00108 SensorAbstract::type_enum SenTypeId, LandmarkAbstract::type_enum LmkTypeId>
00109 class SegmentObservationMaker
00110 : public ObservationMakerAbstract
00111 {
00112 private:
00113 double reparTh;
00114 int killSizeTh;
00115 int killSearchTh;
00116 double killMatchTh;
00117 double killConsistencyTh;
00118 double dmin;
00119 int patchSize;
00120 public:
00121
00122 SegmentObservationMaker(double _reparTh, int _killSizeTh, int _killSearchTh, double _killMatchTh, double _killConsistencyTh, double _dmin, int _patchSize):
00123 ObservationMakerAbstract(SenTypeId, LmkTypeId), reparTh(_reparTh), killSizeTh(_killSizeTh), killSearchTh(_killSearchTh),
00124 killMatchTh(_killMatchTh), killConsistencyTh(_killConsistencyTh), dmin(_dmin), patchSize(_patchSize) {}
00125
00126 observation_ptr_t create(const sensor_ptr_t &senPtr, const landmark_ptr_t &lmkPtr)
00127 {
00128 boost::shared_ptr<ObsType> res(new ObsType(senPtr, lmkPtr));
00129 if (boost::is_same<AppType,AppearanceImageSegment>::value)
00130 {
00131 res->predictedAppearance.reset(new AppearanceImageSegment(patchSize, patchSize, CV_8U));
00132 res->observedAppearance.reset(new AppearanceImageSegment(patchSize, patchSize, CV_8U));
00133 } else
00134 if (boost::is_same<AppType,simu::AppearanceSimu>::value)
00135 {
00136 res->predictedAppearance.reset(new simu::AppearanceSimu());
00137 res->observedAppearance.reset(new simu::AppearanceSimu());
00138 }
00139 res->setup(dmin);
00140 return res;
00141 }
00142 };
00143
00144 #endif
00145
00146 }}