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
de23eed3
Commit
de23eed3
authored
Nov 05, 2013
by
Davis King
Browse files
Added more filtering unit tests
parent
3fa470e8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
0 deletions
+44
-0
dlib/test/image.cpp
dlib/test/image.cpp
+44
-0
No files found.
dlib/test/image.cpp
View file @
de23eed3
...
...
@@ -1091,6 +1091,48 @@ namespace
}
}
void
test_small_filter
()
{
array2d
<
int
>
img
(
3
,
3
),
out
;
assign_all_pixels
(
img
,
1
);
matrix
<
int
>
filt
(
2
,
2
);
filt
=
1
;
spatially_filter_image
(
img
,
out
,
filt
);
DLIB_TEST
(
out
[
0
][
0
]
==
4
);
DLIB_TEST
(
out
[
0
][
1
]
==
4
);
DLIB_TEST
(
out
[
0
][
2
]
==
0
);
DLIB_TEST
(
out
[
1
][
0
]
==
4
);
DLIB_TEST
(
out
[
1
][
1
]
==
4
);
DLIB_TEST
(
out
[
1
][
2
]
==
0
);
DLIB_TEST
(
out
[
2
][
0
]
==
0
);
DLIB_TEST
(
out
[
2
][
1
]
==
0
);
DLIB_TEST
(
out
[
2
][
2
]
==
0
);
matrix
<
int
>
rfilt
(
2
,
1
),
cfilt
(
2
,
1
);
rfilt
=
1
;
cfilt
=
1
;
assign_all_pixels
(
out
,
9
);
spatially_filter_image_separable
(
img
,
out
,
rfilt
,
cfilt
);
DLIB_TEST
(
out
[
0
][
0
]
==
4
);
DLIB_TEST
(
out
[
0
][
1
]
==
4
);
DLIB_TEST
(
out
[
0
][
2
]
==
0
);
DLIB_TEST
(
out
[
1
][
0
]
==
4
);
DLIB_TEST
(
out
[
1
][
1
]
==
4
);
DLIB_TEST
(
out
[
1
][
2
]
==
0
);
DLIB_TEST
(
out
[
2
][
0
]
==
0
);
DLIB_TEST
(
out
[
2
][
1
]
==
0
);
DLIB_TEST
(
out
[
2
][
2
]
==
0
);
}
void
test_zero_border_pixels
(
)
{
...
...
@@ -1586,6 +1628,7 @@ namespace
void
perform_test
(
)
{
test_small_filter
();
image_test
();
test_integral_image
<
long
,
unsigned
char
>
();
test_integral_image
<
double
,
int
>
();
...
...
@@ -1634,6 +1677,7 @@ namespace
test_filtering2
(
7
,
7
,
rnd
);
test_filtering2
(
7
,
5
,
rnd
);
}
}
}
a
;
...
...
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