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
cab12bb1
Commit
cab12bb1
authored
Aug 23, 2013
by
Davis King
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added add_image_left_right_flips()
parent
dc907c33
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
79 additions
and
0 deletions
+79
-0
interpolation.h
dlib/image_transforms/interpolation.h
+54
-0
interpolation_abstract.h
dlib/image_transforms/interpolation_abstract.h
+25
-0
No files found.
dlib/image_transforms/interpolation.h
View file @
cab12bb1
...
...
@@ -578,6 +578,60 @@ namespace dlib
assign_image
(
out_img
,
flipud
(
mat
(
in_img
)));
}
// ----------------------------------------------------------------------------------------
namespace
impl
{
inline
rectangle
flip_rect_left_right
(
const
rectangle
&
rect
,
const
rectangle
&
window
)
{
rectangle
temp
;
temp
.
top
()
=
rect
.
top
();
temp
.
bottom
()
=
rect
.
bottom
();
const
long
left_dist
=
rect
.
left
()
-
window
.
left
();
temp
.
right
()
=
window
.
right
()
-
left_dist
;
temp
.
left
()
=
temp
.
right
()
-
rect
.
width
()
+
1
;
return
temp
;
}
}
template
<
typename
image_type
>
void
add_image_left_right_flips
(
dlib
::
array
<
image_type
>&
images
,
std
::
vector
<
std
::
vector
<
rectangle
>
>&
objects
)
{
// make sure requires clause is not broken
DLIB_ASSERT
(
images
.
size
()
==
objects
.
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
()
);
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
);
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
])));
images
.
push_back
(
temp
);
objects
.
push_back
(
rects
);
}
}
// ----------------------------------------------------------------------------------------
namespace
impl
...
...
dlib/image_transforms/interpolation_abstract.h
View file @
cab12bb1
...
...
@@ -421,6 +421,31 @@ namespace dlib
(i.e. it is flipped as if viewed though a mirror)
!*/
// ----------------------------------------------------------------------------------------
template
<
typename
image_type
>
void
add_image_left_right_flips
(
dlib
::
array
<
image_type
>&
images
,
std
::
vector
<
std
::
vector
<
rectangle
>
>&
objects
);
/*!
requires
- image_type == is an implementation of array2d/array2d_kernel_abstract.h
- pixel_traits<typename image_type::type> is defined
- images.size() == objects.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 similarly appends them into
objects. 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.
- #images.size() == images.size()*2
- #objects.size() == objects.size()*2
!*/
// ----------------------------------------------------------------------------------------
template
<
...
...
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