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
2b934688
Commit
2b934688
authored
Dec 09, 2017
by
Davis King
Browse files
Made random_cropper's API a little more convenient for cropping out only
background crops.
parent
be826990
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
2 deletions
+32
-2
dlib/image_transforms/random_cropper.h
dlib/image_transforms/random_cropper.h
+14
-1
dlib/image_transforms/random_cropper_abstract.h
dlib/image_transforms/random_cropper_abstract.h
+18
-1
No files found.
dlib/image_transforms/random_cropper.h
View file @
2b934688
...
@@ -50,7 +50,7 @@ namespace dlib
...
@@ -50,7 +50,7 @@ namespace dlib
double
value
double
value
)
)
{
{
DLIB_CASSERT
(
0
<=
value
&&
value
<
1
);
DLIB_CASSERT
(
0
<=
value
&&
value
<
=
1
);
background_crops_fraction
=
value
;
background_crops_fraction
=
value
;
}
}
...
@@ -162,6 +162,19 @@ namespace dlib
...
@@ -162,6 +162,19 @@ namespace dlib
(
*
this
)(
images
[
idx
],
rects
[
idx
],
crop
,
crop_rects
);
(
*
this
)(
images
[
idx
],
rects
[
idx
],
crop
,
crop_rects
);
}
}
template
<
typename
image_type1
>
image_type1
operator
()
(
const
image_type1
&
img
)
{
image_type1
crop
;
std
::
vector
<
mmod_rect
>
junk1
,
junk2
;
(
*
this
)(
img
,
junk1
,
crop
,
junk2
);
return
crop
;
}
template
<
template
<
typename
image_type1
,
typename
image_type1
,
typename
image_type2
typename
image_type2
...
...
dlib/image_transforms/random_cropper_abstract.h
View file @
2b934688
...
@@ -83,7 +83,7 @@ namespace dlib
...
@@ -83,7 +83,7 @@ namespace dlib
);
);
/*!
/*!
requires
requires
- 0 <= value < 1
- 0 <= value <
=
1
ensures
ensures
- #get_background_crops_fraction() == value
- #get_background_crops_fraction() == value
!*/
!*/
...
@@ -307,6 +307,23 @@ namespace dlib
...
@@ -307,6 +307,23 @@ namespace dlib
inside the crop.
inside the crop.
- #crop_rects.size() <= rects.size()
- #crop_rects.size() <= rects.size()
!*/
!*/
template
<
typename
image_type1
>
image_type1
operator
()
(
const
image_type1
&
img
);
/*!
requires
- img.size() != 0
- image_type1 == an image object that implements the interface defined in
dlib/image_processing/generic_image.h
ensures
- This function simply calls (*this)(img, junk1, crop, junk2) and returns
crop. Therefore it is simply a convenience function for extracting a
random background patch.
!*/
};
};
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
...
...
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