AI Watch A1
Multi-person 3D skeleton detection using Intel RealSense and OpenPose with Kafka support.
UnityCoordinateMappingManager.cpp
Go to the documentation of this file.
1//
2// UnityCoordinateMappingManager.cpp
3// AI Watch A1
4//
5// Created by Denny Caruso on 30/07/22.
6//
7
8// License: Apache 2.0. See LICENSE file in root directory.
9// Copyright(c) 2022. All Rights Reserved.
10
12
13
14
16
17std::vector <Point3D *> * UnityCoordinateMappingManager::mapToMeters (std::vector <Point3D *> pointsToMap, std::vector <bool> bodyKeyPointsMap, float xOrigin, float zOrigin) {
18 std::vector <Point3D *> * newPoints = new std::vector <Point3D *>;
19 for (unsigned char i = 0; i < bodyKeyPointsMap.size(); i++) {
20 if (!bodyKeyPointsMap.at(i)) {
21 newPoints->push_back(new Point3D(0, 0, 0, new BodyKeyPoint(0, 0, 0)));
22 } else {
23 newPoints->push_back(new Point3D(
24 transformWidthCoordinate(pointsToMap.at(i)->getX()) - std::abs(xOrigin),
25 transformHeightCoordinate(pointsToMap.at(i)->getY()),
26 - (std::abs(pointsToMap.at(i)->getZ()) + std::abs(zOrigin) + getRoom().getDistanceCameraFromBackWall()),
27 new BodyKeyPoint(0, 0, ((BodyKeyPoint *) pointsToMap.at(i)->getDecorated())->getConfidence()))
28 );
29 }
30 }
31
32 return newPoints;
33}
34
35/*
36
37 Example: Rotating camera by 180°.
38
39 newPoints->push_back(new Point3D(
40 getRoom().getMaxWidth() - transformWidthCoordinate(pointsToMap.at(i)->getX()) - std::abs(xOrigin),
41 transformHeightCoordinate(pointsToMap.at(i)->getY()),
42 - (getRoom().getMaxDepth() - std::abs(pointsToMap.at(i)->getZ()) + std::abs(zOrigin) - getRoom().getDistanceCameraFromBackWall()),
43 new BodyKeyPoint(0, 0, ((BodyKeyPoint *) pointsToMap.at(i)->getDecorated())->getConfidence()))
44 );
45
46 */
BodyKeyPoint class is used for body keypoint creations and manipulations.
The CoordinateMappingManager class is a class that is responsible for converting coordinates values f...
float transformWidthCoordinate(float widthCoordinate)
Converts width value.
float transformHeightCoordinate(float heightCoordinate)
Converts height value.
Room getRoom(void)
Returns the room object.
Point3D class is used for Point3D creations and manipulations.
Definition: Point3D.hpp:23
Room class represents the Room abstraction. A Room object has different specifications,...
Definition: Room.hpp:64
std::vector< Point3D * > * mapToMeters(std::vector< Point3D * > pointsToMap, std::vector< bool > bodyKeyPointsMap, float xOrigin, float zOrigin) override
This method requires pointers' Point3D's vector, the related vector map, and the original coordinates...
UnityCoordinateMappingManager(Room room)
Construct a new Unity Coordinate Mapping Manager object.