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
46bcd205
Unverified
Commit
46bcd205
authored
Jan 29, 2020
by
Juha Reunanen
Committed by
GitHub
Jan 28, 2020
Browse files
If nearest-neighbor interpolation is wanted, then don't use an image pyramid. (#1986)
parent
44302188
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
2 deletions
+8
-2
dlib/image_transforms/interpolation.h
dlib/image_transforms/interpolation.h
+8
-2
No files found.
dlib/image_transforms/interpolation.h
View file @
46bcd205
...
@@ -1888,6 +1888,12 @@ namespace dlib
...
@@ -1888,6 +1888,12 @@ namespace dlib
}
}
#endif
#endif
// If nearest-neighbor interpolation is wanted, then don't use an image pyramid.
constexpr
bool
image_pyramid_enabled
=
!
std
::
is_same
<
std
::
remove_const_t
<
std
::
remove_reference_t
<
decltype
(
interp
)
>>
,
interpolate_nearest_neighbor
>::
value
;
pyramid_down
<
2
>
pyr
;
pyramid_down
<
2
>
pyr
;
long
max_depth
=
0
;
long
max_depth
=
0
;
// If the chip is supposed to be much smaller than the source subwindow then you
// If the chip is supposed to be much smaller than the source subwindow then you
...
@@ -1902,7 +1908,7 @@ namespace dlib
...
@@ -1902,7 +1908,7 @@ namespace dlib
long
depth
=
0
;
long
depth
=
0
;
double
grow
=
2
;
double
grow
=
2
;
drectangle
rect
=
pyr
.
rect_down
(
chip_locations
[
i
].
rect
);
drectangle
rect
=
pyr
.
rect_down
(
chip_locations
[
i
].
rect
);
while
(
rect
.
area
()
>
chip_locations
[
i
].
size
())
while
(
rect
.
area
()
>
chip_locations
[
i
].
size
()
&&
image_pyramid_enabled
)
{
{
rect
=
pyr
.
rect_down
(
rect
);
rect
=
pyr
.
rect_down
(
rect
);
++
depth
;
++
depth
;
...
@@ -1950,7 +1956,7 @@ namespace dlib
...
@@ -1950,7 +1956,7 @@ namespace dlib
// figure out which level in the pyramid to use to extract the chip
// figure out which level in the pyramid to use to extract the chip
int
level
=
-
1
;
int
level
=
-
1
;
drectangle
rect
=
translate_rect
(
chip_locations
[
i
].
rect
,
-
bounding_box
.
tl_corner
());
drectangle
rect
=
translate_rect
(
chip_locations
[
i
].
rect
,
-
bounding_box
.
tl_corner
());
while
(
pyr
.
rect_down
(
rect
).
area
()
>
chip_locations
[
i
].
size
())
while
(
pyr
.
rect_down
(
rect
).
area
()
>
chip_locations
[
i
].
size
()
&&
image_pyramid_enabled
)
{
{
++
level
;
++
level
;
rect
=
pyr
.
rect_down
(
rect
);
rect
=
pyr
.
rect_down
(
rect
);
...
...
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