~ubuntu-branches/ubuntu/trusty/hugin/trusty-proposed

« back to all changes in this revision

Viewing changes to src/hugin_cpfind/localfeatures/KeyPointIO.h

  • Committer: Bazaar Package Importer
  • Author(s): Andreas Metzler
  • Date: 2011-01-06 14:28:24 UTC
  • mfrom: (1.1.9 upstream) (0.1.21 experimental)
  • Revision ID: james.westby@ubuntu.com-20110106142824-zn9lxylg5z44dynn
* Drop Cyril Brulebois from Uploaders. Thank you very much for your work.
* Bump package version. (rc3 was re-released as 2010.4.0).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
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
 
 
34
struct LFIMPEX ImageInfo
 
35
{
 
36
        ImageInfo()
 
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;
 
47
        int           dimensions;
 
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
 
 
58
/// Base class for a keypoint writer
 
59
class LFIMPEX KeypointWriter
 
60
{
 
61
 
 
62
protected:
 
63
        std::ostream & o;
 
64
 
 
65
public:
 
66
 
 
67
    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, int dims, double * vec ) = 0;
 
75
 
 
76
        virtual void writeFooter() = 0;
 
77
};
 
78
 
 
79
class LFIMPEX SIFTFormatWriter : public KeypointWriter
 
80
{
 
81
 
 
82
        ImageInfo _image;
 
83
 
 
84
public:
 
85
    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, int dims, double * vec );
 
93
 
 
94
        void writeFooter();
 
95
};
 
96
 
 
97
class LFIMPEX DescPerfFormatWriter : public KeypointWriter
 
98
{
 
99
 
 
100
        ImageInfo _image;
 
101
 
 
102
public:
 
103
    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, int dims, double * vec );
 
111
 
 
112
        void writeFooter();
 
113
};
 
114
 
 
115
 
 
116
class LFIMPEX AutopanoSIFTWriter : public KeypointWriter
 
117
{
 
118
        
 
119
public:
 
120
    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, int dims, double * vec );
 
128
 
 
129
        void writeFooter();
 
130
};
 
131
 
 
132
}
 
133
 
 
134
#endif