57 #define HEADER_FEATURE_SET "FEATURESET" 127 FILE *f = fopen(pFileName,
"wb");
137 #ifdef IVT_BIG_ENDIAN 143 if (fwrite(&temp,
sizeof(
int), 1, f) != 1)
155 #ifdef IVT_BIG_ENDIAN 158 temp = nContourPoints;
161 if (fwrite(&temp,
sizeof(
int), 1, f) != 1)
164 for (i = 0; i < nContourPoints; i++)
168 #ifdef IVT_BIG_ENDIAN 176 const float u = point.
point.
x;
177 const float v = point.
point.
y;
184 if (fwrite(&u,
sizeof(
float), 1, f) != 1)
187 if (fwrite(&v,
sizeof(
float), 1, f) != 1)
190 if (fwrite(&x,
sizeof(
float), 1, f) != 1)
193 if (fwrite(&y,
sizeof(
float), 1, f) != 1)
196 if (fwrite(&z,
sizeof(
float), 1, f) != 1)
199 if (fwrite(&nHas3dPoint,
sizeof(
int), 1, f) != 1)
206 #ifdef IVT_BIG_ENDIAN 212 if (fwrite(&temp,
sizeof(
int), 1, f) != 1)
215 for (i = 0; i < nFeatures; i++)
219 #ifdef IVT_BIG_ENDIAN 222 int type = pFeatureEntry->
GetType();
225 if (fwrite(&type,
sizeof(
int), 1, f) != 1)
242 FILE *f = fopen(pFileName,
"rb");
258 if (fread(&nStringLength,
sizeof(
int), 1, f) != 1)
261 #ifdef IVT_BIG_ENDIAN 265 if (nStringLength < 0 || nStringLength > 4096)
270 if (nStringLength > 0)
273 char *pBuffer =
new char[nStringLength + 1];
276 if (fread(pBuffer, nStringLength, 1, f) != 1)
280 pBuffer[nStringLength] =
'\0';
293 if (fread(&nContourPoints,
sizeof(
int), 1, f) != 1)
299 #ifdef IVT_BIG_ENDIAN 303 if (nContourPoints < 0)
306 for (i = 0; i < nContourPoints; i++)
311 if (fread(&u,
sizeof(
float), 1, f) != 1)
317 if (fread(&v,
sizeof(
float), 1, f) != 1)
323 if (fread(&x,
sizeof(
float), 1, f) != 1)
329 if (fread(&y,
sizeof(
float), 1, f) != 1)
335 if (fread(&z,
sizeof(
float), 1, f) != 1)
341 if (fread(&nHas3dPoint,
sizeof(
int), 1, f) != 1)
347 #ifdef IVT_BIG_ENDIAN 366 if (fread(&nFeatures,
sizeof(
int), 1, f) != 1)
375 #ifdef IVT_BIG_ENDIAN 379 for (i = 0; i < nFeatures; i++)
383 if (fread(&type,
sizeof(
int), 1, f) != 1)
389 #ifdef IVT_BIG_ENDIAN 403 printf(
"error: type %i in file '%s' is note supported\n", type, pFileName);
409 printf(
"error: ReadFromFile\n");
virtual bool ReadFromFile(FILE *pFile)
bool LoadFromFile(const char *pFileName)
float invert_byte_order_float(float x)
void AddContourPoint(const Vec2d &point)
Base class for the representation of local features.
virtual eFeatureType GetType() const =0
void AddFeatureWithoutCloning(CFeatureEntry *pFeature)
Data structure for the representation of a 3D vector.
GLuint GLuint GLsizei GLenum type
unsigned int invert_byte_order_int(unsigned int x)
Data structure for the representation of SIFT features.
#define HEADER_FEATURE_SET
void SetVec(Vec3d &vec, float x, float y, float z)
virtual CFeatureEntry * Clone() const =0
CDynamicArrayTemplatePointer< CFeatureEntry > m_featureArray
void SetName(const char *pName)
virtual bool WriteToFile(FILE *pFile) const
void ClearContourPointList()
Data structure for the representation of a 2D vector.
void SetVec(Vec2d &vec, float x, float y)
void AddFeature(const CFeatureEntry *pFeature)
CDynamicArrayTemplate< ContourPoint > m_contourPointArray
bool SaveToFile(const char *pFileName) const
void AddElement(T *pElement)