ImageAtom.h
Go to the documentation of this file.
00001 #ifndef IMAGE_ATOM_H_
00002 #define IMAGE_ATOM_H_
00003 
00004 #include <pano_core/Images.h>
00005 #include <pano_core/Features.h>
00006 #include <pano_core/Camera.h>
00007 #include <pano_core/Extrinsics.h>
00008 #include <pano_core/pano_interfaces.h>
00009 
00010 namespace pano
00011 {
00012 class ImageAtom : public drawable, public serializable
00013 {
00014 public:
00015 
00016   ImageAtom();
00017   virtual ~ImageAtom();
00018 
00019   ImageAtom(const Camera& camera, const Images& images);
00020 
00021   void detect(const cv::FeatureDetector& detector);
00022 
00023   template<typename DescriptorMatcherT>
00024     void extract(const cv::DescriptorExtractor& extractor, const DescriptorMatcherT& matcher)
00025     {
00026       features_.extract(extractor, images_.grey(), matcher);
00027     }
00028 //  //template<cv::BruteForceMatcher<Hamming> >
00029 //    void extract(const cv::BriefDescriptorExtractor& extractor, const cv::BruteForceMatcher<cv::Hamming>& matcher)
00030 //    {
00031 //      features_.extract(extractor, images_.sum(), matcher);
00032 //    }
00033   void match(const ImageAtom& atom, std::vector<cv::DMatch>& matches,const cv::Mat& H = cv::Mat(), float uncertainty = 25) const;
00034 
00035   void descriptorMatchMask(const ImageAtom& atom, cv::Mat& mask,const cv::Mat& H = cv::Mat(), float uncertainty = 25) const;
00036 
00037   void setUid(int id);
00038   int uid() const
00039   {
00040     return uid_;
00041   }
00042 
00043   Images& images()
00044   {
00045     return images_;
00046   }
00047   Features& features()
00048   {
00049     return features_;
00050   }
00051   Camera& camera()
00052   {
00053     return camera_;
00054   }
00055   Extrinsics & extrinsics()
00056   {
00057     return extrinsics_;
00058   }
00059   const Images& images() const
00060   {
00061     return images_;
00062   }
00063   const Features& features() const
00064   {
00065     return features_;
00066   }
00067   const Camera& camera() const
00068   {
00069     return camera_;
00070   }
00071   const Extrinsics & extrinsics() const
00072   {
00073     return extrinsics_;
00074   }
00075 
00076   cv::Mat undistortPoints();
00077   /*
00078    * drawable functions
00079    */
00080   virtual void draw(cv::Mat* out, int flags = 0);
00081   /*
00082    * serializable functions
00083    */
00084   virtual int version() const
00085   {
00086     return 0;
00087   }
00088 
00089   virtual void serialize(cv::FileStorage& fs) const;
00090   virtual void deserialize(const cv::FileNode& fn);
00091 
00092   void flush()
00093   {
00094     images_.clear();
00095   }
00096 
00097   ImageAtom* clone() const
00098   {
00099     ImageAtom* atom = new ImageAtom(*this);
00100     atom->images_ = images_;
00101    // atom->images_.load(images_.src(), images_.fname(), images_.path());
00102     return atom;
00103   }
00104 
00107   cv::Ptr<ImageAtom> ptrToSelf(){
00108       cv::Ptr<ImageAtom> ptr(this);
00109       ptr.addref();
00110       return ptr;
00111     }
00112   enum
00113   {
00114     DRAW_FEATURES = 1
00115   };
00116 
00117 private:
00118 
00119   Images images_;
00120   Features features_;
00121   Camera camera_;
00122   Extrinsics extrinsics_;
00123   int uid_;
00124 };
00125 }
00126 #endif //IMAGE_ATOM_H_


pano_core
Author(s): Ethan Rublee
autogenerated on Mon Mar 14 2016 10:56:54