Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
D
dlib
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
钟尚武
dlib
Commits
cabad6d5
Commit
cabad6d5
authored
Sep 17, 2017
by
Davis King
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed a bug in the random_cropper where it might crash due to division by 0
if small images are given as input.
parent
da968fa5
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
2 deletions
+3
-2
random_cropper.h
dlib/image_transforms/random_cropper.h
+3
-2
No files found.
dlib/image_transforms/random_cropper.h
View file @
cabad6d5
...
...
@@ -276,11 +276,12 @@ namespace dlib
// lets this random box be either as big as it can be while still fitting in
// the image or as small as a 3x zoomed in box randomly somewhere in the image.
double
mins
=
1
.
0
/
3
.
0
,
maxs
=
std
::
min
(
img
.
nr
()
/
(
double
)
dims
.
rows
,
img
.
nc
()
/
(
double
)
dims
.
cols
);
mins
=
std
::
min
(
mins
,
maxs
);
auto
scale
=
rnd
.
get_double_in_range
(
mins
,
maxs
);
rectangle
rect
(
scale
*
dims
.
cols
,
scale
*
dims
.
rows
);
// randomly shift the box around
point
offset
(
rnd
.
get_random_32bit_number
()
%
(
img
.
nc
()
-
rect
.
width
()),
rnd
.
get_random_32bit_number
()
%
(
img
.
nr
()
-
rect
.
height
()));
point
offset
(
rnd
.
get_random_32bit_number
()
%
(
1
+
img
.
nc
()
-
rect
.
width
()),
rnd
.
get_random_32bit_number
()
%
(
1
+
img
.
nr
()
-
rect
.
height
()));
return
move_rect
(
rect
,
offset
);
}
...
...
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