Added centered_rects()

This commit is contained in:
Davis King 2018-05-15 21:40:13 -04:00
parent b31780590c
commit 5a2e0d6a4d
2 changed files with 29 additions and 0 deletions

View File

@ -571,6 +571,21 @@ namespace dlib
return centered_rect(p.x(),p.y(),width,height);
}
// ----------------------------------------------------------------------------------------
inline std::vector<rectangle> centered_rects (
const std::vector<point>& pts,
unsigned long width,
unsigned long height
)
{
std::vector<rectangle> tmp;
tmp.reserve(pts.size());
for (auto& p : pts)
tmp.emplace_back(centered_rect(p, width, height));
return tmp;
}
// ----------------------------------------------------------------------------------------
inline const rectangle centered_rect (

View File

@ -452,6 +452,20 @@ namespace dlib
- R.tl_corner() == point(p.x()-width/2, p.y()-height/2)
!*/
// ----------------------------------------------------------------------------------------
inline std::vector<rectangle> centered_rects (
const std::vector<point>& pts,
unsigned long width,
unsigned long height
);
/*!
ensures
- returns an array ARR where:
- #ARR.size() == pts.size()
- #ARR[i] == centered_rect(pts[i], width, height)
!*/
// ----------------------------------------------------------------------------------------
const rectangle centered_rect (