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
12dfdde3
Commit
12dfdde3
authored
Feb 28, 2013
by
Davis King
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added unit tests for segment_image()
parent
932ddb40
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
47 additions
and
0 deletions
+47
-0
image.cpp
dlib/test/image.cpp
+47
-0
No files found.
dlib/test/image.cpp
View file @
12dfdde3
...
...
@@ -1293,6 +1293,46 @@ namespace
// ----------------------------------------------------------------------------------------
template
<
typename
T
>
void
test_segment_image
()
{
print_spinner
();
array2d
<
T
>
img
(
100
,
100
);
for
(
long
r
=
0
;
r
<
img
.
nr
();
++
r
)
{
for
(
long
c
=
0
;
c
<
img
.
nc
();
++
c
)
{
if
(
c
<
50
||
r
<
50
)
assign_pixel
(
img
[
r
][
c
],
0
);
else
assign_pixel
(
img
[
r
][
c
],
255
);
}
}
array2d
<
unsigned
long
>
out
;
segment_image
(
img
,
out
);
DLIB_TEST
(
get_rect
(
img
)
==
get_rect
(
out
));
const
unsigned
long
v1
=
out
[
0
][
0
];
const
unsigned
long
v2
=
out
[
90
][
90
];
for
(
long
r
=
0
;
r
<
img
.
nr
();
++
r
)
{
for
(
long
c
=
0
;
c
<
img
.
nc
();
++
c
)
{
if
(
c
<
50
||
r
<
50
)
{
DLIB_TEST
(
out
[
r
][
c
]
==
v1
);
}
else
{
DLIB_TEST
(
out
[
r
][
c
]
==
v2
);
}
}
}
}
// ----------------------------------------------------------------------------------------
class
image_tester
:
public
tester
{
...
...
@@ -1326,6 +1366,13 @@ namespace
test_label_connected_blobs
();
test_label_connected_blobs2
();
test_downsampled_filtering
();
test_segment_image
<
unsigned
char
>
();
test_segment_image
<
unsigned
short
>
();
test_segment_image
<
double
>
();
test_segment_image
<
int
>
();
test_segment_image
<
rgb_pixel
>
();
test_segment_image
<
rgb_alpha_pixel
>
();
}
}
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