| 117 | } |
| 118 | |
| 119 | void square_boxes(std::vector<face_box>& rects) |
| 120 | { |
| 121 | for(unsigned int i = 0; i < rects.size(); i++) |
| 122 | { |
| 123 | float h = rects[i].y1 - rects[i].y0 + 1; |
| 124 | float w = rects[i].x1 - rects[i].x0 + 1; |
| 125 | |
| 126 | float l = std::max(h, w); |
| 127 | |
| 128 | rects[i].x0 = rects[i].x0 + (w - l) * 0.5; |
| 129 | rects[i].y0 = rects[i].y0 + (h - l) * 0.5; |
| 130 | rects[i].x1 = rects[i].x0 + l - 1; |
| 131 | rects[i].y1 = rects[i].y0 + l - 1; |
| 132 | } |
| 133 | } |
| 134 | |
| 135 | void padding(int img_h, int img_w, std::vector<face_box>& rects) |
| 136 | { |
no test coverage detected