Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
D
dlib
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
钟尚武
dlib
Commits
ae406bf4
Commit
ae406bf4
authored
Mar 19, 2019
by
Davis King
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make dlib.full_object_detection take list of dlib.point or dlib.points.
parent
b4e7e2e7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
7 deletions
+18
-7
shape_predictor.cpp
tools/python/src/shape_predictor.cpp
+18
-7
No files found.
tools/python/src/shape_predictor.cpp
View file @
ae406bf4
...
...
@@ -68,14 +68,25 @@ std::vector<point> full_obj_det_parts (const full_object_detection& detection)
return
parts
;
}
std
::
shared_ptr
<
full_object_detection
>
full_obj_det_init
(
const
rectangle
&
rect
,
py
::
list
&
pyparts
)
std
::
shared_ptr
<
full_object_detection
>
full_obj_det_init
(
const
rectangle
&
rect
,
const
py
::
object
&
pyparts_
)
{
const
unsigned
long
num_parts
=
py
::
len
(
pyparts
);
std
::
vector
<
point
>
parts
;
for
(
const
auto
&
item
:
pyparts
)
parts
.
push_back
(
item
.
cast
<
point
>
());
try
{
auto
&&
pyparts
=
pyparts_
.
cast
<
py
::
list
>
();
const
unsigned
long
num_parts
=
py
::
len
(
pyparts
);
std
::
vector
<
point
>
parts
;
for
(
const
auto
&
item
:
pyparts
)
parts
.
push_back
(
item
.
cast
<
point
>
());
return
std
::
make_shared
<
full_object_detection
>
(
rect
,
parts
);
return
std
::
make_shared
<
full_object_detection
>
(
rect
,
parts
);
}
catch
(
py
::
cast_error
&
)
{
// if it's not a py::list it better be a vector<point>.
auto
&&
parts
=
pyparts_
.
cast
<
const
std
::
vector
<
point
>&>
();
return
std
::
make_shared
<
full_object_detection
>
(
rect
,
parts
);
}
}
// ----------------------------------------------------------------------------------------
...
...
@@ -163,7 +174,7 @@ void bind_shape_predictors(py::module &m)
.
def
(
py
::
init
(
&
full_obj_det_init
),
py
::
arg
(
"rect"
),
py
::
arg
(
"parts"
),
"requires
\n
\
- rect: dlib rectangle
\n
\
- parts: list of dlib
points
"
)
- parts: list of dlib
.point, or a dlib.points object.
"
)
.
def_property_readonly
(
"rect"
,
&
full_obj_det_get_rect
,
"Bounding box from the underlying detector. Parts can be outside box if appropriate."
)
.
def_property_readonly
(
"num_parts"
,
&
full_obj_det_num_parts
,
"The number of parts of the object."
)
.
def
(
"part"
,
&
full_obj_det_part
,
py
::
arg
(
"idx"
),
"A single part of the object as a dlib point."
)
...
...
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