Commit 67ac182f authored by Davis King's avatar Davis King

Added serialization support to the full_object_detection.

parent 62239be0
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#include "../geometry.h" #include "../geometry.h"
#include "full_object_detection_abstract.h" #include "full_object_detection_abstract.h"
#include <vector> #include <vector>
#include "../serialize.h"
namespace dlib namespace dlib
{ {
...@@ -49,6 +50,31 @@ namespace dlib ...@@ -49,6 +50,31 @@ namespace dlib
return parts[idx]; return parts[idx];
} }
friend void serialize (
const full_object_detection& item,
std::ostream& out
)
{
int version = 1;
serialize(version, out);
serialize(item.rect, out);
serialize(item.parts, out);
}
friend void deserialize (
full_object_detection& item,
std::istream& in
)
{
int version = 0;
deserialize(version, in);
if (version != 1)
throw serialization_error("Unexpected version encountered while deserializing dlib::full_object_detection.");
deserialize(item.rect, in);
deserialize(item.parts, in);
}
private: private:
rectangle rect; rectangle rect;
std::vector<point> parts; std::vector<point> parts;
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#include <vector> #include <vector>
#include "../geometry.h" #include "../geometry.h"
#include "../serialize.h"
namespace dlib namespace dlib
{ {
...@@ -84,6 +85,24 @@ namespace dlib ...@@ -84,6 +85,24 @@ namespace dlib
!*/ !*/
}; };
// ----------------------------------------------------------------------------------------
void serialize (
const full_object_detection& item,
std::ostream& out
);
/*!
provides serialization support
!*/
void deserialize (
full_object_detection& item,
std::istream& in
);
/*!
provides deserialization support
!*/
// ---------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------
bool all_parts_in_rect ( bool all_parts_in_rect (
......
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