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
1f0cb544
Commit
1f0cb544
authored
Jun 11, 2018
by
Davis King
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added max_point() and max_point_interpolated() to the Python API.
parent
f8419124
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
68 additions
and
0 deletions
+68
-0
image2.cpp
tools/python/src/image2.cpp
+68
-0
No files found.
tools/python/src/image2.cpp
View file @
1f0cb544
...
...
@@ -983,6 +983,23 @@ py::array py_sub_image2 (
return
py_sub_image
(
image_and_rect_tuple
[
0
].
cast
<
py
::
array
>
(),
image_and_rect_tuple
[
1
].
cast
<
rectangle
>
());
}
// ----------------------------------------------------------------------------------------
template
<
typename
T
>
dpoint
py_max_point
(
const
numpy_image
<
T
>&
img
)
{
DLIB_CASSERT
(
img
.
size
()
!=
0
);
return
max_point
(
mat
(
img
));
}
template
<
typename
T
>
dpoint
py_max_point_interpolated
(
const
numpy_image
<
T
>&
img
)
{
DLIB_CASSERT
(
img
.
size
()
!=
0
);
return
max_point_interpolated
(
mat
(
img
));
}
// ----------------------------------------------------------------------------------------
void
bind_image_classes2
(
py
::
module
&
m
)
...
...
@@ -1282,6 +1299,57 @@ ensures \n\
!*/
);
m
.
def
(
"max_point"
,
&
py_max_point
<
uint8_t
>
,
py
::
arg
(
"img"
));
m
.
def
(
"max_point"
,
&
py_max_point
<
uint16_t
>
,
py
::
arg
(
"img"
));
m
.
def
(
"max_point"
,
&
py_max_point
<
uint32_t
>
,
py
::
arg
(
"img"
));
m
.
def
(
"max_point"
,
&
py_max_point
<
uint64_t
>
,
py
::
arg
(
"img"
));
m
.
def
(
"max_point"
,
&
py_max_point
<
int8_t
>
,
py
::
arg
(
"img"
));
m
.
def
(
"max_point"
,
&
py_max_point
<
int16_t
>
,
py
::
arg
(
"img"
));
m
.
def
(
"max_point"
,
&
py_max_point
<
int32_t
>
,
py
::
arg
(
"img"
));
m
.
def
(
"max_point"
,
&
py_max_point
<
int64_t
>
,
py
::
arg
(
"img"
));
m
.
def
(
"max_point"
,
&
py_max_point
<
float
>
,
py
::
arg
(
"img"
));
m
.
def
(
"max_point"
,
&
py_max_point
<
double
>
,
py
::
arg
(
"img"
),
"requires
\n
\
- m.size > 0
\n
\
ensures
\n
\
- returns the location of the maximum element of the array, that is, if the
\n
\
returned point is P then it will be the case that: img[P.y,P.x] == img.max()."
/*!
requires
- m.size > 0
ensures
- returns the location of the maximum element of the array, that is, if the
returned point is P then it will be the case that: img[P.y,P.x] == img.max().
!*/
);
m
.
def
(
"max_point_interpolated"
,
&
py_max_point_interpolated
<
uint8_t
>
,
py
::
arg
(
"img"
));
m
.
def
(
"max_point_interpolated"
,
&
py_max_point_interpolated
<
uint16_t
>
,
py
::
arg
(
"img"
));
m
.
def
(
"max_point_interpolated"
,
&
py_max_point_interpolated
<
uint32_t
>
,
py
::
arg
(
"img"
));
m
.
def
(
"max_point_interpolated"
,
&
py_max_point_interpolated
<
uint64_t
>
,
py
::
arg
(
"img"
));
m
.
def
(
"max_point_interpolated"
,
&
py_max_point_interpolated
<
int8_t
>
,
py
::
arg
(
"img"
));
m
.
def
(
"max_point_interpolated"
,
&
py_max_point_interpolated
<
int16_t
>
,
py
::
arg
(
"img"
));
m
.
def
(
"max_point_interpolated"
,
&
py_max_point_interpolated
<
int32_t
>
,
py
::
arg
(
"img"
));
m
.
def
(
"max_point_interpolated"
,
&
py_max_point_interpolated
<
int64_t
>
,
py
::
arg
(
"img"
));
m
.
def
(
"max_point_interpolated"
,
&
py_max_point_interpolated
<
float
>
,
py
::
arg
(
"img"
));
m
.
def
(
"max_point_interpolated"
,
&
py_max_point_interpolated
<
double
>
,
py
::
arg
(
"img"
),
"requires
\n
\
- m.size > 0
\n
\
ensures
\n
\
- Like max_point(), this function finds the location in m with the largest
\n
\
value. However, we additionally use some quadratic interpolation to find the
\n
\
location of the maximum point with sub-pixel accuracy. Therefore, the
\n
\
returned point is equal to max_point(m) + some small sub-pixel delta."
/*!
requires
- m.size > 0
ensures
- Like max_point(), this function finds the location in m with the largest
value. However, we additionally use some quadratic interpolation to find the
location of the maximum point with sub-pixel accuracy. Therefore, the
returned point is equal to max_point(m) + some small sub-pixel delta.
!*/
);
}
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