MCPcopy Create free account
hub / github.com/davisking/dlib / create_shape_relative_encoding

Function create_shape_relative_encoding

dlib/image_processing/shape_predictor.h:145–171  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 2

shape_predictorMethod · 0.85
trainMethod · 0.85

Calls 4

nearest_shape_pointFunction · 0.85
locationFunction · 0.85
resizeMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected