74 cameraImages =
new CByteImage*[2];
78 resultImages =
new CByteImage*[numResultImages];
80 for (
int i = 0; i < numResultImages; i++)
86 StereoCalibrationProviderInterfacePrx calibrationProviderPrx =
87 StereoCalibrationProviderInterfacePrx::checkedCast(imageProviderPrx);
89 if (!calibrationProviderPrx)
91 ARMARX_ERROR <<
"Image provider with name " << providerName
92 <<
" is not a StereoCalibrationProvider" << std::endl;
121 int nNumberImages =
getImages(cameraImages);
126 armarx::PosePtr::dynamicCast(robotStateProxy->getSynchronizedRobot()
127 ->getRobotNode(handFrameName)
128 ->getPoseInRootFrame());
129 Eigen::Matrix4f handNodePose = handNodePosePtr->toEigen();
131 armarx::PosePtr::dynamicCast(robotStateProxy->getSynchronizedRobot()
132 ->getRobotNode(cameraFrameName)
133 ->getPoseInRootFrame());
134 Eigen::Matrix4f cameraNodePose = cameraNodePosePtr->toEigen();
135 Eigen::Matrix4f handPoseInCameraFrame = cameraNodePose.inverse() * handNodePose;
136 Vec3d handNodePosition = {handPoseInCameraFrame(0, 3),
137 handPoseInCameraFrame(1, 3),
138 handPoseInCameraFrame(2, 3)};
139 Mat3d handNodeOrientation = {handPoseInCameraFrame(0, 0),
140 handPoseInCameraFrame(0, 1),
141 handPoseInCameraFrame(0, 2),
142 handPoseInCameraFrame(1, 0),
143 handPoseInCameraFrame(1, 1),
144 handPoseInCameraFrame(1, 2),
145 handPoseInCameraFrame(2, 0),
146 handPoseInCameraFrame(2, 1),
147 handPoseInCameraFrame(2, 2)};
151 double* fingerConfig =
new double[6];
152 fingerConfig[0] = 90 *
M_PI / 180;
153 fingerConfig[1] = 25 *
M_PI / 180;
154 fingerConfig[2] = 15 *
M_PI / 180;
155 fingerConfig[3] = 10 *
M_PI / 180;
156 fingerConfig[4] = 5 *
M_PI / 180;
157 fingerConfig[5] = 5 *
M_PI / 180;
161 double* estimatedConfig =
new double[12];
162 double confidenceRating;
163 handLocalization->LocaliseHand(cameraImages[0],
172 ::ImageProcessor::CopyImage(cameraImages[0], resultImages[0]);
173 ::ImageProcessor::CopyImage(cameraImages[0], resultImages[1]);
174 ::ImageProcessor::CopyImage(cameraImages[0], resultImages[2]);
175 ::ImageProcessor::Zero(resultImages[3]);
177 double* localizationResult = handLocalization->GetResultConfig();
178 handModelVisualizer->UpdateHandModel(localizationResult,
179 drawComplexHandModelInResultImage);
180 delete[] localizationResult;
181 handModelVisualizer->DrawHandModelV2(resultImages[1]);
182 handModelVisualizer->DrawHand(resultImages[2]);
183 handModelVisualizer->DrawSegmentedImage(resultImages[3]);
206 visionx::FramedPositionBaseList ret;
207 std::vector<Vec3d> fingertipPositions = handLocalization->GetFingertipPositions();
209 for (
size_t i = 0; i < fingertipPositions.size(); i++)
211 Eigen::Vector3f position;
212 position << fingertipPositions.at(i).x, fingertipPositions.at(i).y,
213 fingertipPositions.at(i).z;
215 position, cameraFrameName, robotStateProxy->getSynchronizedRobot()->getName());