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
1842d866
Commit
1842d866
authored
Sep 04, 2016
by
Davis King
Browse files
Changed imglab --resample so that it never changes the aspect ratio of an
image.
parent
70363686
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
2 deletions
+3
-2
tools/imglab/src/main.cpp
tools/imglab/src/main.cpp
+3
-2
No files found.
tools/imglab/src/main.cpp
View file @
1842d866
...
@@ -20,7 +20,7 @@
...
@@ -20,7 +20,7 @@
#include <dlib/dir_nav.h>
#include <dlib/dir_nav.h>
const
char
*
VERSION
=
"1.
5
"
;
const
char
*
VERSION
=
"1.
6
"
;
...
@@ -604,9 +604,10 @@ int resample_dataset(const command_line_parser& parser)
...
@@ -604,9 +604,10 @@ int resample_dataset(const command_line_parser& parser)
if
(
data
.
images
[
i
].
boxes
[
j
].
ignore
||
!
get_rect
(
img
).
contains
(
rect
))
if
(
data
.
images
[
i
].
boxes
[
j
].
ignore
||
!
get_rect
(
img
).
contains
(
rect
))
continue
;
continue
;
const
auto
max_dim
=
std
::
max
(
rect
.
width
(),
rect
.
height
());
const
double
rand_scale_perturb
=
1
-
0.3
*
(
rnd
.
get_random_double
()
-
0.5
);
const
double
rand_scale_perturb
=
1
-
0.3
*
(
rnd
.
get_random_double
()
-
0.5
);
const
rectangle
crop_rect
=
centered_rect
(
rect
,
rect
.
width
()
*
margin_scale
*
rand_scale_perturb
,
rect
.
height
()
*
margin_scale
*
rand_scale_perturb
);
const
rectangle
crop_rect
=
centered_rect
(
rect
,
max_dim
*
margin_scale
*
rand_scale_perturb
,
max_dim
*
margin_scale
*
rand_scale_perturb
);
// skip crops that have a lot of border pixels
// skip crops that have a lot of border pixels
if
(
get_rect
(
img
).
intersect
(
crop_rect
).
area
()
<
crop_rect
.
area
()
*
0.8
)
if
(
get_rect
(
img
).
intersect
(
crop_rect
).
area
()
<
crop_rect
.
area
()
*
0.8
)
...
...
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