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

This commit is contained in:
Davis King 2014-09-02 20:14:22 -04:00
parent 1ff7cd1ad7
commit 7b2839a9d9
2 changed files with 37 additions and 0 deletions

View File

@ -33,6 +33,7 @@ namespace dlib
) : rect(rect_) {}
const rectangle& get_rect() const { return rect; }
rectangle& get_rect() { return rect; }
unsigned long num_parts() const { return parts.size(); }
const point& part(
@ -50,6 +51,21 @@ namespace dlib
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 (
const full_object_detection& item,
std::ostream& out

View File

@ -64,6 +64,14 @@ namespace dlib
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(
) const;
/*!
@ -83,6 +91,19 @@ namespace dlib
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.
!*/
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.
!*/
};
// ----------------------------------------------------------------------------------------