Swissranger.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 
23 
24 #ifndef __IPA_SWISSRANGER_H__
25 #define __IPA_SWISSRANGER_H__
26 
27 #include "StdAfx.h"
28 
29 // Windows
30 #ifdef _WIN32
31  // Windows with MinGW
32  #ifdef __MINGW__
33  typedef short __wchar_t;
34  #endif
35 #endif
36 
37 // Linux
38 #ifdef __LINUX__
39 typedef unsigned long DWORD;
40 #endif
41 
42 #ifdef __LINUX__
44 #else
46 #endif
47 
48 #include <stdio.h>
49 #include <math.h>
50 #include <sstream>
51 #include <assert.h>
52 #include <libMesaSR.h>
53 
54 namespace ipa_CameraSensors {
55 
56 // former SR31Consts.h entries
57 #define SAFE_FREE(p) { if(p) { delete (p); (p)=0; } }
58 #define SWISSRANGER_COLUMNS 176
59 #define SWISSRANGER_ROWS 144
60 
67 int LibMesaCallback(SRCAM srCam, unsigned int msg, unsigned int param, void* data);
68 
74 {
75 public:
76 
77  Swissranger();
78  ~Swissranger();
79 
80  //*******************************************************************************
81  // AbstractRangeImagingSensor interface implementation
82  //*******************************************************************************
83 
84  unsigned long Init(std::string directory, int cameraIndex = 0);
85 
86  unsigned long Open();
87  unsigned long Close();
88 
89  unsigned long SetProperty(t_cameraProperty* cameraProperty);
90  unsigned long SetPropertyDefaults();
91  unsigned long GetProperty(t_cameraProperty* cameraProperty);
92 
93  unsigned long AcquireImages(int widthStepRange, int widthStepGray, int widthStepCartesian, char* RangeImage=NULL, char* IntensityImage=NULL,
94  char* cartesianImage=NULL, bool getLatestFrame=true, bool undistort=true,
95  ipa_CameraSensors::t_ToFGrayImageType grayImageType = ipa_CameraSensors::INTENSITY_32F1);
96  unsigned long AcquireImages(cv::Mat* rangeImage = 0, cv::Mat* grayImage = 0,
97  cv::Mat* cartesianImage = 0, bool getLatestFrame = true, bool undistort = true,
98  ipa_CameraSensors::t_ToFGrayImageType grayImageType = ipa_CameraSensors::INTENSITY_32F1);
99 
100  unsigned long SaveParameters(const char* filename);
101 
102  bool isInitialized() {return m_initialized;}
103  bool isOpen() {return m_open;}
104 
105 private:
106  //*******************************************************************************
107  // Camera specific members
108  //*******************************************************************************
109 
110  unsigned long GetCalibratedZMatlab(int u, int v, float zRaw, float& zCalibrated);
111  unsigned long GetCalibratedZSwissranger(int u, int v, int width, float& zCalibrated);
112  unsigned long GetCalibratedXYMatlab(int u, int v, float z, float& x, float& y);
113  unsigned long GetCalibratedXYSwissranger(int u, int v, int width, float& x, float& y);
114 
120  unsigned long LoadParameters(const char* filename, int cameraIndex);
121 
125  unsigned long SetParameters();
126 
127  SRCAM m_SRCam;
129  ImgEntry* m_DataBuffer;
130 
131  // Stores for cartesian data, when native swissranger calibration is used
135 
138 
143  cv::Mat m_CoeffsA0;
144  cv::Mat m_CoeffsA1;
145  cv::Mat m_CoeffsA2;
146  cv::Mat m_CoeffsA3;
147  cv::Mat m_CoeffsA4;
148  cv::Mat m_CoeffsA5;
149  cv::Mat m_CoeffsA6;
150 };
151 
155 
156 } // End namespace ipa_CameraSensors
157 #endif // __IPA_SWISSRANGER_H__
158 
159 
bool m_CoeffsInitialized
True, when m_CoeffsAx have been initialized.
Definition: Swissranger.h:136
cv::Mat m_CoeffsA1
a1 z-calibration parameters. One matrix entry corresponds to one pixel
Definition: Swissranger.h:144
cv::Mat m_CoeffsA2
a2 z-calibration parameters. One matrix entry corresponds to one pixel
Definition: Swissranger.h:145
cv::Mat m_CoeffsA4
a4 z-calibration parameters. One matrix entry corresponds to one pixel
Definition: Swissranger.h:147
bool m_GrayImageAcquireCalled
Is false, when acquiring gray image has not been called, yet.
Definition: Swissranger.h:137
static const int SWISSRANGER_ROWS
cv::Mat m_CoeffsA5
a5 z-calibration parameters. One matrix entry corresponds to one pixel
Definition: Swissranger.h:148
SRCAM m_SRCam
Handle to USB SR3000 camera.
Definition: Swissranger.h:127
cv::Mat m_CoeffsA0
a0 z-calibration parameters. One matrix entry corresponds to one pixel
Definition: Swissranger.h:143
cv::Mat m_CoeffsA6
a6 z-calibration parameters. One matrix entry corresponds to one pixel
Definition: Swissranger.h:149
static const int SWISSRANGER_COLUMNS
cv::Mat m_CoeffsA3
a3 z-calibration parameters. One matrix entry corresponds to one pixel
Definition: Swissranger.h:146
__DLL_LIBCAMERASENSORS__ AbstractRangeImagingSensorPtr CreateRangeImagingSensor_Swissranger()
Definition: Swissranger.cpp:31
int m_NumOfImages
Number of images the siwssranger returns (i.e. an intensity and a range image)
Definition: Swissranger.h:128
ImgEntry * m_DataBuffer
Image array.
Definition: Swissranger.h:129
#define __DLL_LIBCAMERASENSORS__
int LibMesaCallback(SRCAM srCam, unsigned int msg, unsigned int param, void *data)
Definition: Swissranger.cpp:57


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