Commit 78094af4 authored by Davis King's avatar Davis King

Moved the metadata IO routines into their own file. Also made it so that

the XSLT stylesheet file is always created in the same directory as the
main XML metadata file.
parent 0175116f
......@@ -14,6 +14,8 @@ PROJECT(${target_name})
# cmake that they are part of our target (which is the executable named imglab)
ADD_EXECUTABLE(${target_name}
src/main.cpp
src/image_dataset_metadata.h
src/image_dataset_metadata.cpp
)
......
This diff is collapsed.
// Copyright (C) 2011 Davis E. King (davis@dlib.net)
// License: Boost Software License See LICENSE.txt for the full license.
#ifndef DLIB_IMAGE_DAtASET_METADATA_H__
#define DLIB_IMAGE_DAtASET_METADATA_H__
#include <string>
#include <vector>
#include <dlib/geometry.h>
// ----------------------------------------------------------------------------------------
namespace dlib
{
namespace image_dataset_metadata
{
struct box
{
box() : head(-0xFFFF,-0xFFFF) {}
rectangle rect;
// optional fields
std::string label;
point head; // a value of (-0xFFFF,-0xFFFF) indicates the field not supplied
bool has_head() const { return head != point(-0xFFFF,-0xFFFF); }
bool has_label() const { return label.size() != 0; }
};
struct image
{
image() {}
image(const std::string& f) : filename(f) {}
std::string filename;
std::vector<box> boxes;
};
struct dataset
{
std::vector<image> images;
std::string comment;
std::string name;
};
// ------------------------------------------------------------------------------------
void save_image_dataset_metadata (
const dataset& meta,
const std::string& filename
);
// ------------------------------------------------------------------------------------
void load_image_dataset_metadata (
dataset& meta,
const std::string& filename
);
// ------------------------------------------------------------------------------------
}
}
// ----------------------------------------------------------------------------------------
#ifdef NO_MAKEFILE
#include "image_dataset_metadata.cpp"
#endif
#endif // DLIB_IMAGE_DAtASET_METADATA_H__
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment