| 173 | // ------------------------------------------------------------------------------------ |
| 174 | |
| 175 | inline point_transform_affine find_tform_between_shapes ( |
| 176 | const matrix<float,0,1>& from_shape, |
| 177 | const matrix<float,0,1>& to_shape |
| 178 | ) |
| 179 | { |
| 180 | DLIB_ASSERT(from_shape.size() == to_shape.size() && (from_shape.size()%2) == 0 && from_shape.size() > 0,""); |
| 181 | std::vector<vector<float,2> > from_points, to_points; |
| 182 | const unsigned long num = from_shape.size()/2; |
| 183 | from_points.reserve(num); |
| 184 | to_points.reserve(num); |
| 185 | if (num == 1) |
| 186 | { |
| 187 | // Just use an identity transform if there is only one landmark. |
| 188 | return point_transform_affine(); |
| 189 | } |
| 190 | |
| 191 | for (unsigned long i = 0; i < num; ++i) |
| 192 | { |
| 193 | from_points.push_back(location(from_shape,i)); |
| 194 | to_points.push_back(location(to_shape,i)); |
| 195 | } |
| 196 | return find_similarity_transform(from_points, to_points); |
| 197 | } |
| 198 | |
| 199 | // ------------------------------------------------------------------------------------ |
| 200 |
no test coverage detected