FlyCaptureImageProvider.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::ArmarXObjects::FlyCaptureImageProvider
19 * @author Markus Grotz ( markus dot grotz at kit dot edu )
20 * @date 2015
21 * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
22 * GNU General Public License
23 */
24
25#pragma once
26
27
29
31#include <VisionX/interface/components/Calibration.h>
32
33#include <Calibration/Rectification.h>
34#include <Calibration/Undistortion.h>
35#include <Image/ImageProcessor.h>
36#include <flycapture/FlyCapture2.h>
37
38namespace armarx
39{
40
41 /**
42 * @class FlyCaptureImageProviderPropertyDefinitions
43 * @brief
44 */
46 {
47 public:
50 {
52 "serialNumbers", "10121969 10121966 10121963 10121968", "camera serial numbers");
53
54 defineRequiredProperty<std::string>("CalibrationFile", "Camera calibration file");
55
57 "dimensions", visionx::ImageDimension(1600, 1200), "")
58 .map("640x480", visionx::ImageDimension(640, 480))
59 .map("1600x1200", visionx::ImageDimension(1600, 1200));
60
61 defineOptionalProperty<float>("FrameRate", 7.5f, "Frames per second")
62 .setMatchRegex("\\d+(.\\d*)?")
63 .setMin(0.0f)
64 .setMax(60.0f);
65
67 "UndistortImages", true, "Perform undistortion of the images.");
69 "RectifyImages", true, "Perform rectification of the images.");
70
72 "ReferenceFrameName", "EyeLeftCamera", "Optional reference frame name.");
73
75 "Exposure",
76 300,
77 "Exposure value. Negative values can be used to enable auto exposure.");
79 "Shutter", 20, "Shutter value. Negative values can be used to enable auto mode.");
81 "Gain", 0.0, "Gain value. Negative values can be used to enable auto mode.");
82 }
83 };
84
85 /**
86 * @class FlyCaptureImageProvider
87 *
88 * @ingroup VisionX-Components
89 * @brief A brief description
90 *
91 *
92 * Detailed Description
93 */
95 {
96 public:
97 /**
98 * @see armarx::ManagedIceObject::getDefaultName()
99 */
100 std::string
101 getDefaultName() const override
102 {
103 return "FlyCaptureImageProvider";
104 }
105
106 protected:
107 void onInitCapturingImageProvider() override;
108
109 void onExitCapturingImageProvider() override;
110
111 void onStartCapture(float frameRate) override;
112
113 void onStopCapture() override;
114
115 bool capture(void** ppImageBuffers) override;
116
117 /**
118 * @see PropertyUser::createPropertyDefinitions()
119 */
121
122 CUndistortion* undistortion;
123 CRectification* rectification;
124
127
129
130 private:
131 FlyCapture2::BusManager busManager;
132 std::vector<FlyCapture2::Camera*> cameras;
133
134 std::vector<std::string> serialNumbers;
135
136 std::vector<FlyCapture2::Image*> colorImages;
137
138 CByteImage** cameraImages;
139 };
140
142 virtual public FlyCaptureImageProvider,
143 virtual public visionx::StereoCalibrationCaptureProviderInterface
144 {
145
146 public:
147 void onInitCapturingImageProvider() override;
148
149 visionx::StereoCalibration
150 getStereoCalibration(const Ice::Current& c = Ice::emptyCurrent) override
151 {
152 return stereoCalibration;
153 }
154
155 bool
156 getImagesAreUndistorted(const Ice::Current& c = Ice::emptyCurrent) override
157 {
158 return undistortImages;
159 }
160
161 std::string
162 getReferenceFrame(const Ice::Current& c = Ice::emptyCurrent) override
163 {
164 return getProperty<std::string>("ReferenceFrameName").getValue();
165 }
166
167
168 private:
169 visionx::StereoCalibration stereoCalibration;
170 };
171} // namespace armarx
constexpr T c
Default component property definition container.
Definition Component.h:70
ComponentPropertyDefinitions(std::string prefix, bool hasObjectNameParameter=true)
Definition Component.cpp:46
Property< PropertyType > getProperty(const std::string &name)
void onStartCapture(float frameRate) override
This is called when the image provider capturing has been started.
void onStopCapture() override
This is called when the image provider capturing has been stopped.
armarx::PropertyDefinitionsPtr createPropertyDefinitions() override
void onExitCapturingImageProvider() override
This is called when the Component::onExitComponent() setup is called.
void onInitCapturingImageProvider() override
This is called when the Component::onInitComponent() is called.
std::string getDefaultName() const override
std::string getReferenceFrame(const Ice::Current &c=Ice::emptyCurrent) override
visionx::StereoCalibration getStereoCalibration(const Ice::Current &c=Ice::emptyCurrent) override
bool getImagesAreUndistorted(const Ice::Current &c=Ice::emptyCurrent) override
void onInitCapturingImageProvider() override
This is called when the Component::onInitComponent() is called.
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)
PropertyDefinition< PropertyType > & defineRequiredProperty(const std::string &name, const std::string &description="", PropertyDefinitionBase::PropertyConstness constness=PropertyDefinitionBase::eConstant)
The CapturingImageProvider provides a callback function to trigger the capturing of images with diffe...
This file offers overloads of toIce() and fromIce() functions for STL container types.
IceUtil::Handle< class PropertyDefinitionContainer > PropertyDefinitionsPtr
PropertyDefinitions smart pointer type.