Commit fa60632d authored by Davis King's avatar Davis King

Fixed a bug in extract_image_chips() and get_mapping_to_chip() that caused

incorrect outputs when the requested chip stretched the image unevenly
vertically or horizontally.  This is because we used the best similarity
transform rather than affine transform between the image and the output chip.
parent 201c1601
......@@ -1506,7 +1506,7 @@ namespace dlib
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);
return find_affine_transform(from, to);
}
// ----------------------------------------------------------------------------------------
......@@ -1661,7 +1661,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_similarity_transform(from,to);
point_transform_affine trns = find_affine_transform(from,to);
// now extract the actual chip
if (level == -1)
......
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