83 for (Json::Value::ArrayIndex i = 0; i <
skeletonData.size(); i++) {
141 cv::circle(
getRGB_Image(), center, 4, cv::Scalar(0, 0, 255), 8, cv::LINE_8, 0);
142 cv::circle(
getSkeleton_Image(), center, 4, cv::Scalar(0, 0, 255), 8, cv::LINE_8, 0);
150 float * pixel =
new (std::nothrow)
float [2], * point =
new (std::nothrow)
float [3], distance = 0;
154 point[0] = point[1] = point[2] = pixel[0] = pixel[1] = 0;
159 rs2_deproject_pixel_to_point(point, & color_intrin, pixel, distance);
171 std::stringstream labelTextX, labelTextY, labelTextZ, labelTextConfidence;
177 if (i == 0 || i == 12 || i == 14) {
178 cv::putText(
getRGB_Image(), labelTextX.str(), cv::Point(
getBodyKeyPoints().at(i).getX() + 10,
getBodyKeyPoints().at(i).getY() + 10), cv::FONT_HERSHEY_SIMPLEX, 0.4, cv::Scalar(255, 0, 0), 1, cv::LINE_8);
179 cv::putText(
getRGB_Image(), labelTextY.str(), cv::Point(
getBodyKeyPoints().at(i).getX() + 10,
getBodyKeyPoints().at(i).getY() + 25), cv::FONT_HERSHEY_SIMPLEX, 0.4, cv::Scalar(255, 0, 0), 1, cv::LINE_8);
180 cv::putText(
getRGB_Image(), labelTextZ.str(), cv::Point(
getBodyKeyPoints().at(i).getX() + 10,
getBodyKeyPoints().at(i).getY() + 40), cv::FONT_HERSHEY_SIMPLEX, 0.4, cv::Scalar(255, 0, 0), 1, cv::LINE_8);
187Skeleton::Skeleton (cv::Mat & rgbImage, cv::Mat & dImage, cv::Mat & skeleton_Image, Json::Value skeletonData) {
static const float zOriginUnity
static const float xOriginUnity
BodyKeyPoint class is used for body keypoint creations and manipulations.
virtual std::vector< Point3D * > * mapToMeters(std::vector< Point3D * > pointsToMap, std::vector< bool > bodyKeyPointsMap, float xOrigin, float zOrigin)
This method requires pointers' Point3D's vector, the related vector map, and the original coordinates...
FacadeSingleton class is used as a single access point to a simplified interface.
CoordinateMappingManager * getCoordinateMappingManager(void)
Get the CoordinateMappingManager pointer.
OutputManager * getOutputManager(void)
Get the OutputManager pointer.
RealSenseManager * getCameraManager(void)
Get the RealSenseManager pointer.
static FacadeSingleton * getInstance(void)
Get the unique class instance. This methods should be called in the following scenario: when we just ...
OutputManagerJSON class is a class that abstracts final JSON output-producing operations.
Json::Value getValueAt(std::string key, Json::Value currentJSON)
Utility method to get the value at a given key in a given JSON node.
Point3D class is used for Point3D creations and manipulations.
struct rs2_intrinsics & get_color_intrin(void)
Get the color intrinsics object.
cv::Mat getRGB_Image(void)
Get the RGB Image object.
void setSkeletonPoints3D_RS(std::vector< Point3D * > skeletonPoints3D_RS)
Set the SkeletonPoints3D RS vector.
std::vector< BodyKeyPoint > getBodyKeyPoints(void)
Get the Body Key Points vector.
std::vector< BodyKeyPoint > bodyKeyPoints
A vector that contains each body joint retrieved from OpenPose.
float getConsistency(void)
Get the Consistency float value.
void setSkeleton_Image(cv::Mat &skeleton_Image)
Set the Skeleton-only Image object.
cv::Mat skeleton_Image
A frame that contains only skeleton information such as green legs and red dots, representing connect...
void setRGB_Image(cv::Mat &rgbImage)
Set the RGB Image object.
void setBodyKeyPoints(std::vector< BodyKeyPoint > &bodyKeyPoints)
Set the Body Key Points vector.
~Skeleton(void)
Destroy the Skeleton object.
std::vector< Point3D * > * getSkeletonPoints3D(void)
Get the Skeleton Points3D vector's pointer.
void setBodyKeyPointsMap(std::vector< bool > &bodyKeyPointsMap)
Set the Body Key Points Map vector.
void setDistance_Image(cv::Mat &distanceImage)
Set the Distance Image object.
void drawCircle(cv::Point center)
Draw a circle at the specified point as a parameter.
void setConsistency(float consistency)
Set the Consistency float value.
std::vector< bool > bodyKeyPointsMap
A vector that contains for each body joint retrieved from OpenPose a corresponding boolean that means...
std::vector< bool > getBodyKeyPointsMap(void)
Get the BodyKeyPoints Map vector.
void calcBodyEdges(void)
Calculate Skeleton and invoke methods to draw it on the image according to OpenPose skeleton structur...
Json::Value getSkeletonData(void)
Get the Skeleton Data JSON object.
void deprojectSkeletonPoints3D(void)
Deprojection operation takes a 2D pixel location on a stream's images, as well as a depth,...
void writeCoordinates(void)
Write specific joint points' coordinates on the RGB image.
std::vector< Point3D * > skeletonPoints3D_RS
A vector that contains a set of pointers to Point3D. These points have coordinates whose domain is de...
void calcBodyKeypoints(void)
Retrieve BodyKeyPoints vector and the BodyKeyPoints Map bool vector from OpenPose output,...
std::vector< Point3D * > * skeletonPoints3D
A pointer to a vector that contains a set of pointers to Point3D. These points have coordinates in wh...
Skeleton(cv::Mat &rgbImage, cv::Mat &distanceImage, cv::Mat &skeletonImage, Json::Value skeletonData)
Construct a new Skeleton object.
cv::Mat rgb_Image
RGB frame related to the frame in which the skeleton may appears.
void setSkeletonPoints3D(std::vector< Point3D * > *skeletonPoints3D)
Set the Skeleton Points3D pointer to vector.
Json::Value skeletonData
Represents a Skeleton JSON value. This class is a discriminated union wrapper that can represent a:
void drawLine(unsigned char start, unsigned char end)
Draw a line that starts from a point and ends at another point. The points are specified as unsigned ...
void setSkeletonData(Json::Value skeletonData)
Set the Skeleton Data JSON object.
cv::Mat distance_Image
Distance frame related to the frame in which the skeleton may appears.
float consistency
Consistency is a value that represents how accurate is the OpenPose detection for this skeleton....
void generateSkeleton(void)
A high-level method that abstracts all the internal structure and operations of the Skeleton class....
cv::Mat getSkeleton_Image(void)
Get the Skeleton-only Image object.
cv::Mat getDistance_Image(void)
Get the Distance Image object.
std::vector< Point3D * > getSkeletonPoints3D_RS(void)
Get the SkeletonPoints3D RS vector.
static const short int FACADE_SINGLETON_NULLPTR_ERROR
static const short int NEW_ALLOC_ERROR
static const char * FACADE_SINGLETON_NULLPTR_SCOPE
static const short int openPoseBodyKeyPointsNumber
static const char * NEW_ALLOC_SCOPE