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
88310147
Commit
88310147
authored
Jun 01, 2020
by
Davis King
Browse files
minor cleanup
parent
a8324201
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
12 deletions
+8
-12
dlib/image_transforms/interpolation.h
dlib/image_transforms/interpolation.h
+6
-10
dlib/image_transforms/interpolation_abstract.h
dlib/image_transforms/interpolation_abstract.h
+2
-2
No files found.
dlib/image_transforms/interpolation.h
View file @
88310147
...
...
@@ -241,7 +241,6 @@ namespace dlib
// Interpolation currently supports only fully cartesian (non-polar) spaces.
static_assert
(
is_color_space_cartesian_image
<
image_view_type
>::
value
==
true
,
"Non-cartesian color space used in interpolation"
);
using
traits
=
pixel_traits
<
typename
image_view_type
::
pixel_type
>
;
const
long
left
=
static_cast
<
long
>
(
std
::
floor
(
p
.
x
()));
const
long
top
=
static_cast
<
long
>
(
std
::
floor
(
p
.
y
()));
...
...
@@ -255,16 +254,13 @@ namespace dlib
const
double
lr_frac
=
p
.
x
()
-
left
;
const
double
tb_frac
=
p
.
y
()
-
top
;
auto
const
tl
=
pixel_to_vector
<
double
>
(
img
[
top
][
left
]);
auto
const
tr
=
pixel_to_vector
<
double
>
(
img
[
top
][
right
]);
auto
const
bl
=
pixel_to_vector
<
double
>
(
img
[
bottom
][
left
]);
auto
const
br
=
pixel_to_vector
<
double
>
(
img
[
bottom
][
right
]);
matrix
<
double
,
traits
::
num
,
1
>
pvout
;
for
(
long
i
=
0
;
i
<
traits
::
num
;
++
i
)
pvout
(
i
)
=
(
1
-
tb_frac
)
*
((
1
-
lr_frac
)
*
tl
(
i
)
+
lr_frac
*
tr
(
i
))
+
tb_frac
*
((
1
-
lr_frac
)
*
bl
(
i
)
+
lr_frac
*
br
(
i
));
const
auto
tl
=
pixel_to_vector
<
double
>
(
img
[
top
][
left
]);
const
auto
tr
=
pixel_to_vector
<
double
>
(
img
[
top
][
right
]);
const
auto
bl
=
pixel_to_vector
<
double
>
(
img
[
bottom
][
left
]);
const
auto
br
=
pixel_to_vector
<
double
>
(
img
[
bottom
][
right
]);
typename
image_view_type
::
pixel_type
temp
;
vector_to_pixel
(
temp
,
pvout
);
vector_to_pixel
(
temp
,
(
1
-
tb_frac
)
*
((
1
-
lr_frac
)
*
tl
+
lr_frac
*
tr
)
+
tb_frac
*
((
1
-
lr_frac
)
*
bl
+
lr_frac
*
br
));
assign_pixel
(
result
,
temp
);
return
true
;
}
...
...
dlib/image_transforms/interpolation_abstract.h
View file @
88310147
...
...
@@ -78,7 +78,7 @@ namespace dlib
- image_view_type == an image_view or const_image_view object
- pixel_traits<typename image_view_type::pixel_type>::has_alpha == false
- pixel_traits<pixel_type> is defined
-
pixel_type uses cartesian coordinates color spac
e
-
is_color_space_cartesian_image<image_view_type>::value == tru
e
ensures
- if (there is an interpolatable image location at point p in img) then
- #result == the interpolated pixel value from img at point p.
...
...
@@ -118,7 +118,7 @@ namespace dlib
- image_view_type == an image_view or const_image_view object.
- pixel_traits<typename image_view_type::pixel_type>::has_alpha == false
- pixel_traits<pixel_type> is defined
-
pixel_type uses cartesian coordinates color spac
e
-
is_color_space_cartesian_image<image_view_type>::value == tru
e
ensures
- if (there is an interpolatable image location at point p in img) then
- #result == the interpolated pixel value from img at point p
...
...
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