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.
This commit is contained in:
Davis King 2014-12-29 17:55:40 -05:00
parent 201c1601c8
commit fa60632d28

View File

@ -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)