Jafar
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
appearanceImage.hpp
Go to the documentation of this file.
00001 
00007 #ifndef __AppearenceImageSimu_H__
00008 #define __AppearenceImageSimu_H__
00009 
00010 /* --------------------------------------------------------------------- */
00011 /* --- INCLUDE --------------------------------------------------------- */
00012 /* --------------------------------------------------------------------- */
00013 
00014 #include "jmath/jblas.hpp"
00015 #include "image/Image.hpp"
00016 #include "rtslam/appearanceAbstract.hpp"
00017 #include "rtslam/gaussian.hpp"
00018 #include "boost/shared_ptr.hpp"
00019 
00020 
00021 #ifdef HAVE_MODULE_DSEG
00022   #include "dseg/SegmentsSet.hpp"
00023   #include "dseg/SegmentHypothesis.hpp"
00024 #endif
00025 
00026 namespace jafar {
00027   namespace rtslam {
00028 
00029     class AppearanceImagePoint;
00030       typedef boost::shared_ptr<AppearanceImagePoint> app_img_pnt_ptr_t;
00031 
00037     class AppearanceImagePoint: public AppearanceAbstract {
00038       public:
00039         image::Image patch;
00040         unsigned int patchSum;
00041         unsigned int patchSquareSum;
00042         Gaussian offset; 
00043       public:
00044         AppearanceImagePoint(const image::Image& patch, Gaussian const &offset);
00045         AppearanceImagePoint(int width, int height, int depth):
00046           patch(width, height, depth, JfrImage_CS_GRAY), offset(2) {
00047 //          cout << "Created patch with " << width << "x" << height << " pixels; depth: " << depth << "; color space: " << JfrImage_CS_GRAY << endl;
00048         }
00049         virtual ~AppearanceImagePoint();
00050         virtual AppearanceAbstract* clone();
00051 
00052       private:
00053         void computePatchIntegrals();
00054     };
00055 
00056 #ifdef HAVE_MODULE_DSEG
00057 
00058     class AppearanceImageSegment;
00059       typedef boost::shared_ptr<AppearanceImageSegment> app_img_seg_ptr_t;
00060 
00066       class AppearanceImageSegment: public AppearanceAbstract {
00067          public:
00068             image::Image patch;
00069         unsigned int patchMeanLeft;
00070         unsigned int patchMeanRight;
00071         Gaussian offsetTop;
00072         Gaussian offsetBottom;
00073         dseg::SegmentsSet m_hypothesis;
00074       public:
00075         AppearanceImageSegment(const image::Image& patch, Gaussian const &offsetTop, Gaussian const &offsetBottom, dseg::SegmentHypothesis* _hypothesis = NULL);
00076         AppearanceImageSegment(int width, int height, int depth, dseg::SegmentHypothesis* _hypothesis = NULL):
00077           patch(width, height, depth, JfrImage_CS_GRAY),
00078           patchMeanLeft(0),patchMeanRight(0),
00079           offsetTop(2), offsetBottom(2) {
00080           if(_hypothesis != NULL)m_hypothesis.addSegment(_hypothesis);
00081 //          cout << "Created patch with " << width << "x" << height << " pixels; depth: " << depth << "; color space: " << JfrImage_CS_GRAY << endl;
00082             }
00083             virtual ~AppearanceImageSegment();
00084             virtual AppearanceAbstract* clone();
00085 
00086         dseg::SegmentHypothesis* hypothesis() {return m_hypothesis.segmentAt(0);}
00087         void setHypothesis(dseg::SegmentHypothesis* _hypothesis)
00088         {
00089           m_hypothesis = dseg::SegmentsSet();
00090           m_hypothesis.addSegment(_hypothesis);
00091         }
00092 
00093         jblas::vec4 realObs()
00094         {
00095           jblas::vec4 ret;
00096           ret.clear();
00097           if(m_hypothesis.count() > 0)
00098           {
00099             ret[0] = m_hypothesis.segmentAt(0)->x1();
00100             ret[1] = m_hypothesis.segmentAt(0)->y1();
00101             ret[2] = m_hypothesis.segmentAt(0)->x2();
00102             ret[3] = m_hypothesis.segmentAt(0)->y2();
00103           }
00104           return ret;
00105         }
00106       };
00107       
00108 #endif //HAVE_MODULE_DSEG
00109 
00110   }
00111 
00112 }
00113 
00114 
00115 #endif // #ifndef __AppearenceImageSimu_H__
00116 /*
00117  * Local variables:
00118  * mode: c++
00119  * indent-tabs-mode: t
00120  * tab-width: 2
00121  * c-basic-offset: 2
00122  * End:
00123  */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on Wed Oct 15 2014 00:37:26 for Jafar by doxygen 1.7.6.1
LAAS-CNRS