Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
dlib
Commits
5a2e0d6a
Commit
5a2e0d6a
authored
May 15, 2018
by
Davis King
Browse files
Added centered_rects()
parent
b3178059
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
0 deletions
+29
-0
dlib/geometry/rectangle.h
dlib/geometry/rectangle.h
+15
-0
dlib/geometry/rectangle_abstract.h
dlib/geometry/rectangle_abstract.h
+14
-0
No files found.
dlib/geometry/rectangle.h
View file @
5a2e0d6a
...
@@ -571,6 +571,21 @@ namespace dlib
...
@@ -571,6 +571,21 @@ namespace dlib
return
centered_rect
(
p
.
x
(),
p
.
y
(),
width
,
height
);
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
(
inline
const
rectangle
centered_rect
(
...
...
dlib/geometry/rectangle_abstract.h
View file @
5a2e0d6a
...
@@ -452,6 +452,20 @@ namespace dlib
...
@@ -452,6 +452,20 @@ namespace dlib
- R.tl_corner() == point(p.x()-width/2, p.y()-height/2)
- 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
(
const
rectangle
centered_rect
(
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment