Commit 7b2839a9 authored by Davis King's avatar Davis King

Added methods to allow in-place modification of a full_object_detection.

parent 1ff7cd1a
...@@ -33,6 +33,7 @@ namespace dlib ...@@ -33,6 +33,7 @@ namespace dlib
) : rect(rect_) {} ) : rect(rect_) {}
const rectangle& get_rect() const { return rect; } const rectangle& get_rect() const { return rect; }
rectangle& get_rect() { return rect; }
unsigned long num_parts() const { return parts.size(); } unsigned long num_parts() const { return parts.size(); }
const point& part( const point& part(
...@@ -50,6 +51,21 @@ namespace dlib ...@@ -50,6 +51,21 @@ namespace dlib
return parts[idx]; return parts[idx];
} }
point& part(
unsigned long idx
)
{
// make sure requires clause is not broken
DLIB_ASSERT(idx < num_parts(),
"\t point full_object_detection::part()"
<< "\n\t Invalid inputs were given to this function "
<< "\n\t idx: " << idx
<< "\n\t num_parts(): " << num_parts()
<< "\n\t this: " << this
);
return parts[idx];
}
friend void serialize ( friend void serialize (
const full_object_detection& item, const full_object_detection& item,
std::ostream& out std::ostream& out
......
...@@ -64,6 +64,14 @@ namespace dlib ...@@ -64,6 +64,14 @@ namespace dlib
this should be the bounding box for the object. this should be the bounding box for the object.
!*/ !*/
rectangle& get_rect(
);
/*!
ensures
- returns the rectangle that indicates where this object is. In general,
this should be the bounding box for the object.
!*/
unsigned long num_parts( unsigned long num_parts(
) const; ) const;
/*! /*!
...@@ -83,6 +91,19 @@ namespace dlib ...@@ -83,6 +91,19 @@ namespace dlib
when the return value of part() is equal to OBJECT_PART_NOT_PRESENT. when the return value of part() is equal to OBJECT_PART_NOT_PRESENT.
This is useful for modeling object parts that are not always observed. This is useful for modeling object parts that are not always observed.
!*/ !*/
point& part(
unsigned long idx
);
/*!
requires
- idx < num_parts()
ensures
- returns the location of the center of the idx-th part of this object.
Note that it is valid for a part to be "not present". This is indicated
when the return value of part() is equal to OBJECT_PART_NOT_PRESENT.
This is useful for modeling object parts that are not always observed.
!*/
}; };
// ---------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------
......
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