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
a105c616
Commit
a105c616
authored
Sep 05, 2016
by
Davis King
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Made cropper not output boxes smaller than it's supposed to. Also cleaned up
code a little.
parent
1c940a5b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
8 deletions
+10
-8
random_cropper.h
dlib/image_transforms/random_cropper.h
+10
-8
No files found.
dlib/image_transforms/random_cropper.h
View file @
a105c616
...
...
@@ -110,12 +110,14 @@ namespace dlib
std
::
vector
<
mmod_rect
>&
crop_rects
)
{
chip_details
crop_
details
;
chip_details
crop_
plan
;
bool
should_flip_crop
;
make_crop_plan
(
img
,
rects
,
crop_
details
,
should_flip_crop
);
make_crop_plan
(
img
,
rects
,
crop_
plan
,
should_flip_crop
);
extract_image_chip
(
img
,
crop_details
,
crop
);
const
rectangle_transform
tform
=
get_mapping_to_chip
(
crop_details
);
extract_image_chip
(
img
,
crop_plan
,
crop
);
const
rectangle_transform
tform
=
get_mapping_to_chip
(
crop_plan
);
const
unsigned
long
min_object_height_absolute
=
std
::
round
(
min_object_height
*
crop_plan
.
rows
);
// copy rects into crop_rects and set ones that are outside the crop to ignore or
// drop entirely as appropriate.
...
...
@@ -128,8 +130,8 @@ namespace dlib
// if the rect is at least partly in the crop
if
(
get_rect
(
crop
).
intersect
(
rect
.
rect
).
area
()
!=
0
)
{
// set to ignore if not totally in the crop
if
(
!
get_rect
(
crop
).
contains
(
rect
.
rect
))
// set to ignore if not totally in the crop
or if too small.
if
(
!
get_rect
(
crop
).
contains
(
rect
.
rect
)
||
rect
.
rect
.
height
()
<
min_object_height_absolute
)
rect
.
ignore
=
true
;
crop_rects
.
push_back
(
rect
);
...
...
@@ -153,7 +155,7 @@ namespace dlib
void
make_crop_plan
(
const
image_type1
&
img
,
const
std
::
vector
<
mmod_rect
>&
rects
,
chip_details
&
crop_
details
,
chip_details
&
crop_
plan
,
bool
&
should_flip_crop
)
{
...
...
@@ -178,7 +180,7 @@ namespace dlib
}
should_flip_crop
=
randomly_flip
&&
rnd
.
get_random_double
()
>
0
.
5
;
const
double
angle
=
rnd
.
get_double_in_range
(
-
max_rotation_degrees
,
max_rotation_degrees
)
*
pi
/
180
;
crop_
details
=
chip_details
(
crop_rect
,
dims
,
angle
);
crop_
plan
=
chip_details
(
crop_rect
,
dims
,
angle
);
}
bool
has_non_ignored_box
(
...
...
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