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
26eb8143
Commit
26eb8143
authored
Nov 10, 2013
by
Davis King
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Made spatially_filter_image_separable() a little bit faster.
parent
ae08cdc5
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
7 deletions
+30
-7
spatial_filtering.h
dlib/image_transforms/spatial_filtering.h
+27
-4
image.cpp
dlib/test/image.cpp
+3
-3
No files found.
dlib/image_transforms/spatial_filtering.h
View file @
26eb8143
...
...
@@ -589,13 +589,25 @@ namespace dlib
long
c
=
first_col
;
for
(;
c
<
last_col
-
3
;
c
+=
4
)
{
simd4f
p
,
temp
=
0
;
for
(
long
n
=
0
;
n
<
row_filter
.
size
();
++
n
)
simd4f
p
,
p2
,
p3
,
temp
=
0
,
temp2
=
0
,
temp3
=
0
;
long
n
=
0
;
for
(;
n
<
row_filter
.
size
()
-
2
;
n
+=
3
)
{
// pull out the current pixel and put it into p
p
.
load
(
&
in_img
[
r
][
c
-
first_col
+
n
]);
p2
.
load
(
&
in_img
[
r
][
c
-
first_col
+
n
+
1
]);
p3
.
load
(
&
in_img
[
r
][
c
-
first_col
+
n
+
2
]);
temp
+=
p
*
row_filter
(
n
);
temp2
+=
p2
*
row_filter
(
n
+
1
);
temp3
+=
p3
*
row_filter
(
n
+
2
);
}
for
(;
n
<
row_filter
.
size
();
++
n
)
{
// pull out the current pixel and put it into p
p
.
load
(
&
in_img
[
r
][
c
-
first_col
+
n
]);
temp
+=
p
*
row_filter
(
n
);
}
temp
+=
temp2
+
temp3
;
temp
.
store
(
&
temp_img
[
r
][
c
]);
}
for
(;
c
<
last_col
;
++
c
)
...
...
@@ -618,12 +630,23 @@ namespace dlib
long
c
=
first_col
;
for
(;
c
<
last_col
-
3
;
c
+=
4
)
{
simd4f
p
,
temp
=
0
;
for
(
long
m
=
0
;
m
<
col_filter
.
size
();
++
m
)
simd4f
p
,
p2
,
p3
,
temp
=
0
,
temp2
=
0
,
temp3
=
0
;
long
m
=
0
;
for
(;
m
<
col_filter
.
size
()
-
2
;
m
+=
3
)
{
p
.
load
(
&
temp_img
[
r
-
first_row
+
m
][
c
]);
p2
.
load
(
&
temp_img
[
r
-
first_row
+
m
+
1
][
c
]);
p3
.
load
(
&
temp_img
[
r
-
first_row
+
m
+
2
][
c
]);
temp
+=
p
*
col_filter
(
m
);
temp2
+=
p2
*
col_filter
(
m
+
1
);
temp3
+=
p3
*
col_filter
(
m
+
2
);
}
for
(;
m
<
col_filter
.
size
();
++
m
)
{
p
.
load
(
&
temp_img
[
r
-
first_row
+
m
][
c
]);
temp
+=
p
*
col_filter
(
m
);
}
temp
+=
temp2
+
temp3
;
// save this pixel to the output image
if
(
add_to
==
false
)
...
...
dlib/test/image.cpp
View file @
26eb8143
...
...
@@ -791,7 +791,7 @@ namespace
{
DLIB_TEST
(
imout
[
be
.
element
().
y
()][
be
.
element
().
x
()]
==
0
)
}
DLIB_TEST
(
max
(
abs
(
subm
(
mat
(
imout
),
rect
)
-
subm
(
out
,
rect
)))
<
1e-7
);
DLIB_TEST
_MSG
(
max
(
abs
(
subm
(
mat
(
imout
),
rect
)
-
subm
(
out
,
rect
)))
<
1e-5
,
max
(
abs
(
subm
(
mat
(
imout
),
rect
)
-
subm
(
out
,
rect
)))
);
assign_all_pixels
(
imout
,
10
);
...
...
@@ -815,7 +815,7 @@ namespace
DLIB_TEST
(
imout
[
be
.
element
().
y
()][
be
.
element
().
x
()]
==
-
10
)
}
out
+=
xcorr_same
(
mat
(
img
),
filt
)
/
2
;
DLIB_TEST
(
max
(
abs
(
subm
(
mat
(
imout
),
rect
)
-
subm
(
out
,
rect
)))
<
1e-7
);
DLIB_TEST
_MSG
(
max
(
abs
(
subm
(
mat
(
imout
),
rect
)
-
subm
(
out
,
rect
)))
<
1e-5
,
max
(
abs
(
subm
(
mat
(
imout
),
rect
)
-
subm
(
out
,
rect
)))
);
...
...
@@ -825,7 +825,7 @@ namespace
assign_all_pixels
(
imout
,
10
);
rect
=
spatially_filter_image_separable
(
img
,
imout
,
row_filt
,
col_filt
);
out
=
xcorr_same
(
tmp
(
xcorr_same
(
mat
(
img
),
trans
(
row_filt
))),
col_filt
);
DLIB_TEST
(
max
(
abs
(
subm
(
mat
(
imout
),
rect
)
-
subm
(
out
,
rect
)))
<
1e-7
);
DLIB_TEST
_MSG
(
max
(
abs
(
subm
(
mat
(
imout
),
rect
)
-
subm
(
out
,
rect
)))
<
1e-5
,
max
(
abs
(
subm
(
mat
(
imout
),
rect
)
-
subm
(
out
,
rect
)))
);
be
=
border_enumerator
(
get_rect
(
imout
),
rect
);
while
(
be
.
move_next
())
...
...
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