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
2a224bf0
Commit
2a224bf0
authored
Feb 21, 2015
by
Davis King
Browse files
Made the point up/down mapping for pyramid_down<2> and pyramid_down<3> a little
bit more accurate.
parent
afed9767
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
13 deletions
+6
-13
dlib/image_transforms/image_pyramid.h
dlib/image_transforms/image_pyramid.h
+4
-6
dlib/test/pyramid_down.cpp
dlib/test/pyramid_down.cpp
+2
-7
No files found.
dlib/image_transforms/image_pyramid.h
View file @
2a224bf0
...
...
@@ -156,8 +156,7 @@ namespace dlib
const
vector
<
T
,
2
>&
p
)
const
{
//do return (p - vector<T,2>(2,2))/2.0;
return
p
/
2.0
-
vector
<
double
,
2
>
(
1
,
1
);
return
p
/
2.0
-
vector
<
double
,
2
>
(
1.25
,
0.75
);
}
template
<
typename
T
>
...
...
@@ -165,7 +164,7 @@ namespace dlib
const
vector
<
T
,
2
>&
p
)
const
{
return
p
*
2
+
vector
<
T
,
2
>
(
2
,
2
)
;
return
(
p
+
vector
<
T
,
2
>
(
1.25
,
0.75
))
*
2
;
}
// -----------------------------
...
...
@@ -497,8 +496,7 @@ namespace dlib
)
const
{
const
double
ratio
=
2.0
/
3.0
;
//do return (p - vector<T,2>(1,1))*ratio;
return
p
*
ratio
-
vector
<
double
,
2
>
(
ratio
,
ratio
);
return
p
*
ratio
-
vector
<
double
,
2
>
(
1
,
1
);
}
template
<
typename
T
>
...
...
@@ -507,7 +505,7 @@ namespace dlib
)
const
{
const
double
ratio
=
3.0
/
2.0
;
return
p
*
ratio
+
vector
<
T
,
2
>
(
1
,
1
);
return
p
*
ratio
+
vector
<
T
,
2
>
(
ratio
,
ratio
);
}
// -----------------------------
...
...
dlib/test/pyramid_down.cpp
View file @
2a224bf0
...
...
@@ -206,7 +206,7 @@ void test_pyramid_down_rgb2()
template
<
typename
pyramid_down_type
>
void
test_pyramid_down_grayscale2
()
{
array2d
<
unsigned
char
>
img
,
img3
;
array2d
<
unsigned
char
>
img
;
array2d
<
unsigned
char
>
img2
,
img4
;
...
...
@@ -225,7 +225,6 @@ void test_pyramid_down_grayscale2()
pyramid_down_type
pyr
;
pyr
(
img
,
img2
);
pyr
(
img
,
img3
);
DLIB_TEST
(((
rect1
.
tl_corner
()
-
pyr
.
rect_down
(
pyr
.
rect_up
(
rect1
,
2
),
2
).
tl_corner
()).
length
())
<
1
);
...
...
@@ -246,17 +245,13 @@ void test_pyramid_down_grayscale2()
/*
image_window my_window(img);
image_window win2(img2);
image_window win3(img3);
win2.add_overlay(image_window::overlay_rect(rect1, rgb_pixel(255,0,0)));
win2.add_overlay(image_window::overlay_rect(rect2, rgb_pixel(255,0,0)));
win2.add_overlay(image_window::overlay_rect(rect3, rgb_pixel(255,0,0)));
win3.add_overlay(image_window::overlay_rect(rect1, rgb_pixel(255,0,0)));
win3.add_overlay(image_window::overlay_rect(rect2, rgb_pixel(255,0,0)));
win3.add_overlay(image_window::overlay_rect(rect3, rgb_pixel(255,0,0)));
*/
DLIB_TEST
(
std
::
abs
((
int
)
mean
(
subm
(
matrix_cast
<
long
>
(
mat
(
img2
)),
rect1
))
-
255
)
<
3
);
DLIB_TEST
(
std
::
abs
((
int
)
mean
(
subm
(
matrix_cast
<
long
>
(
mat
(
img2
)),
rect1
))
-
255
)
<
=
3
);
DLIB_TEST
(
std
::
abs
((
int
)
mean
(
subm
(
matrix_cast
<
long
>
(
mat
(
img2
)),
rect2
))
-
170
)
<
3
);
DLIB_TEST
(
std
::
abs
((
int
)
mean
(
subm
(
matrix_cast
<
long
>
(
mat
(
img2
)),
rect3
))
-
100
)
<
3
);
assign_image
(
img4
,
img
);
...
...
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