HandModelVisualizer.h
Go to the documentation of this file.
1 /*
2  * This file is part of ArmarX.
3  *
4  * Copyright (C) 2011-2016, High Performance Humanoid Technologies (H2T), Karlsruhe Institute of Technology (KIT), all rights reserved.
5  *
6  * ArmarX is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation.
9  *
10  * ArmarX is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  *
18  * @package
19  * @author
20  * @date
21  * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
22  * GNU General Public License
23  */
24 #pragma once
25 
26 
27 // hand localisation
28 #include "../HandLocalisationConstants.h"
29 #include "../HandModel/HandModeliCub.h"
30 #include "../ParticleFilter/Polygon.h"
31 
32 // IVT
33 #include "Image/ByteImage.h"
34 #include "Calibration/StereoCalibration.h"
35 #include "Calibration/Calibration.h"
36 
37 // movemaster
38 #include "MoveMasterModel.h"
39 
40 
41 namespace visionx
42 {
44  {
45  public:
46  // constructor
47  CHandModelVisualizer(CStereoCalibration* pCalibration, bool bUseLeftCamera = true);
48 
49  // destructor
51 
52 
53  // update the hand configuration
54  void UpdateHandModel(double* pConfig, bool bUpdateOpenInventorModel = true, bool bDrawCylinderInHand = false);
55 
56 
57  // draw fingertips into an image
58  void DrawFingertips(CByteImage* pImage);
59 
60  // draw simple hand model for PF
61  void DrawHandModelV2(CByteImage* pImage, bool bLeftCameraImage = true);
62 
63  // draw hand into an image
64  void DrawHand(CByteImage* pImage);
65 
66  // draw segmented image with hand/object/background regions
67  void DrawSegmentedImage(CByteImage* pImage, bool bUseOpenInventorModel = true);
68  void DrawSegmentedImageWithoutOpenInventor(CByteImage* pSegmentedImage);
69 
70  // draw a +
71  static void DrawCross(CByteImage* pGreyImage, int x, int y, int nBrightness);
72  static void DrawCross(CByteImage* pColorImage, int x, int y, int r, int g, int b);
73 
74 
75  static void DrawLineIntoImage(CByteImage* pImage, int x1, int y1, int x2, int y2, int red, int green, int blue);
76 
77 
78  //void OutputProjectionImage(CByteImage* pImage, bool write_to_file=false);
79  //void OutputProjectionImagePolygon(CByteImage* pImage, bool write_to_file=false);
80  //void PaintPolygon(CByteImage* pImage, Polygon* pol);
81  //void PaintLineSequence(Vec3d linePoints[], int nPoints, CByteImage* pImage);
82 
83 
84  private:
85  public: //TODO: make private again
86 
89 
90  CStereoCalibration* m_pStereoCalibration;
95 
96 
97  void DrawPolygon(CByteImage* pImage, ConvexPolygonCalculations::Polygon& pPolygon);
98  void DrawPolygonGrayscale(CByteImage* pImage, ConvexPolygonCalculations::Polygon& pPolygon);
99 
100  void DrawQuadrangleAlongA3DLine(CByteImage* pImage, Vec3d vStart, Vec3d vEnd, float fWidthAtStart, float fWidthAtEnd);
101 
102  void ConfigureMoveMasterModel(double* pConfig, bool bDrawCylinderInHand);
103 
104  void ExtractAnglesFromRotationMatrix(const Mat3d& mat, Vec3d& angles);
105  };
106 }
107 
visionx::CHandModelV2
Definition: HandModelV2.h:40
MoveMasterModel.h
visionx
ArmarX headers.
Definition: OpenPoseStressTest.h:38
visionx::CMoveMasterModel
Definition: MoveMasterModel.h:32
visionx::ConvexPolygonCalculations::Polygon
Definition: Polygon.h:34
visionx::CHandModelVisualizer::m_fFocalLengthY
float m_fFocalLengthY
Definition: HandModelVisualizer.h:92
visionx::CHandModelVisualizer::m_fFocalLengthX
float m_fFocalLengthX
Definition: HandModelVisualizer.h:91
visionx::CHandModelVisualizer::DrawFingertips
void DrawFingertips(CByteImage *pImage)
visionx::CHandModelVisualizer::DrawLineIntoImage
static void DrawLineIntoImage(CByteImage *pImage, int x1, int y1, int x2, int y2, int red, int green, int blue)
Definition: HandModelVisualizer.cpp:818
visionx::CHandModelVisualizer::DrawHand
void DrawHand(CByteImage *pImage)
Definition: HandModelVisualizer.cpp:571
visionx::CHandModelVisualizer::m_fPrincipalPointX
float m_fPrincipalPointX
Definition: HandModelVisualizer.h:93
GfxTL::Vec3d
VectorXD< 3, double > Vec3d
Definition: VectorXD.h:695
visionx::CHandModelVisualizer::DrawSegmentedImageWithoutOpenInventor
void DrawSegmentedImageWithoutOpenInventor(CByteImage *pSegmentedImage)
Definition: HandModelVisualizer.cpp:696
visionx::CHandModelVisualizer::DrawSegmentedImage
void DrawSegmentedImage(CByteImage *pImage, bool bUseOpenInventorModel=true)
Definition: HandModelVisualizer.cpp:615
visionx::CHandModelVisualizer::DrawQuadrangleAlongA3DLine
void DrawQuadrangleAlongA3DLine(CByteImage *pImage, Vec3d vStart, Vec3d vEnd, float fWidthAtStart, float fWidthAtEnd)
Definition: HandModelVisualizer.cpp:879
visionx::CHandModelVisualizer
Definition: HandModelVisualizer.h:43
visionx::CHandModelVisualizer::m_pStereoCalibration
CStereoCalibration * m_pStereoCalibration
Definition: HandModelVisualizer.h:90
visionx::CHandModelVisualizer::UpdateHandModel
void UpdateHandModel(double *pConfig, bool bUpdateOpenInventorModel=true, bool bDrawCylinderInHand=false)
Definition: HandModelVisualizer.cpp:88
visionx::CHandModelVisualizer::~CHandModelVisualizer
~CHandModelVisualizer()
Definition: HandModelVisualizer.cpp:75
armarx::red
QColor red()
Definition: StyleSheets.h:76
visionx::CHandModelVisualizer::DrawPolygonGrayscale
void DrawPolygonGrayscale(CByteImage *pImage, ConvexPolygonCalculations::Polygon &pPolygon)
Definition: HandModelVisualizer.cpp:329
visionx::CHandModelVisualizer::ConfigureMoveMasterModel
void ConfigureMoveMasterModel(double *pConfig, bool bDrawCylinderInHand)
Definition: HandModelVisualizer.cpp:102
visionx::CHandModelVisualizer::ExtractAnglesFromRotationMatrix
void ExtractAnglesFromRotationMatrix(const Mat3d &mat, Vec3d &angles)
Definition: HandModelVisualizer.cpp:941
visionx::CHandModelVisualizer::DrawPolygon
void DrawPolygon(CByteImage *pImage, ConvexPolygonCalculations::Polygon &pPolygon)
Definition: HandModelVisualizer.cpp:244
visionx::CHandModelVisualizer::CHandModelVisualizer
CHandModelVisualizer(CStereoCalibration *pCalibration, bool bUseLeftCamera=true)
Definition: HandModelVisualizer.cpp:40
visionx::CHandModelVisualizer::m_fPrincipalPointY
float m_fPrincipalPointY
Definition: HandModelVisualizer.h:94
visionx::CHandModelVisualizer::DrawHandModelV2
void DrawHandModelV2(CByteImage *pImage, bool bLeftCameraImage=true)
Definition: HandModelVisualizer.cpp:490
visionx::CHandModelVisualizer::m_pMoveMaster
CMoveMasterModel * m_pMoveMaster
Definition: HandModelVisualizer.h:88
visionx::CHandModelVisualizer::m_pHandModelV2
CHandModelV2 * m_pHandModelV2
Definition: HandModelVisualizer.h:87
armarx::green
QColor green()
Definition: StyleSheets.h:72
visionx::CHandModelVisualizer::DrawCross
static void DrawCross(CByteImage *pGreyImage, int x, int y, int nBrightness)
Definition: HandModelVisualizer.cpp:785