StereoCameraProvider.cpp
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 Jan Issac (jan dot issac at gmx dot net)
20  * @date 2011
21  * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
22  * GNU General Public License
23  */
24 
25 #include "StereoCameraProvider.h"
26 
27 #include <iostream>
28 #include <string>
29 #include <vector>
30 
31 // VisionXTools
33 
34 // IVT
35 #include <Calibration/Calibration.h>
36 
39 
41 
43 {
45 
46  using namespace armarx;
47  using namespace visionx;
48  using namespace visionx::tools;
49 
50  // verify number of cameras
51 
52  if (ieee1394Capturer->GetNumberOfCameras() != 2)
53  {
55  ieee1394Capturer->GetNumberOfCameras());
56  }
57 
58  std::string calibrationFileName = getProperty<std::string>("CalibrationFile") .getValue();
59  if (!armarx::ArmarXDataPath::getAbsolutePath(calibrationFileName, calibrationFileName))
60  {
62  }
63  bool transformLeftCameraToIdentity = getProperty<bool>("LeftCameraAsIdentity") .getValue();
64 
65  if (!ivtStereoCalibration.LoadCameraParameters(calibrationFileName.c_str(), transformLeftCameraToIdentity))
66  {
68  }
69 
70  stereoCalibration = visionx::tools::convert(ivtStereoCalibration);
71 }
72 
73 
74 visionx::StereoCalibration visionx::StereoCameraProvider::getStereoCalibration(const Ice::Current& c)
75 {
76  return stereoCalibration;
77 }
visionx::exceptions::local::LoadingCalibrationFileFailedException
Definition: LoadingCalibrationFileFailedException.h:33
visionx::tools
Definition: PCLUtilities.cpp:4
visionx
ArmarX headers.
Definition: OpenPoseStressTest.h:38
LoadingCalibrationFileFailedException.h
c
constexpr T c
Definition: UnscentedKalmanFilterTest.cpp:43
StereoCameraSystemRequiredException.h
visionx::tools::convert
CByteImage::ImageType convert(const ImageType visionxImageType)
Converts a VisionX image type into an image type of IVT's ByteImage.
Definition: TypeMapping.cpp:95
visionx::StereoCameraProvider::getStereoCalibration
visionx::StereoCalibration getStereoCalibration(const Ice::Current &c=Ice::emptyCurrent) override
Part of visionx::StereoCalibrationProvider interface.
Definition: StereoCameraProvider.cpp:74
visionx::IEEE1394ImageProvider::ieee1394Capturer
CLinux1394CaptureThreaded2 * ieee1394Capturer
IEEE1394 Capture.
Definition: IEEE1394ImageProvider.h:251
visionx::StereoCameraProvider::onInitCapturingImageProvider
void onInitCapturingImageProvider() override
Definition: StereoCameraProvider.cpp:42
TypeMapping.h
armarx::ArmarXDataPath::getAbsolutePath
static bool getAbsolutePath(const std::string &relativeFilename, std::string &storeAbsoluteFilename, const std::vector< std::string > &additionalSearchPaths={}, bool verbose=true)
Definition: ArmarXDataPath.cpp:111
visionx::IEEE1394ImageProvider::onInitCapturingImageProvider
void onInitCapturingImageProvider() override
Definition: IEEE1394ImageProvider.cpp:45
visionx::exceptions::local::StereoCameraSystemRequiredException
Definition: StereoCameraSystemRequiredException.h:34
ArmarXDataPath.h
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28
StereoCameraProvider.h