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
c0ab9a13
Commit
c0ab9a13
authored
Sep 02, 2014
by
Davis King
Browse files
Added get_mapping_to_chip()
parent
0438ae5d
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
1 deletion
+31
-1
dlib/image_transforms/interpolation.h
dlib/image_transforms/interpolation.h
+20
-1
dlib/image_transforms/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
...
@@ -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
<
template
<
...
@@ -1534,7 +1553,7 @@ namespace dlib
...
@@ -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
]).
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
]).
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
));
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
// now extract the actual chip
if
(
level
==
-
1
)
if
(
level
==
-
1
)
...
...
dlib/image_transforms/interpolation_abstract.h
View file @
c0ab9a13
...
@@ -1004,6 +1004,17 @@ namespace dlib
...
@@ -1004,6 +1004,17 @@ namespace dlib
unsigned
long
cols
;
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
<
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