KeyPointIO.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2009 Pablo d'Angelo
00003  *
00004  * This file is part of Panomatic.
00005  *
00006  * Panomatic is free software; you can redistribute it and/or modify
00007  * it under the terms of the GNU General Public License as published by
00008  * the Free Software Foundation; either version 2 of the License, or
00009  * (at your option) any later version.
00010  *
00011  * Panomatic is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License
00017  * along with Panomatic; if not, write to the Free Software
00018  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019  */
00020 
00021 
00022 #ifndef __lfeat_KeyPointIO_h
00023 #define __lfeat_KeyPointIO_h
00024 
00025 #include <iostream>
00026 #include <string>
00027 
00028 #include "KeyPoint.h"
00029 #include "KeyPointDetector.h"
00030 
00031 namespace lfeat
00032 {
00033 
00034 struct LFIMPEX ImageInfo
00035 {
00036     ImageInfo()
00037         : width(0), height(0), dimensions(0)
00038     { }
00039 
00040     ImageInfo(const std::string& filename, int width, int height)
00041         : filename(filename), width(width), height(height), dimensions(0)
00042     { }
00043 
00044     std::string   filename;
00045     int           width;
00046     int           height;
00047     int           dimensions;
00048 };
00049 
00050 
00051 // functions to read keypoints
00052 //bool identifySIFTKeypoints( const std::string & filename);
00053 //ImageInfo loadSIFTKeypoints( const std::string & filename, KeyPointInsertor & insertor);
00054 
00055 ImageInfo LFIMPEX loadKeypoints( const std::string& filename, KeyPointVect_t& insertor);
00056 
00057 
00059 class LFIMPEX KeypointWriter
00060 {
00061 
00062 protected:
00063     std::ostream& o;
00064 
00065 public:
00066 
00067     KeypointWriter(std::ostream& out=std::cout)
00068         : o ( out )
00069     {
00070     }
00071 
00072     virtual void writeHeader ( const ImageInfo& imageinfo, int nKeypoints, int dims ) = 0;
00073 
00074     virtual void writeKeypoint ( double x, double y, double scale, double orientation, double score, int dims, double* vec ) = 0;
00075 
00076     virtual void writeFooter() = 0;
00077 };
00078 
00079 class LFIMPEX SIFTFormatWriter : public KeypointWriter
00080 {
00081 
00082     ImageInfo _image;
00083 
00084 public:
00085     SIFTFormatWriter(std::ostream& out=std::cout)
00086         : KeypointWriter(out)
00087     {
00088     }
00089 
00090     void writeHeader (const ImageInfo& imageinfo, int nKeypoints, int dims );
00091 
00092     void writeKeypoint ( double x, double y, double scale, double orientation, double score, int dims, double* vec );
00093 
00094     void writeFooter();
00095 };
00096 
00097 class LFIMPEX DescPerfFormatWriter : public KeypointWriter
00098 {
00099 
00100     ImageInfo _image;
00101 
00102 public:
00103     DescPerfFormatWriter(std::ostream& out=std::cout)
00104         : KeypointWriter(out)
00105     {
00106     }
00107 
00108     void writeHeader (const ImageInfo& imageinfo, int nKeypoints, int dims );
00109 
00110     void writeKeypoint ( double x, double y, double scale, double orientation, double score, int dims, double* vec );
00111 
00112     void writeFooter();
00113 };
00114 
00115 
00116 class LFIMPEX AutopanoSIFTWriter : public KeypointWriter
00117 {
00118 
00119 public:
00120     AutopanoSIFTWriter(std::ostream& out=std::cout)
00121         : KeypointWriter(out)
00122     {
00123     }
00124 
00125     void writeHeader ( const ImageInfo& imageinfo, int nKeypoints, int dims );
00126 
00127     void writeKeypoint ( double x, double y, double scale, double orientation, double score, int dims, double* vec );
00128 
00129     void writeFooter();
00130 };
00131 
00132 }
00133 
00134 #endif

Generated on 5 Dec 2014 for Hugintrunk by  doxygen 1.4.7