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

Function interocular_distance

examples/train_shape_predictor_ex.cpp:153–180  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

151// ----------------------------------------------------------------------------------------
152
153double interocular_distance (
154 const full_object_detection& det
155)
156{
157 dlib::vector<double,2> l, r;
158 double cnt = 0;
159 // Find the center of the left eye by averaging the points around
160 // the eye.
161 for (unsigned long i = 36; i <= 41; ++i)
162 {
163 l += det.part(i);
164 ++cnt;
165 }
166 l /= cnt;
167
168 // Find the center of the right eye by averaging the points around
169 // the eye.
170 cnt = 0;
171 for (unsigned long i = 42; i <= 47; ++i)
172 {
173 r += det.part(i);
174 ++cnt;
175 }
176 r /= cnt;
177
178 // Now return the distance between the centers of the eyes
179 return length(l-r);
180}
181
182std::vector<std::vector<double> > get_interocular_distances (
183 const std::vector<std::vector<full_object_detection> >& objects

Callers 1

Calls 1

lengthFunction · 0.50

Tested by

no test coverage detected