IO.cpp
Go to the documentation of this file.
00001 
00024 #include <iostream>
00025 #include <vector>
00026 #include <opencv/cv.h>
00027 #include <opencv/highgui.h>
00028 #include <string>
00029 #include "IO.h"
00030 
00031 using namespace std;
00032 using namespace DUtilsCV;
00033 
00034 // ----------------------------------------------------------------------------
00035 
00036 void IO::saveKeyPoints(const std::string &filename,
00037     const std::vector<cv::KeyPoint> &keys,
00038     const std::string &nodename)
00039 {
00040   cv::FileStorage fs(filename, cv::FileStorage::WRITE);
00041   cv::write(fs, nodename, keys);
00042 }
00043 
00044 // ----------------------------------------------------------------------------
00045   
00046 void IO::loadKeyPoints(const std::string &filename,
00047     std::vector<cv::KeyPoint> &keys,
00048     const std::string &nodename)
00049 {
00050   keys.resize(0);
00051   cv::FileStorage fs(filename, cv::FileStorage::READ);
00052   cv::read(fs[nodename], keys);
00053 }
00054 
00055 // ----------------------------------------------------------------------------
00056 
00057 void IO::print(const cv::Mat &m, const std::string &name, std::ostream &f)
00058 {
00059   switch(m.type())
00060   {
00061     case CV_8U: IO::print<unsigned char>(m, name, f); break;
00062     case CV_8S: IO::print<char>(m, name, f); break;
00063     case CV_16U: IO::print<unsigned short>(m, name, f); break;
00064     case CV_16S: IO::print<short>(m, name, f); break;
00065     case CV_32S: IO::print<int>(m, name, f); break;
00066     case CV_32F: IO::print<float>(m, name, f); break;
00067     case CV_64F: IO::print<double>(m, name, f); break;
00068   }
00069 }
00070 
00071 // ----------------------------------------------------------------------------
00072 
00073 


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