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
2c6351be
Commit
2c6351be
authored
Jul 27, 2016
by
sutr90
Browse files
Fixes Lab tests.
parent
ebad74aa
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
19 deletions
+30
-19
dlib/test/pixel.cpp
dlib/test/pixel.cpp
+30
-19
No files found.
dlib/test/pixel.cpp
View file @
2c6351be
...
@@ -72,9 +72,9 @@ namespace
...
@@ -72,9 +72,9 @@ namespace
DLIB_TEST
(
p_hsi
.
s
==
0
);
DLIB_TEST
(
p_hsi
.
s
==
0
);
DLIB_TEST
(
p_hsi
.
i
==
0
);
DLIB_TEST
(
p_hsi
.
i
==
0
);
DLIB_TEST
(
p_lab
.
l
==
-
128
);
DLIB_TEST
(
p_lab
.
l
==
0
);
DLIB_TEST
(
p_lab
.
a
==
0
);
DLIB_TEST
(
p_lab
.
a
==
128
);
DLIB_TEST
(
p_lab
.
b
==
0
);
DLIB_TEST
(
p_lab
.
b
==
128
);
assign_pixel
(
p_gray
,
10
);
assign_pixel
(
p_gray
,
10
);
assign_pixel
(
p_gray16
,
10
);
assign_pixel
(
p_gray16
,
10
);
...
@@ -108,8 +108,8 @@ namespace
...
@@ -108,8 +108,8 @@ namespace
DLIB_TEST
(
p_hsi
.
i
==
10
);
DLIB_TEST
(
p_hsi
.
i
==
10
);
DLIB_TEST
(
p_lab
.
l
==
10
);
DLIB_TEST
(
p_lab
.
l
==
10
);
DLIB_TEST
(
p_lab
.
a
==
0
);
DLIB_TEST
(
p_lab
.
a
==
128
);
DLIB_TEST
(
p_lab
.
b
==
0
);
DLIB_TEST
(
p_lab
.
b
==
128
);
assign_pixel
(
p_gray16
,
12345
);
assign_pixel
(
p_gray16
,
12345
);
DLIB_TEST
(
p_gray16
==
12345
);
DLIB_TEST
(
p_gray16
==
12345
);
...
@@ -169,8 +169,8 @@ namespace
...
@@ -169,8 +169,8 @@ namespace
DLIB_TEST
(
p_rgb
.
red
==
0
);
DLIB_TEST
(
p_rgb
.
red
==
0
);
DLIB_TEST
(
p_rgb
.
green
==
0
);
DLIB_TEST
(
p_rgb
.
green
==
0
);
DLIB_TEST
(
p_rgb
.
blue
==
0
);
DLIB_TEST
(
p_rgb
.
blue
==
0
);
assign_pixel
(
p_rgb
,
p_lab
);
assign_pixel
(
p_rgb
,
p_lab
);
DLIB_TEST_MSG
(
p_rgb
.
red
>
251
,(
int
)
p_rgb
.
green
);
DLIB_TEST_MSG
(
p_rgb
.
red
>
251
,(
int
)
p_rgb
.
green
);
DLIB_TEST_MSG
(
p_rgb
.
green
>
96
&&
p_rgb
.
green
<
104
,(
int
)
p_rgb
.
green
);
DLIB_TEST_MSG
(
p_rgb
.
green
>
96
&&
p_rgb
.
green
<
104
,(
int
)
p_rgb
.
green
);
DLIB_TEST_MSG
(
p_rgb
.
blue
>
47
&&
p_rgb
.
blue
<
53
,(
int
)
p_rgb
.
green
);
DLIB_TEST_MSG
(
p_rgb
.
blue
>
47
&&
p_rgb
.
blue
<
53
,(
int
)
p_rgb
.
green
);
...
@@ -195,8 +195,8 @@ namespace
...
@@ -195,8 +195,8 @@ namespace
DLIB_TEST
(
p_lab
.
b
==
p_lab2
.
b
);
DLIB_TEST
(
p_lab
.
b
==
p_lab2
.
b
);
assign_pixel
(
p_lab
,
0
);
assign_pixel
(
p_lab
,
0
);
DLIB_TEST
(
p_lab
.
l
==
0
);
DLIB_TEST
(
p_lab
.
l
==
0
);
DLIB_TEST
(
p_lab
.
a
==
0
);
DLIB_TEST
(
p_lab
.
a
==
128
);
DLIB_TEST
(
p_lab
.
b
==
0
);
DLIB_TEST
(
p_lab
.
b
==
128
);
assign_pixel
(
p_lab
,
p_rgba
);
assign_pixel
(
p_lab
,
p_rgba
);
DLIB_TEST
(
p_lab
.
l
==
p_lab2
.
l
);
DLIB_TEST
(
p_lab
.
l
==
p_lab2
.
l
);
...
@@ -232,13 +232,27 @@ namespace
...
@@ -232,13 +232,27 @@ namespace
DLIB_TEST
(
p_hsi
.
s
==
0
);
DLIB_TEST
(
p_hsi
.
s
==
0
);
DLIB_TEST_MSG
(
p_hsi
.
i
<
p_hsi2
.
i
+
2
&&
p_hsi
.
i
>
p_hsi2
.
i
-
2
,(
int
)
p_hsi
.
i
<<
" "
<<
(
int
)
p_hsi2
.
i
);
DLIB_TEST_MSG
(
p_hsi
.
i
<
p_hsi2
.
i
+
2
&&
p_hsi
.
i
>
p_hsi2
.
i
-
2
,(
int
)
p_hsi
.
i
<<
" "
<<
(
int
)
p_hsi2
.
i
);
assign_pixel
(
p_lab
,
3
);
// this value corresponds to RGB(10,10,10)
p_lab
.
l
=
7
;
p_lab
.
a
=
128
;
p_lab
.
b
=
128
;
assign_pixel
(
p_lab
,
p_rgba
);
assign_pixel
(
p_lab
,
p_rgba
);
assign_pixel
(
p_lab2
,
p_rgb
);
assign_pixel
(
p_lab2
,
p_rgb
);
DLIB_TEST
(
p_lab
.
a
==
0
);
DLIB_TEST
(
p_lab
.
a
==
128
);
DLIB_TEST
(
p_lab
.
b
==
0
);
DLIB_TEST
(
p_lab
.
b
==
128
);
DLIB_TEST_MSG
(
p_lab
.
l
<
p_lab2
.
l
+
2
&&
p_lab
.
l
>
p_lab2
.
l
-
2
,(
int
)
p_lab
.
l
<<
" "
<<
(
int
)
p_lab2
.
l
);
DLIB_TEST_MSG
(
p_lab
.
l
<
p_lab2
.
l
+
2
&&
p_lab
.
l
>
p_lab2
.
l
-
2
,(
int
)
p_lab
.
l
<<
" "
<<
(
int
)
p_lab2
.
l
);
assign_pixel
(
p_lab
,
128
);
DLIB_TEST
(
p_lab
.
l
==
128
);
DLIB_TEST
(
p_lab
.
a
==
128
);
DLIB_TEST
(
p_lab
.
b
==
128
);
assign_pixel
(
p_rgb
,
p_lab
);
//Lab midpoint (50,0,0) is not same as RGB midpoint (127,127,127)
DLIB_TEST
(
p_rgb
.
red
==
119
);
DLIB_TEST
(
p_rgb
.
green
==
119
);
DLIB_TEST
(
p_rgb
.
blue
==
119
);
assign_pixel
(
p_rgba
,
100
);
assign_pixel
(
p_rgba
,
100
);
assign_pixel
(
p_gray
,
10
);
assign_pixel
(
p_gray
,
10
);
assign_pixel
(
p_schar
,
10
);
assign_pixel
(
p_schar
,
10
);
...
@@ -300,7 +314,7 @@ namespace
...
@@ -300,7 +314,7 @@ namespace
p_hsi
.
i
=
11
;
p_hsi
.
i
=
11
;
p_lab
.
l
=
10
;
p_lab
.
l
=
10
;
p_lab
.
a
=
-
9
;
p_lab
.
a
=
9
;
p_lab
.
b
=
8
;
p_lab
.
b
=
8
;
ostringstream
sout
;
ostringstream
sout
;
...
@@ -352,7 +366,7 @@ namespace
...
@@ -352,7 +366,7 @@ namespace
DLIB_TEST
(
p_hsi
.
i
==
11
);
DLIB_TEST
(
p_hsi
.
i
==
11
);
DLIB_TEST
(
p_lab
.
l
==
10
);
DLIB_TEST
(
p_lab
.
l
==
10
);
DLIB_TEST
(
p_lab
.
a
==
-
9
);
DLIB_TEST
(
p_lab
.
a
==
9
);
DLIB_TEST
(
p_lab
.
b
==
8
);
DLIB_TEST
(
p_lab
.
b
==
8
);
{
{
...
@@ -402,7 +416,7 @@ namespace
...
@@ -402,7 +416,7 @@ namespace
DLIB_TEST
(
p_hsi
.
i
==
11
);
DLIB_TEST
(
p_hsi
.
i
==
11
);
DLIB_TEST
(
p_lab
.
l
==
10
);
DLIB_TEST
(
p_lab
.
l
==
10
);
DLIB_TEST
(
p_lab
.
a
==
-
9
);
DLIB_TEST
(
p_lab
.
a
==
9
);
DLIB_TEST
(
p_lab
.
b
==
8
);
DLIB_TEST
(
p_lab
.
b
==
8
);
assign_pixel
(
p_gray
,
0
);
assign_pixel
(
p_gray
,
0
);
...
@@ -431,7 +445,7 @@ namespace
...
@@ -431,7 +445,7 @@ namespace
DLIB_TEST
(
p_hsi
.
i
==
11
);
DLIB_TEST
(
p_hsi
.
i
==
11
);
DLIB_TEST
(
p_lab
.
l
==
10
);
DLIB_TEST
(
p_lab
.
l
==
10
);
DLIB_TEST
(
p_lab
.
a
==
-
9
);
DLIB_TEST
(
p_lab
.
a
==
9
);
DLIB_TEST
(
p_lab
.
b
==
8
);
DLIB_TEST
(
p_lab
.
b
==
8
);
}
}
...
@@ -447,7 +461,7 @@ namespace
...
@@ -447,7 +461,7 @@ namespace
rgb_pixel
p_rgb
;
rgb_pixel
p_rgb
;
hsi_pixel
p_hsi
,
p_hsi2
;
hsi_pixel
p_hsi
,
p_hsi2
;
rgb_alpha_pixel
p_rgba
;
rgb_alpha_pixel
p_rgba
;
lab_pixel
p_lab
,
p_lab2
;
lab_pixel
p_lab
;
assign_pixel
(
p_gray
,
0
);
assign_pixel
(
p_gray
,
0
);
...
@@ -619,6 +633,3 @@ namespace
...
@@ -619,6 +633,3 @@ namespace
}
a
;
}
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