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
64e437a3
Commit
64e437a3
authored
Aug 05, 2016
by
sutr90
Browse files
Added test for RGB to Lab to RGB conversion.
parent
fa865c21
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
78 additions
and
4 deletions
+78
-4
dlib/test/pixel.cpp
dlib/test/pixel.cpp
+78
-4
No files found.
dlib/test/pixel.cpp
View file @
64e437a3
...
...
@@ -36,7 +36,7 @@ namespace
long
p_int
;
float
p_float
;
signed
char
p_schar
;
rgb_pixel
p_rgb
;
rgb_pixel
p_rgb
,
p_rgb2
;
hsi_pixel
p_hsi
,
p_hsi2
;
rgb_alpha_pixel
p_rgba
;
lab_pixel
p_lab
,
p_lab2
;
...
...
@@ -255,9 +255,9 @@ namespace
//Lab limit values test
//red, green, blue, yellow, black, white
p_lab
.
l
=
0
;
p_lab
.
a
=
0
;
p_lab
.
b
=
0
;
p_lab
.
l
=
84
;
p_lab
.
a
=
164
;
p_lab
.
b
=
56
;
assign_pixel
(
p_rgb
,
p_lab
);
DLIB_TEST
(
p_rgb
.
red
==
0
);
DLIB_TEST
(
p_rgb
.
green
==
64
);
...
...
@@ -321,6 +321,80 @@ namespace
DLIB_TEST
(
p_rgb
.
green
==
70
);
DLIB_TEST
(
p_rgb
.
blue
==
0
);
//RGB limit tests
p_rgb
.
red
=
0
;
p_rgb
.
green
=
0
;
p_rgb
.
blue
=
0
;
assign_pixel
(
p_lab
,
p_rgb
);
assign_pixel
(
p_rgb2
,
p_lab
);
DLIB_TEST
(
p_rgb2
.
red
<
3
);
DLIB_TEST
(
p_rgb2
.
green
<
3
);
DLIB_TEST
(
p_rgb2
.
blue
<
3
);
p_rgb
.
red
=
255
;
p_rgb
.
green
=
0
;
p_rgb
.
blue
=
0
;
assign_pixel
(
p_lab
,
p_rgb
);
assign_pixel
(
p_rgb2
,
p_lab
);
DLIB_TEST
(
p_rgb2
.
red
>
252
);
DLIB_TEST
(
p_rgb2
.
green
<
3
);
DLIB_TEST
(
p_rgb2
.
blue
<
3
);
p_rgb
.
red
=
0
;
p_rgb
.
green
=
255
;
p_rgb
.
blue
=
0
;
assign_pixel
(
p_lab
,
p_rgb
);
assign_pixel
(
p_rgb2
,
p_lab
);
DLIB_TEST
(
p_rgb2
.
red
<
8
);
DLIB_TEST
(
p_rgb2
.
green
>
252
);
DLIB_TEST
(
p_rgb2
.
blue
<
5
);
p_rgb
.
red
=
0
;
p_rgb
.
green
=
0
;
p_rgb
.
blue
=
255
;
assign_pixel
(
p_lab
,
p_rgb
);
assign_pixel
(
p_rgb2
,
p_lab
);
DLIB_TEST
(
p_rgb2
.
red
<
3
);
DLIB_TEST
(
p_rgb2
.
green
<
3
);
DLIB_TEST
(
p_rgb2
.
blue
>
252
);
p_rgb
.
red
=
255
;
p_rgb
.
green
=
255
;
p_rgb
.
blue
=
0
;
assign_pixel
(
p_lab
,
p_rgb
);
assign_pixel
(
p_rgb2
,
p_lab
);
DLIB_TEST
(
p_rgb2
.
red
>
252
);
DLIB_TEST
(
p_rgb2
.
green
>
252
);
DLIB_TEST
(
p_rgb2
.
blue
<
9
);
p_rgb
.
red
=
0
;
p_rgb
.
green
=
255
;
p_rgb
.
blue
=
255
;
assign_pixel
(
p_lab
,
p_rgb
);
assign_pixel
(
p_rgb2
,
p_lab
);
DLIB_TEST
(
p_rgb2
.
red
<
5
);
DLIB_TEST
(
p_rgb2
.
green
>
252
);
DLIB_TEST
(
p_rgb2
.
blue
>
252
);
p_rgb
.
red
=
255
;
p_rgb
.
green
=
0
;
p_rgb
.
blue
=
255
;
assign_pixel
(
p_lab
,
p_rgb
);
assign_pixel
(
p_rgb2
,
p_lab
);
DLIB_TEST
(
p_rgb2
.
red
>
252
);
DLIB_TEST
(
p_rgb2
.
green
<
6
);
DLIB_TEST
(
p_rgb2
.
blue
>
252
);
p_rgb
.
red
=
255
;
p_rgb
.
green
=
255
;
p_rgb
.
blue
=
255
;
assign_pixel
(
p_lab
,
p_rgb
);
assign_pixel
(
p_rgb2
,
p_lab
);
DLIB_TEST
(
p_rgb2
.
red
>
252
);
DLIB_TEST
(
p_rgb2
.
green
>
252
);
DLIB_TEST
(
p_rgb2
.
blue
>
252
);
assign_pixel
(
p_rgba
,
100
);
assign_pixel
(
p_gray
,
10
);
assign_pixel
(
p_schar
,
10
);
...
...
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