FaceRecognition.cpp
Go to the documentation of this file.
1
#include "
FaceRecognition.h
"
2
3
#include <
ArmarXCore/core/logging/Logging.h
>
4
5
namespace
armarx
6
{
7
void
8
viz::addFaceRecognitionsToLayer
(
9
const
std::map<std::string, armarx::armem::human::FaceRecognition>& faceRecognitions,
10
armarx::viz::Layer
& faceRecognitionLayer,
11
const
std::string& prefix)
12
{
13
for
(
const
auto
& [name, faceRecognition] : faceRecognitions)
14
{
15
ARMARX_TRACE
;
16
static
const
int
radius = 100;
17
armarx::viz::Color
color = faceRecognition.profileID.has_value()
18
?
armarx::viz::Color::fromRGBA
(0, 255, 0, 255)
19
:
armarx::viz::Color::fromRGBA
(255, 0, 0, 255);
20
Eigen::Matrix
pos3D = faceRecognition.position3DGlobal;
21
armarx::viz::Sphere
facePos =
armarx::viz::Sphere
(
"Face of "
+ name)
22
.
position
(pos3D.x(), pos3D.y(), pos3D.z())
23
.
radius
(radius)
24
.
color
(color);
25
Eigen::Matrix4f
nameTagRotation;
26
nameTagRotation << -1, 0, 0, 0, 0, 1, 0, 0, 0, 0, -1, 0, 0, 0, 0, 1;
27
armarx::viz::Text
nameTag =
28
armarx::viz::Text
(
"Name of"
+ name)
29
.
text
(name)
30
.
scale
(15)
31
.
pose
(nameTagRotation)
32
.
position
(pos3D.x(), pos3D.y() + (
int
)(radius / 2) + 10, pos3D.z());
33
faceRecognitionLayer.
add
(facePos);
34
faceRecognitionLayer.
add
(nameTag);
35
}
36
}
37
38
}
// namespace armarx
armarx::viz::Color::fromRGBA
static Color fromRGBA(int r, int g, int b, int a=255)
Construct a byte color from R, G, B and optional alpha.
Definition:
Color.h:42
armarx::viz::Layer::add
void add(ElementT const &element)
Definition:
Layer.h:29
armarx::viz::Text::text
Text & text(std::string const &t)
Definition:
Elements.h:189
armarx::viz::Sphere
Definition:
Elements.h:134
armarx::viz::ElementOps::position
DerivedT & position(float x, float y, float z)
Definition:
ElementOps.h:127
FaceRecognition.h
ARMARX_TRACE
#define ARMARX_TRACE
Definition:
trace.h:69
armarx::viz::Sphere::radius
Sphere & radius(float r)
Definition:
Elements.h:138
armarx::viz::Color
Definition:
Color.h:13
armarx::viz::Text
Definition:
Elements.h:185
armarx::viz::addFaceRecognitionsToLayer
void addFaceRecognitionsToLayer(const std::map< std::string, armarx::armem::human::FaceRecognition > &faceRecognitions, armarx::viz::Layer &faceRecognitionLayer, const std::string &prefix)
Definition:
FaceRecognition.cpp:8
GfxTL::Matrix4f
MatrixXX< 4, 4, float > Matrix4f
Definition:
MatrixXX.h:601
armarx::viz::ElementOps::pose
DerivedT & pose(Eigen::Matrix4f const &pose)
Definition:
ElementOps.h:159
armarx::viz::ElementOps::scale
DerivedT & scale(Eigen::Vector3f scale)
Definition:
ElementOps.h:227
armarx::viz::ElementOps::color
DerivedT & color(Color color)
Definition:
ElementOps.h:195
Eigen::Matrix
Definition:
EigenForwardDeclarations.h:27
Logging.h
armarx::viz::Layer
Definition:
Layer.h:12
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition:
ArmarXTimeserver.cpp:28
VisionX
libraries
ArViz
FaceRecognition.cpp
Generated on Sat Oct 12 2024 09:14:16 for armarx_documentation by
1.8.17