Commit 5a69878b authored by Davis King's avatar Davis King

Added map_det_to_chip()

parent 5b3e76b1
......@@ -1508,6 +1508,28 @@ namespace dlib
return find_similarity_transform(from, to);
}
// ----------------------------------------------------------------------------------------
inline full_object_detection map_det_to_chip(
const full_object_detection& det,
const chip_details& details
)
{
point_transform_affine tform = get_mapping_to_chip(details);
full_object_detection res(det);
// map the parts
for (unsigned long l = 0; l < det.num_parts(); ++l)
res.part(l) = tform(det.part(l));
// map the main rectangle
rectangle rect;
rect += tform(det.get_rect().tl_corner());
rect += tform(det.get_rect().tr_corner());
rect += tform(det.get_rect().bl_corner());
rect += tform(det.get_rect().br_corner());
res.get_rect() = rect;
return res;
}
// ----------------------------------------------------------------------------------------
template <
......
......@@ -1039,6 +1039,24 @@ namespace dlib
to the pixels in the cropped image defined by the given details object.
!*/
// ----------------------------------------------------------------------------------------
full_object_detection map_det_to_chip (
const full_object_detection& det,
const chip_details& details
);
/*!
ensures
- Maps the given detection into the pixel space of the image chip defined by
the given details object. That is, this function returns an object D such
that:
- D.get_rect() == a box that bounds the same thing in the image chip as
det.get_rect() bounds in the original image the chip is extracted from.
- for all valid i:
- D.part(i) == the location in the image chip corresponding to
det.part(i) in the original image.
!*/
// ----------------------------------------------------------------------------------------
template <
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment