WebCamImageProvider.h
Go to the documentation of this file.
1/*
2 * This file is part of ArmarX.
3 *
4 * Copyright (C) 2011-2017, 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 ArmarX
19 * @author Mirko Waechter( mirko.waechter at kit dot edu)
20 * @date 2017
21 * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
22 * GNU General Public License
23 */
24#pragma once
25
26#include <opencv2/highgui/highgui.hpp>
27
29#include <VisionX/interface/components/Calibration.h>
30
31namespace visionx
32{
34 {
35 public:
38 {
40 "DeviceNumber",
41 0,
42 "Number of the ID as it openCV expects (usually 0 if only one device exists).");
43 defineOptionalProperty<float>("FPS", 30.0f, "If not set, FPS is limited by device.");
44
46 ImageDimension(0, 0),
47 "Image resolution. If not set, maximum is used.")
48 .setCaseInsensitive(true)
49 .map("320x240", ImageDimension(320, 240))
50 .map("640x480", ImageDimension(640, 480))
51 .map("800x600", ImageDimension(800, 600))
52 .map("768x576", ImageDimension(768, 576))
53 .map("1024x768", ImageDimension(1024, 768))
54 .map("1280x720", ImageDimension(1280, 960))
55 .map("1280x960", ImageDimension(1280, 960))
56 .map("1280x1024", ImageDimension(1280, 960))
57 .map("1600x1200", ImageDimension(1600, 1200))
58 .map("1920x1080", ImageDimension(1920, 1080))
59 .map("1920x1200", ImageDimension(1920, 1200))
60 .map("none", ImageDimension(0, 0));
61 }
62 };
63
65 // public MonocularCalibrationCapturingProviderInterface,
67 {
68 public:
70
71 static std::string GetDefaultName();
72 // ManagedIceObject interface
73 protected:
74 std::string getDefaultName() const override;
75
76 // CapturingImageProviderInterface interface
77 public:
78 // CapturingImageProvider interface
79 protected:
80 void onInitCapturingImageProvider() override;
81 void onExitCapturingImageProvider() override;
82 bool capture(void** ppImageBuffers) override;
83 cv::VideoCapture capturer;
84 cv::Mat image;
85
86 // CapturingImageProvider interface
87 protected:
88 void onStartCapture(float framesPerSecond) override;
89 void onStopCapture() override;
90
91 // PropertyUser interface
92 public:
94
95 // MonocularCalibrationCapturingProviderInterface interface
96 public:
97 MonocularCalibration getCalibration(const Ice::Current&);
98 std::vector<ImageDimension> getSupportedResolutions(cv::VideoCapture& camera);
99 std::vector<imrec::ChannelPreferences>
100 getImageRecordingChannelPreferences(const Ice::Current&) override;
101
102 protected:
103 MonocularCalibration calibration;
104 };
105
106} // namespace visionx
Default component property definition container.
Definition Component.h:70
ComponentPropertyDefinitions(std::string prefix, bool hasObjectNameParameter=true)
Definition Component.cpp:46
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)
The CapturingImageProvider provides a callback function to trigger the capturing of images with diffe...
std::vector< ImageDimension > getSupportedResolutions(cv::VideoCapture &camera)
MonocularCalibration getCalibration(const Ice::Current &)
void onStartCapture(float framesPerSecond) override
This is called when the image provider capturing has been started.
armarx::PropertyDefinitionsPtr createPropertyDefinitions() override
void onStopCapture() override
This is called when the image provider capturing has been stopped.
void onExitCapturingImageProvider() override
This is called when the Component::onExitComponent() setup is called.
std::vector< imrec::ChannelPreferences > getImageRecordingChannelPreferences(const Ice::Current &) override
void onInitCapturingImageProvider() override
This is called when the Component::onInitComponent() is called.
std::string getDefaultName() const override
Retrieve default name of component.
IceUtil::Handle< class PropertyDefinitionContainer > PropertyDefinitionsPtr
PropertyDefinitions smart pointer type.
ArmarX headers.