00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
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
00052
00053
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