| 143 | // ------------------------------------------------------------------------------------ |
| 144 | |
| 145 | inline void create_shape_relative_encoding ( |
| 146 | const matrix<float,0,1>& shape, |
| 147 | const std::vector<dlib::vector<float,2> >& pixel_coordinates, |
| 148 | std::vector<unsigned long>& anchor_idx, |
| 149 | std::vector<dlib::vector<float,2> >& deltas |
| 150 | ) |
| 151 | /*! |
| 152 | requires |
| 153 | - shape.size()%2 == 0 |
| 154 | - shape.size() > 0 |
| 155 | ensures |
| 156 | - #anchor_idx.size() == pixel_coordinates.size() |
| 157 | - #deltas.size() == pixel_coordinates.size() |
| 158 | - for all valid i: |
| 159 | - pixel_coordinates[i] == location(shape,#anchor_idx[i]) + #deltas[i] |
| 160 | !*/ |
| 161 | { |
| 162 | anchor_idx.resize(pixel_coordinates.size()); |
| 163 | deltas.resize(pixel_coordinates.size()); |
| 164 | |
| 165 | |
| 166 | for (unsigned long i = 0; i < pixel_coordinates.size(); ++i) |
| 167 | { |
| 168 | anchor_idx[i] = nearest_shape_point(shape, pixel_coordinates[i]); |
| 169 | deltas[i] = pixel_coordinates[i] - location(shape,anchor_idx[i]); |
| 170 | } |
| 171 | } |
| 172 | |
| 173 | // ------------------------------------------------------------------------------------ |
| 174 |
no test coverage detected