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
2d086b45
Commit
2d086b45
authored
Jul 16, 2012
by
Davis King
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added sum_filter_assign().
parent
ca13ff7c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
61 additions
and
1 deletion
+61
-1
spatial_filtering.h
dlib/image_transforms/spatial_filtering.h
+34
-1
spatial_filtering_abstract.h
dlib/image_transforms/spatial_filtering_abstract.h
+27
-0
No files found.
dlib/image_transforms/spatial_filtering.h
View file @
2d086b45
...
...
@@ -621,7 +621,10 @@ namespace dlib
// ----------------------------------------------------------------------------------------
namespace
impl
{
template
<
bool
add_to
,
typename
image_type1
,
typename
image_type2
>
...
...
@@ -710,10 +713,40 @@ namespace dlib
// add in the new right side of the rect and subtract the old right side.
cur_sum
=
cur_sum
+
column_sum
[
c
+
width
]
-
column_sum
[
c
];
out
[
r
][
c
]
+=
static_cast
<
typename
image_type2
::
type
>
(
cur_sum
);
if
(
add_to
)
out
[
r
][
c
]
+=
static_cast
<
typename
image_type2
::
type
>
(
cur_sum
);
else
out
[
r
][
c
]
=
static_cast
<
typename
image_type2
::
type
>
(
cur_sum
);
}
}
}
}
template
<
typename
image_type1
,
typename
image_type2
>
void
sum_filter
(
const
image_type1
&
img
,
image_type2
&
out
,
const
rectangle
&
rect
)
{
impl
::
sum_filter
<
true
>
(
img
,
out
,
rect
);
}
template
<
typename
image_type1
,
typename
image_type2
>
void
sum_filter_assign
(
const
image_type1
&
img
,
image_type2
&
out
,
const
rectangle
&
rect
)
{
impl
::
sum_filter
<
false
>
(
img
,
out
,
rect
);
}
// ----------------------------------------------------------------------------------------
...
...
dlib/image_transforms/spatial_filtering_abstract.h
View file @
2d086b45
...
...
@@ -338,6 +338,33 @@ namespace dlib
- #out[r][c] == out[r][c] + SUM(r,c)
!*/
// ----------------------------------------------------------------------------------------
template
<
typename
image_type1
,
typename
image_type2
>
void
sum_filter_assign
(
const
image_type1
&
img
,
image_type2
&
out
,
const
rectangle
&
rect
);
/*!
requires
- out.nr() == img.nr()
- out.nc() == img.nc()
- image_type1 == an implementation of array2d/array2d_kernel_abstract.h
and it must contain a scalar type
- image_type2 == an implementation of array2d/array2d_kernel_abstract.h
and it must contain a scalar type
- is_same_object(img,out) == false
ensures
- for all valid r and c:
- let SUM(r,c) == sum of pixels from img which are inside the rectangle
translate_rect(rect, point(c,r)).
- #out[r][c] == SUM(r,c)
!*/
// ----------------------------------------------------------------------------------------
template
<
...
...
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