34 std::ifstream in(filename.c_str());
42 in >> nKeypoints >> dims;
43 return (in && nKeypoints > 0 && dims >= 0);
49 std::ifstream in(filename.c_str());
57 in >> nKeypoints >> dims;
61 for (
int i = 0; i < nKeypoints; i++)
64 in >> k->_y >> k->_x >> k->_scale >> k->_ori >> k->_score;
68 for (
int j = 0; j < dims; j++)
102 o << nKeypoints << std::endl;
103 o << dims << std::endl;
109 o << y <<
" " << x <<
" " << scale <<
" " << orientation <<
" " << score;
110 for (
int i = 0; i < dims; i++)
127 o << dims << std::endl;
128 o << nKeypoints << std::endl;
134 double sc = 2.5 * scale;
136 o << x <<
" " << y <<
" " << 1.0 / sc <<
" 0 " << 1.0 / sc;
137 for (
int i = 0; i < dims; i++)
151 o <<
"<?xml version=\"1.0\" encoding=\"utf-8\"?>" << std::endl;
152 o <<
"<KeypointXMLList xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\n";
153 o <<
" <XDim>" << imageinfo.
width <<
"</XDim>" << std::endl;
154 o <<
" <YDim>" << imageinfo.
height <<
"</YDim>" << std::endl;
155 o <<
" <ImageFile>" << imageinfo.
filename <<
"</ImageFile>" << std::endl;
156 o <<
" <Arr>" << std::endl;
161 o <<
" <KeypointN>" << std::endl;
162 o <<
" <X>" << x <<
"</X>" << std::endl;
163 o <<
" <Y>" << y <<
"</Y>" << std::endl;
164 o <<
" <Scale>" << scale <<
"</Scale>" << std::endl;
165 o <<
" <Orientation>" << orientation <<
"</Orientation>" << std::endl;
168 o <<
" <Dim>" << dims <<
"</Dim>" << std::endl;
169 o <<
" <Descriptor>" << std::endl;
171 for (
int i = 0; i < dims; i++)
173 o <<
" <int>" << (vec[i] * 256) <<
"</int>" << std::endl;
175 o <<
" </Descriptor>" << std::endl;
177 o <<
" </KeypointN>" << std::endl;
182 o <<
" </Arr>" << std::endl;
183 o <<
"</KeypointXMLList>" << std::endl;
std::vector< KeyPointPtr > KeyPointVect_t
static ImageInfo loadSIFTKeypoints(const std::string &filename, KeyPointVect_t &vec)
static bool identifySIFTKeypoints(const std::string &filename)
void writeKeypoint(double x, double y, double scale, double orientation, double score, int dims, double *vec)
void writeHeader(const ImageInfo &imageinfo, int nKeypoints, int dims)
std::shared_ptr< KeyPoint > KeyPointPtr
static void info(const char *fmt,...)
ImageInfo loadKeypoints(const std::string &filename, KeyPointVect_t &vec)