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 "Calibration/Calibration.h"
34 #include "Calibration/StereoCalibration.h"
35 #include "Image/ByteImage.h"
36 
37 // movemaster
38 #include "MoveMasterModel.h"
39 
40 namespace visionx
41 {
43  {
44  public:
45  // constructor
46  CHandModelVisualizer(CStereoCalibration* pCalibration, bool bUseLeftCamera = true);
47 
48  // destructor
50 
51 
52  // update the hand configuration
53  void UpdateHandModel(double* pConfig,
54  bool bUpdateOpenInventorModel = true,
55  bool bDrawCylinderInHand = false);
56 
57 
58  // draw fingertips into an image
59  void DrawFingertips(CByteImage* pImage);
60 
61  // draw simple hand model for PF
62  void DrawHandModelV2(CByteImage* pImage, bool bLeftCameraImage = true);
63 
64  // draw hand into an image
65  void DrawHand(CByteImage* pImage);
66 
67  // draw segmented image with hand/object/background regions
68  void DrawSegmentedImage(CByteImage* pImage, bool bUseOpenInventorModel = true);
69  void DrawSegmentedImageWithoutOpenInventor(CByteImage* pSegmentedImage);
70 
71  // draw a +
72  static void DrawCross(CByteImage* pGreyImage, int x, int y, int nBrightness);
73  static void DrawCross(CByteImage* pColorImage, int x, int y, int r, int g, int b);
74 
75 
76  static void DrawLineIntoImage(CByteImage* pImage,
77  int x1,
78  int y1,
79  int x2,
80  int y2,
81  int red,
82  int green,
83  int blue);
84 
85 
86  //void OutputProjectionImage(CByteImage* pImage, bool write_to_file=false);
87  //void OutputProjectionImagePolygon(CByteImage* pImage, bool write_to_file=false);
88  //void PaintPolygon(CByteImage* pImage, Polygon* pol);
89  //void PaintLineSequence(Vec3d linePoints[], int nPoints, CByteImage* pImage);
90 
91 
92  private:
93  public: //TODO: make private again
96 
97  CStereoCalibration* m_pStereoCalibration;
102 
103 
104  void DrawPolygon(CByteImage* pImage, ConvexPolygonCalculations::Polygon& pPolygon);
105  void DrawPolygonGrayscale(CByteImage* pImage, ConvexPolygonCalculations::Polygon& pPolygon);
106 
107  void DrawQuadrangleAlongA3DLine(CByteImage* pImage,
108  Vec3d vStart,
109  Vec3d vEnd,
110  float fWidthAtStart,
111  float fWidthAtEnd);
112 
113  void ConfigureMoveMasterModel(double* pConfig, bool bDrawCylinderInHand);
114 
115  void ExtractAnglesFromRotationMatrix(const Mat3d& mat, Vec3d& angles);
116  };
117 } // namespace visionx
visionx::CHandModelV2
Definition: HandModelV2.h:36
GfxTL::Vec3d
VectorXD< 3, double > Vec3d
Definition: VectorXD.h:737
MoveMasterModel.h
visionx
ArmarX headers.
Definition: OpenPoseStressTest.h:38
visionx::CMoveMasterModel
Definition: MoveMasterModel.h:32
visionx::ConvexPolygonCalculations::Polygon
Definition: Polygon.h:32
visionx::CHandModelVisualizer::m_fFocalLengthY
float m_fFocalLengthY
Definition: HandModelVisualizer.h:99
visionx::CHandModelVisualizer::m_fFocalLengthX
float m_fFocalLengthX
Definition: HandModelVisualizer.h:98
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:882
visionx::CHandModelVisualizer::DrawHand
void DrawHand(CByteImage *pImage)
Definition: HandModelVisualizer.cpp:600
visionx::CHandModelVisualizer::m_fPrincipalPointX
float m_fPrincipalPointX
Definition: HandModelVisualizer.h:100
visionx::CHandModelVisualizer::DrawSegmentedImageWithoutOpenInventor
void DrawSegmentedImageWithoutOpenInventor(CByteImage *pSegmentedImage)
Definition: HandModelVisualizer.cpp:750
visionx::CHandModelVisualizer::DrawSegmentedImage
void DrawSegmentedImage(CByteImage *pImage, bool bUseOpenInventorModel=true)
Definition: HandModelVisualizer.cpp:654
visionx::CHandModelVisualizer::DrawQuadrangleAlongA3DLine
void DrawQuadrangleAlongA3DLine(CByteImage *pImage, Vec3d vStart, Vec3d vEnd, float fWidthAtStart, float fWidthAtEnd)
Definition: HandModelVisualizer.cpp:957
visionx::CHandModelVisualizer
Definition: HandModelVisualizer.h:42
visionx::CHandModelVisualizer::m_pStereoCalibration
CStereoCalibration * m_pStereoCalibration
Definition: HandModelVisualizer.h:97
visionx::CHandModelVisualizer::UpdateHandModel
void UpdateHandModel(double *pConfig, bool bUpdateOpenInventorModel=true, bool bDrawCylinderInHand=false)
Definition: HandModelVisualizer.cpp:94
visionx::CHandModelVisualizer::~CHandModelVisualizer
~CHandModelVisualizer()
Definition: HandModelVisualizer.cpp:84
armarx::red
QColor red()
Definition: StyleSheets.h:78
visionx::CHandModelVisualizer::DrawPolygonGrayscale
void DrawPolygonGrayscale(CByteImage *pImage, ConvexPolygonCalculations::Polygon &pPolygon)
Definition: HandModelVisualizer.cpp:334
visionx::CHandModelVisualizer::ConfigureMoveMasterModel
void ConfigureMoveMasterModel(double *pConfig, bool bDrawCylinderInHand)
Definition: HandModelVisualizer.cpp:109
visionx::CHandModelVisualizer::ExtractAnglesFromRotationMatrix
void ExtractAnglesFromRotationMatrix(const Mat3d &mat, Vec3d &angles)
Definition: HandModelVisualizer.cpp:1025
visionx::CHandModelVisualizer::DrawPolygon
void DrawPolygon(CByteImage *pImage, ConvexPolygonCalculations::Polygon &pPolygon)
Definition: HandModelVisualizer.cpp:248
visionx::CHandModelVisualizer::CHandModelVisualizer
CHandModelVisualizer(CStereoCalibration *pCalibration, bool bUseLeftCamera=true)
Definition: HandModelVisualizer.cpp:38
visionx::CHandModelVisualizer::m_fPrincipalPointY
float m_fPrincipalPointY
Definition: HandModelVisualizer.h:101
visionx::CHandModelVisualizer::DrawHandModelV2
void DrawHandModelV2(CByteImage *pImage, bool bLeftCameraImage=true)
Definition: HandModelVisualizer.cpp:497
visionx::CHandModelVisualizer::m_pMoveMaster
CMoveMasterModel * m_pMoveMaster
Definition: HandModelVisualizer.h:95
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:27
visionx::CHandModelVisualizer::m_pHandModelV2
CHandModelV2 * m_pHandModelV2
Definition: HandModelVisualizer.h:94
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:851