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
277e13df
Commit
277e13df
authored
Nov 21, 2013
by
Davis King
Browse files
Added an overload of add_image_left_right_flips() that can take two sets of
rectangles instead of just one.
parent
8b954260
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
75 additions
and
0 deletions
+75
-0
dlib/image_transforms/interpolation.h
dlib/image_transforms/interpolation.h
+42
-0
dlib/image_transforms/interpolation_abstract.h
dlib/image_transforms/interpolation_abstract.h
+33
-0
No files found.
dlib/image_transforms/interpolation.h
View file @
277e13df
...
...
@@ -947,6 +947,48 @@ namespace dlib
}
}
// ----------------------------------------------------------------------------------------
template
<
typename
image_type
>
void
add_image_left_right_flips
(
dlib
::
array
<
image_type
>&
images
,
std
::
vector
<
std
::
vector
<
rectangle
>
>&
objects
,
std
::
vector
<
std
::
vector
<
rectangle
>
>&
objects2
)
{
// make sure requires clause is not broken
DLIB_ASSERT
(
images
.
size
()
==
objects
.
size
()
&&
images
.
size
()
==
objects2
.
size
(),
"
\t
void add_image_left_right_flips()"
<<
"
\n\t
Invalid inputs were given to this function."
<<
"
\n\t
images.size(): "
<<
images
.
size
()
<<
"
\n\t
objects.size(): "
<<
objects
.
size
()
<<
"
\n\t
objects2.size(): "
<<
objects2
.
size
()
);
image_type
temp
;
std
::
vector
<
rectangle
>
rects
;
const
unsigned
long
num
=
images
.
size
();
for
(
unsigned
long
j
=
0
;
j
<
num
;
++
j
)
{
flip_image_left_right
(
images
[
j
],
temp
);
images
.
push_back
(
temp
);
rects
.
clear
();
for
(
unsigned
long
i
=
0
;
i
<
objects
[
j
].
size
();
++
i
)
rects
.
push_back
(
impl
::
flip_rect_left_right
(
objects
[
j
][
i
],
get_rect
(
images
[
j
])));
objects
.
push_back
(
rects
);
rects
.
clear
();
for
(
unsigned
long
i
=
0
;
i
<
objects2
[
j
].
size
();
++
i
)
rects
.
push_back
(
impl
::
flip_rect_left_right
(
objects2
[
j
][
i
],
get_rect
(
images
[
j
])));
objects2
.
push_back
(
rects
);
}
}
// ----------------------------------------------------------------------------------------
template
<
...
...
dlib/image_transforms/interpolation_abstract.h
View file @
277e13df
...
...
@@ -447,6 +447,39 @@ namespace dlib
objects in the new flipped images.
- #images.size() == images.size()*2
- #objects.size() == objects.size()*2
- All the original elements of images and objects are left unmodified. That
is, this function only appends new elements to each of these containers.
!*/
// ----------------------------------------------------------------------------------------
template
<
typename
image_type
>
void
add_image_left_right_flips
(
dlib
::
array
<
image_type
>&
images
,
std
::
vector
<
std
::
vector
<
rectangle
>
>&
objects
,
std
::
vector
<
std
::
vector
<
rectangle
>
>&
objects2
);
/*!
requires
- image_type == is an implementation of array2d/array2d_kernel_abstract.h
- pixel_traits<typename image_type::type> is defined
- images.size() == objects.size()
- images.size() == objects2.size()
ensures
- This function computes all the left/right flips of the contents of images and
then appends them onto the end of the images array. It also finds the
left/right flips of the rectangles in objects and objects2 and similarly
appends them into objects and objects2 respectively. That is, we assume
objects[i] is the set of bounding boxes in images[i] and we flip the bounding
boxes so that they still bound the same objects in the new flipped images.
We similarly flip the boxes in objects2.
- #images.size() == images.size()*2
- #objects.size() == objects.size()*2
- #objects2.size() == objects2.size()*2
- All the original elements of images, objects, and objects2 are left unmodified.
That is, this function only appends new elements to each of these containers.
!*/
// ----------------------------------------------------------------------------------------
...
...
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