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
ae406bf4
"git@developer.sourcefind.cn:OpenDAS/dlib.git" did not exist on "f761ad5885dd2a7e3efdb17ca15f918bea7938c6"
Commit
ae406bf4
authored
Mar 19, 2019
by
Davis King
Browse files
Make dlib.full_object_detection take list of dlib.point or dlib.points.
parent
b4e7e2e7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
7 deletions
+18
-7
tools/python/src/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)
...
@@ -68,14 +68,25 @@ std::vector<point> full_obj_det_parts (const full_object_detection& detection)
return
parts
;
return
parts
;
}
}
std
::
shared_ptr
<
full_object_detection
>
full_obj_det_init
(
const
rectangle
&
rect
,
py
::
lis
t
&
pyparts
)
std
::
shared_ptr
<
full_object_detection
>
full_obj_det_init
(
const
rectangle
&
rect
,
const
py
::
objec
t
&
pyparts
_
)
{
{
const
unsigned
long
num_parts
=
py
::
len
(
pyparts
);
try
std
::
vector
<
point
>
parts
;
{
for
(
const
auto
&
item
:
pyparts
)
auto
&&
pyparts
=
pyparts_
.
cast
<
py
::
list
>
();
parts
.
push_back
(
item
.
cast
<
point
>
());
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)
...
@@ -163,7 +174,7 @@ void bind_shape_predictors(py::module &m)
.
def
(
py
::
init
(
&
full_obj_det_init
),
py
::
arg
(
"rect"
),
py
::
arg
(
"parts"
),
.
def
(
py
::
init
(
&
full_obj_det_init
),
py
::
arg
(
"rect"
),
py
::
arg
(
"parts"
),
"requires
\n
\
"requires
\n
\
- rect: dlib rectangle
\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
(
"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_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."
)
.
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