CalibrationCreator.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 VisionX::Component
19 * @author David Schiebener (schiebener at kit dot edu)
20 * @date 2014
21 * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
22 * GNU General Public License
23 */
24
25
26#pragma once
27
28#include <string>
29
30#include <opencv2/opencv.hpp>
31
32// VisionX
34
35// IVT
36#include "calibfilter.h"
37#include <Math/Math2d.h>
38#include <Math/Math3d.h>
39
40
41class CvCalibFilter;
42class CByteImage;
43
44namespace visionx
45{
46
48 {
49 public:
52 {
53 defineOptionalProperty<std::string>("ImageProviderAdapterName",
54 "ImageProvider",
55 "Ice Adapter name of the image provider");
57 "NumberOfImages", 20, "Number of images used for the calibration");
59 "WaitingIntervalBetweenImages", 500, "Waiting time between captured images, in ms");
61 "NumberOfRows", 5, "Number of rows on the calibration pattern");
63 "NumberOfColumns", 5, "Number of columns on the calibration pattern");
65 "PatternSquareSize", 30.0, "Size of the squares on the calibration pattern");
67 "OutputFileName", "cameras.txt", "Path to the file for saving the calibration");
68 }
69 };
70
71 /**
72 * CalibrationCreator determines if the robot hand is colliding with another object, causing it to move.
73 * To this end, it localizes the robot hand using the marker ball and the finger tips, calculates the optical
74 * flow in the image, clusters it, and looks for a cluster that exist solely in front of the hand.
75 *
76 * \componentproperties
77 * \prop VisionX.CalibrationCreator.ImageProviderAdapterName: Name of the
78 * image provider that delivers the camera images.
79 * \prop VisionX.CalibrationCreator.RobotStateProxyName: Name of the robot state
80 * proxy used to obtain the current robot state.
81 * \prop VisionX.CalibrationCreator.HandFrameName: Name of the frame in the robot
82 * model that corresponds to the localized hand.
83 * \prop VisionX.CalibrationCreator.CameraFrameName: Name of the robot state frame of the primary camera
84 */
86 {
87 public:
88 /**
89 * @see Component::getDefaultName()
90 */
91 std::string
92 getDefaultName() const override
93 {
94 return "CalibrationCreator";
95 }
96
97
98 protected:
99 // inherited from VisionComponent
100 void onInitImageProcessor() override;
101 void onConnectImageProcessor() override;
102 void onExitImageProcessor() override;
103
104 void process() override;
105
106 /**
107 * @see PropertyUser::createPropertyDefinitions()
108 */
115
116 private:
117 std::string providerName;
118 ImageProviderInterfacePrx imageProviderPrx;
119 CvCalibFilter* m_pCalibFilter;
120 CvPoint2D32f* m_pCorners2DFloat;
121 CvPoint2D64f* m_pCorners2D;
122 CvPoint3D64f* m_pCorners3D;
123
124 CByteImage** cameraImages;
125 int waitingIntervalBetweenImages, desiredNumberOfImages, numberOfCapturedImages;
126 std::string m_sCameraParameterFileName;
127
128 IceUtil::Time startingTime, timeOfLastCapture;
129 bool finished;
130 };
131
132} // namespace visionx
std::string getConfigIdentifier()
Retrieve config identifier for this component as set in constructor.
Definition Component.cpp:90
std::string prefix
Prefix of the properties such as namespace, domain, component name, etc.
PropertyDefinition< PropertyType > & defineOptionalProperty(const std::string &name, PropertyType defaultValue, const std::string &description="", PropertyDefinitionBase::PropertyConstness constness=PropertyDefinitionBase::eConstant)
CalibrationCreator determines if the robot hand is colliding with another object, causing it to move.
void onConnectImageProcessor() override
Implement this method in the ImageProcessor in order execute parts when the component is fully initia...
void onExitImageProcessor() override
Exit the ImapeProcessor component.
armarx::PropertyDefinitionsPtr createPropertyDefinitions() override
void process() override
Process the vision component.
void onInitImageProcessor() override
Setup the vision component.
std::string getDefaultName() const override
ImageProcessorPropertyDefinitions(std::string prefix)
The ImageProcessor class provides an interface for access to ImageProviders via Ice and shared memory...
IceUtil::Handle< class PropertyDefinitionContainer > PropertyDefinitionsPtr
PropertyDefinitions smart pointer type.
ArmarX headers.