VirtualRangeCam.h
Go to the documentation of this file.
1 /*
2  * Copyright 2017 Fraunhofer Institute for Manufacturing Engineering and Automation (IPA)
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9 
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 
22 
23 #ifndef __IPA_VIRTUALRANGECAM_H__
24 #define __IPA_VIRTUALRANGECAM_H__
25 
26 #include "StdAfx.h"
27 
28 #ifdef __LINUX__
30 #else
32 #endif
33 
34 #include <stdio.h>
35 #include <math.h>
36 #include <assert.h>
37 #include <sstream>
38 
39 #include <boost/filesystem.hpp>
40 
41 namespace ipa_CameraSensors {
42 
43 static const int SWISSRANGER_COLUMNS = 176;
44 static const int SWISSRANGER_ROWS = 144;
45 
51 {
52 public:
53 
55  ~VirtualRangeCam();
56 
57  //*******************************************************************************
58  // AbstractRangeImagingSensor interface implementation
59  //*******************************************************************************
60 
61  unsigned long Init(std::string directory, int cameraIndex = 0);
62 
63  unsigned long Open();
64  unsigned long Close();
65 
66  unsigned long SetProperty(t_cameraProperty* cameraProperty);
67  unsigned long SetPropertyDefaults();
68  unsigned long GetProperty(t_cameraProperty* cameraProperty);
69 
70  unsigned long AcquireImages(int widthStepRange, int widthStepGray, int widthStepCartesian, char* rangeImage=NULL, char* intensityImage=NULL,
71  char* cartesianImage=NULL, bool getLatestFrame=true, bool undistort=true,
72  ipa_CameraSensors::t_ToFGrayImageType grayImageType = ipa_CameraSensors::INTENSITY_32F1);
73  unsigned long AcquireImages(cv::Mat* rangeImage = 0, cv::Mat* intensityImage = 0,
74  cv::Mat* cartesianImage = 0, bool getLatestFrame = true, bool undistort = true,
75  ipa_CameraSensors::t_ToFGrayImageType grayImageType = ipa_CameraSensors::INTENSITY_32F1);
76 
77  unsigned long GetCalibratedUV(double x, double y, double z, double& u, double& v);
78 
79  unsigned long SaveParameters(const char* filename);
80 
81  bool isInitialized() {return m_initialized;}
82  bool isOpen() {return m_open;}
83 
86  int GetNumberOfImages();
87 
92  unsigned long SetPathToImages(std::string path);
93 
94 private:
95  //*******************************************************************************
96  // Camera specific members
97  //*******************************************************************************
98 
101  inline void UpdateImageDimensionsOnFirstImage(std::string filename, std::string ext=".xml");
102 
107  inline void FindSourceImageFormat(std::map<std::string, int>::iterator& itCounter, std::string& ext);
108 
109  unsigned long GetCalibratedZMatlab(int u, int v, float zRaw, float& zCalibrated);
110  unsigned long GetCalibratedXYMatlab(int u, int v, float z, float& x, float& y);
111 
117  unsigned long LoadParameters(const char* filename, int cameraIndex);
118 
120 
125  cv::Mat m_CoeffsA0;
126  cv::Mat m_CoeffsA1;
127  cv::Mat m_CoeffsA2;
128  cv::Mat m_CoeffsA3;
129  cv::Mat m_CoeffsA4;
130  cv::Mat m_CoeffsA5;
131  cv::Mat m_CoeffsA6;
132 
133  std::string m_CameraDataDirectory;
135 
136  std::vector<std::string> m_AmplitudeImageFileNames;
137  std::vector<std::string> m_IntensityImageFileNames;
138  std::vector<std::string> m_RangeImageFileNames ;
139  std::vector<std::string> m_CoordinateImageFileNames ;
140 
143 
144  double m_k1, m_k2, m_p1, m_p2;
145 };
146 
150 
151 } // end namespace ipa_CameraSensors
152 #endif // __IPA_VIRTUALRANGECAM_H__
153 
154 
std::vector< std::string > m_AmplitudeImageFileNames
cv::Mat m_CoeffsA4
a4 z-calibration parameters. One matrix entry corresponds to one pixel
cv::Mat m_CoeffsA3
a3 z-calibration parameters. One matrix entry corresponds to one pixel
__DLL_LIBCAMERASENSORS__ AbstractRangeImagingSensorPtr CreateRangeImagingSensor_VirtualCam()
static const int SWISSRANGER_ROWS
std::vector< std::string > m_IntensityImageFileNames
cv::Mat m_CoeffsA0
a0 z-calibration parameters. One matrix entry corresponds to one pixel
cv::Mat m_CoeffsA6
a6 z-calibration parameters. One matrix entry corresponds to one pixel
static const int SWISSRANGER_COLUMNS
cv::Mat m_CoeffsA2
a2 z-calibration parameters. One matrix entry corresponds to one pixel
cv::Mat m_CoeffsA1
a1 z-calibration parameters. One matrix entry corresponds to one pixel
cv::Mat m_CoeffsA5
a5 z-calibration parameters. One matrix entry corresponds to one pixel
int m_CameraIndex
Index of the specified camera. Important, when several cameras of the same type are present...
double m_p2
Distortion parameters.
std::vector< std::string > m_CoordinateImageFileNames
std::vector< std::string > m_RangeImageFileNames
std::string m_CameraDataDirectory
Directory where the image data resides.
#define __DLL_LIBCAMERASENSORS__


cob_camera_sensors
Author(s): Jan Fischer , Richard Bormann
autogenerated on Thu Mar 19 2020 03:23:05