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
c210395c
Commit
c210395c
authored
May 26, 2018
by
Davis King
Browse files
Made chip_details do something more benign when the user gives an empty
rectangle.
parent
2ed128e2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
5 deletions
+12
-5
dlib/image_transforms/interpolation.h
dlib/image_transforms/interpolation.h
+12
-5
No files found.
dlib/image_transforms/interpolation.h
View file @
c210395c
...
@@ -1758,11 +1758,18 @@ namespace dlib
...
@@ -1758,11 +1758,18 @@ namespace dlib
unsigned
long
size
unsigned
long
size
)
)
{
{
const
double
relative_size
=
std
::
sqrt
(
size
/
(
double
)
rect
.
area
());
if
(
rect
.
is_empty
())
rows
=
static_cast
<
unsigned
long
>
(
rect
.
height
()
*
relative_size
+
0.5
);
{
cols
=
static_cast
<
unsigned
long
>
(
size
/
(
double
)
rows
+
0.5
);
cols
=
rows
=
std
::
round
(
std
::
sqrt
((
double
)
size
));
rows
=
std
::
max
(
1ul
,
rows
);
}
cols
=
std
::
max
(
1ul
,
cols
);
else
{
const
double
relative_size
=
std
::
sqrt
(
size
/
(
double
)
rect
.
area
());
rows
=
static_cast
<
unsigned
long
>
(
rect
.
height
()
*
relative_size
+
0.5
);
cols
=
static_cast
<
unsigned
long
>
(
size
/
(
double
)
rows
+
0.5
);
rows
=
std
::
max
(
1ul
,
rows
);
cols
=
std
::
max
(
1ul
,
cols
);
}
}
}
};
};
...
...
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