Matches.cpp
Go to the documentation of this file.
00001 
00024 #include <iostream>
00025 #include <vector>
00026 #include <string>
00027 #include <opencv/cv.h>
00028 #include <opencv/highgui.h>
00029 #include "Matches.h"
00030 
00031 // ---------------------------------------------------------------------------
00032 
00033 void DVision::Matches::Save(const std::string &filename,
00034     const std::vector<int> &c1, const std::vector<int> &c2)
00035 {
00036   cv::FileStorage fs(filename, cv::FileStorage::WRITE);  
00037   DVision::Matches::save(fs, c1, c2);
00038 }
00039 
00040 // ---------------------------------------------------------------------------
00041 
00042 void DVision::Matches::save(cv::FileStorage &fs, const std::vector<int> &c0, 
00043     const std::vector<int> &c1)
00044 {
00045   cv::write(fs, "c0", c0);
00046   cv::write(fs, "c1", c1);
00047 }
00048 
00049 // ---------------------------------------------------------------------------
00050 
00051 void DVision::Matches::Load(const std::string &filename,
00052     std::vector<int> &c1, std::vector<int> &c2)
00053 {
00054   cv::FileStorage fs(filename, cv::FileStorage::READ);
00055   DVision::Matches::load(fs, c1, c2);
00056 }
00057 
00058 // ---------------------------------------------------------------------------
00059 
00060 void DVision::Matches::Load(const std::string &filename,
00061   std::vector<unsigned int> &c1, std::vector<unsigned int> &c2)
00062 {
00063   std::vector<int> a1, a2;
00064   DVision::Matches::Load(filename, a1, a2);
00065   
00066   c1.resize(a1.size());
00067   std::copy(a1.begin(), a1.end(), c1.begin());
00068   
00069   c2.resize(a2.size());
00070   std::copy(a2.begin(), a2.end(), c2.begin());
00071 }
00072 
00073 // ---------------------------------------------------------------------------
00074 
00075 void DVision::Matches::load(cv::FileStorage &fs, std::vector<int> &c0, 
00076     std::vector<int> &c1)
00077 {
00078   cv::read(fs["c0"], c0);
00079   cv::read(fs["c1"], c1);
00080 }
00081 
00082 // ---------------------------------------------------------------------------
00083 
00084 void DVision::Matches::Save(const std::string &filename,
00085     const SurfSet &s1, const SurfSet &s2,
00086     const std::vector<int> &c1, const std::vector<int> &c2)
00087 {
00088   cv::FileStorage fs(filename, cv::FileStorage::WRITE);
00089   s1.save(fs, 0);
00090   s2.save(fs, 1);
00091   DVision::Matches::save(fs, c1, c2);
00092 }
00093 
00094 // ---------------------------------------------------------------------------
00095 
00096 void DVision::Matches::Load(const std::string &filename,
00097     SurfSet &s1, SurfSet &s2,
00098     std::vector<int> &c1, std::vector<int> &c2)
00099 {
00100   cv::FileStorage fs(filename, cv::FileStorage::READ); 
00101   s1.load(fs, 0);
00102   s2.load(fs, 1);
00103   DVision::Matches::load(fs, c1, c2);
00104 }
00105 
00106 // ---------------------------------------------------------------------------
00107 
00108 


re_vision
Author(s): Dorian Galvez-Lopez
autogenerated on Sun Jan 5 2014 11:31:52