| 151 | // ---------------------------------------------------------------------------------------- |
| 152 | |
| 153 | double 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 | |
| 182 | std::vector<std::vector<double> > get_interocular_distances ( |
| 183 | const std::vector<std::vector<full_object_detection> >& objects |
no test coverage detected