Add center to detection

This commit is contained in:
Ruben van de Ven 2020-09-22 09:39:59 +02:00
parent cef703104b
commit 37d60fd576

View file

@ -307,11 +307,15 @@ function parseDetectionResults(results) {
y: result.alignedRect._box._y * factor_y, y: result.alignedRect._box._y * factor_y,
width: result.alignedRect._box._width * factor_x, width: result.alignedRect._box._width * factor_x,
height: result.alignedRect._box._height * factor_y, height: result.alignedRect._box._height * factor_y,
} },
} }
for(let idx in result.parts) { for(let idx in result.parts) {
detection.parts[idx] = result.parts[idx].map((pos) => parseCoordinate(pos)); detection.parts[idx] = result.parts[idx].map((pos) => parseCoordinate(pos));
} }
detection['center'] = {
x: detection.box.x + detection.box.width / 2,
y: detection.box.y + detection.box.height / 2,
}
detections.push(detection); detections.push(detection);
} }