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
c0ab9a13
Commit
c0ab9a13
authored
Sep 03, 2014
by
Davis King
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added get_mapping_to_chip()
parent
0438ae5d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
1 deletion
+31
-1
interpolation.h
dlib/image_transforms/interpolation.h
+20
-1
interpolation_abstract.h
dlib/image_transforms/interpolation_abstract.h
+11
-0
No files found.
dlib/image_transforms/interpolation.h
View file @
c0ab9a13
...
...
@@ -1457,6 +1457,25 @@ namespace dlib
}
};
// ----------------------------------------------------------------------------------------
inline
point_transform_affine
get_mapping_to_chip
(
const
chip_details
&
details
)
{
std
::
vector
<
dlib
::
vector
<
double
,
2
>
>
from
,
to
;
point
p1
(
0
,
0
);
point
p2
(
details
.
cols
-
1
,
0
);
point
p3
(
details
.
cols
-
1
,
details
.
rows
-
1
);
to
.
push_back
(
p1
);
from
.
push_back
(
rotate_point
<
double
>
(
center
(
details
.
rect
),
details
.
rect
.
tl_corner
(),
details
.
angle
));
to
.
push_back
(
p2
);
from
.
push_back
(
rotate_point
<
double
>
(
center
(
details
.
rect
),
details
.
rect
.
tr_corner
(),
details
.
angle
));
to
.
push_back
(
p3
);
from
.
push_back
(
rotate_point
<
double
>
(
center
(
details
.
rect
),
details
.
rect
.
br_corner
(),
details
.
angle
));
return
find_similarity_transform
(
from
,
to
);
}
// ----------------------------------------------------------------------------------------
template
<
...
...
@@ -1534,7 +1553,7 @@ namespace dlib
from
.
push_back
(
get_rect
(
chips
[
i
]).
tl_corner
());
to
.
push_back
(
rotate_point
<
double
>
(
center
(
rect
),
rect
.
tl_corner
(),
chip_locations
[
i
].
angle
));
from
.
push_back
(
get_rect
(
chips
[
i
]).
tr_corner
());
to
.
push_back
(
rotate_point
<
double
>
(
center
(
rect
),
rect
.
tr_corner
(),
chip_locations
[
i
].
angle
));
from
.
push_back
(
get_rect
(
chips
[
i
]).
bl_corner
());
to
.
push_back
(
rotate_point
<
double
>
(
center
(
rect
),
rect
.
bl_corner
(),
chip_locations
[
i
].
angle
));
point_transform_affine
trns
=
find_
affine
_transform
(
from
,
to
);
point_transform_affine
trns
=
find_
similarity
_transform
(
from
,
to
);
// now extract the actual chip
if
(
level
==
-
1
)
...
...
dlib/image_transforms/interpolation_abstract.h
View file @
c0ab9a13
...
...
@@ -1004,6 +1004,17 @@ namespace dlib
unsigned
long
cols
;
};
// ----------------------------------------------------------------------------------------
point_transform_affine
get_mapping_to_chip
(
const
chip_details
&
details
);
/*!
ensures
- returns a transformation that maps from the pixels in the original image
to the pixels in the cropped image defined by the given details object.
!*/
// ----------------------------------------------------------------------------------------
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