Hugintrunk  0.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
KeyPointIO.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2009 Pablo d'Angelo
3  *
4  * This file is part of Panomatic.
5  *
6  * Panomatic is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * Panomatic is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with Panomatic; if not, write to the Free Software
18  * <http://www.gnu.org/licenses/>.
19  */
20 
21 
22 #ifndef __lfeat_KeyPointIO_h
23 #define __lfeat_KeyPointIO_h
24 
25 #include <iostream>
26 #include <string>
27 
28 #include "KeyPoint.h"
29 #include "KeyPointDetector.h"
30 
31 namespace lfeat
32 {
33 
35 {
37  : width(0), height(0), dimensions(0)
38  { }
39 
40  ImageInfo(const std::string& filename, int width, int height)
41  : filename(filename), width(width), height(height), dimensions(0)
42  { }
43 
44  std::string filename;
45  int width;
46  int height;
48 };
49 
50 
51 // functions to read keypoints
52 //bool identifySIFTKeypoints( const std::string & filename);
53 //ImageInfo loadSIFTKeypoints( const std::string & filename, KeyPointInsertor & insertor);
54 
55 ImageInfo LFIMPEX loadKeypoints( const std::string& filename, KeyPointVect_t& insertor);
56 
57 
60 {
61 
62 protected:
63  std::ostream& o;
64 
65 public:
66 
67  explicit KeypointWriter(std::ostream& out=std::cout)
68  : o ( out )
69  {
70  }
71 
72  virtual void writeHeader ( const ImageInfo& imageinfo, int nKeypoints, int dims ) = 0;
73 
74  virtual void writeKeypoint ( double x, double y, double scale, double orientation, double score, int dims, double* vec ) = 0;
75 
76  virtual void writeFooter() = 0;
77 };
78 
80 {
81 
83 
84 public:
85  explicit SIFTFormatWriter(std::ostream& out=std::cout)
86  : KeypointWriter(out)
87  {
88  }
89 
90  void writeHeader (const ImageInfo& imageinfo, int nKeypoints, int dims );
91 
92  void writeKeypoint ( double x, double y, double scale, double orientation, double score, int dims, double* vec );
93 
94  void writeFooter();
95 };
96 
98 {
99 
101 
102 public:
103  explicit DescPerfFormatWriter(std::ostream& out=std::cout)
104  : KeypointWriter(out)
105  {
106  }
107 
108  void writeHeader (const ImageInfo& imageinfo, int nKeypoints, int dims );
109 
110  void writeKeypoint ( double x, double y, double scale, double orientation, double score, int dims, double* vec );
111 
112  void writeFooter();
113 };
114 
115 
117 {
118 
119 public:
120  explicit AutopanoSIFTWriter(std::ostream& out=std::cout)
121  : KeypointWriter(out)
122  {
123  }
124 
125  void writeHeader ( const ImageInfo& imageinfo, int nKeypoints, int dims );
126 
127  void writeKeypoint ( double x, double y, double scale, double orientation, double score, int dims, double* vec );
128 
129  void writeFooter();
130 };
131 
132 }
133 
134 #endif
std::vector< KeyPointPtr > KeyPointVect_t
Definition: KeyPoint.h:111
KeypointWriter(std::ostream &out=std::cout)
Definition: KeyPointIO.h:67
SIFTFormatWriter(std::ostream &out=std::cout)
Definition: KeyPointIO.h:85
DescPerfFormatWriter(std::ostream &out=std::cout)
Definition: KeyPointIO.h:103
Base class for a keypoint writer.
Definition: KeyPointIO.h:59
ImageInfo(const std::string &filename, int width, int height)
Definition: KeyPointIO.h:40
std::ostream & o
Definition: KeyPointIO.h:63
AutopanoSIFTWriter(std::ostream &out=std::cout)
Definition: KeyPointIO.h:120
#define LFIMPEX
Definition: hugin_shared.h:41
ImageInfo loadKeypoints(const std::string &filename, KeyPointVect_t &vec)
Definition: KeyPointIO.cpp:85
std::string filename
Definition: KeyPointIO.h:44