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
c0d0adba
Commit
c0d0adba
authored
Dec 10, 2014
by
Patrick Snape
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a list of points
Also, change point x and y to be properties
parent
85f0c0ff
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
3 deletions
+16
-3
vector.cpp
tools/python/src/vector.cpp
+16
-3
No files found.
tools/python/src/vector.cpp
View file @
c0d0adba
...
...
@@ -3,6 +3,7 @@
#include <dlib/python.h>
#include <boost/shared_ptr.hpp>
#include <boost/python/suite/indexing/vector_indexing_suite.hpp>
#include <dlib/matrix.h>
#include <boost/python/slice.hpp>
#include <dlib/geometry/vector.h>
...
...
@@ -14,6 +15,9 @@ using namespace boost::python;
typedef
matrix
<
double
,
0
,
1
>
cv
;
template
<
typename
T
>
void
resize
(
T
&
v
,
unsigned
long
n
)
{
v
.
resize
(
n
);
}
void
cv_set_size
(
cv
&
m
,
long
s
)
{
m
.
set_size
(
s
);
...
...
@@ -170,6 +174,8 @@ void bind_vector()
.
def
(
"__setitem__"
,
&
cv__setitem__
)
.
add_property
(
"shape"
,
&
cv_get_matrix_size
)
.
def_pickle
(
serialize_pickle
<
cv
>
());
def
(
"dot"
,
dotprod
,
"Compute the dot product between two dense column vectors."
);
}
{
typedef
point
type
;
...
...
@@ -177,9 +183,16 @@ void bind_vector()
.
def
(
init
<
long
,
long
>
((
arg
(
"x"
),
arg
(
"y"
))))
.
def
(
"__repr__"
,
&
point__repr__
)
.
def
(
"__str__"
,
&
point__str__
)
.
def
(
"x"
,
&
point_x
)
.
def
(
"y"
,
&
point_y
)
.
add_property
(
"x"
,
&
point_x
,
"The x-coordinate of the point."
)
.
add_property
(
"y"
,
&
point_y
,
"The y-coordinate of the point."
)
.
def_pickle
(
serialize_pickle
<
type
>
());
}
def
(
"dot"
,
dotprod
,
"Compute the dot product between two dense column vectors."
);
{
typedef
std
::
vector
<
point
>
type
;
class_
<
type
>
(
"points"
,
"An array of point objects."
)
.
def
(
vector_indexing_suite
<
type
>
())
.
def
(
"clear"
,
&
type
::
clear
)
.
def
(
"resize"
,
resize
<
type
>
)
.
def_pickle
(
serialize_pickle
<
type
>
());
}
}
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