#include <VirtualRangeCam.h>
Public Member Functions | |
unsigned long | AcquireImages (int widthStepRange, int widthStepGray, int widthStepCartesian, char *rangeImage=NULL, char *intensityImage=NULL, char *cartesianImage=NULL, bool getLatestFrame=true, bool undistort=true, ipa_CameraSensors::t_ToFGrayImageType grayImageType=ipa_CameraSensors::INTENSITY_32F1) |
unsigned long | AcquireImages (cv::Mat *rangeImage=0, cv::Mat *intensityImage=0, cv::Mat *cartesianImage=0, bool getLatestFrame=true, bool undistort=true, ipa_CameraSensors::t_ToFGrayImageType grayImageType=ipa_CameraSensors::INTENSITY_32F1) |
unsigned long | Close () |
unsigned long | GetCalibratedUV (double x, double y, double z, double &u, double &v) |
int | GetNumberOfImages () |
unsigned long | GetProperty (t_cameraProperty *cameraProperty) |
unsigned long | Init (std::string directory, int cameraIndex=0) |
bool | isInitialized () |
bool | isOpen () |
unsigned long | Open () |
unsigned long | SaveParameters (const char *filename) |
unsigned long | SetPathToImages (std::string path) |
unsigned long | SetProperty (t_cameraProperty *cameraProperty) |
unsigned long | SetPropertyDefaults () |
VirtualRangeCam () | |
~VirtualRangeCam () | |
Public Member Functions inherited from ipa_CameraSensors::AbstractRangeImagingSensor | |
virtual t_CalibrationMethod | GetCalibrationMethod () |
virtual t_cameraType | GetCameraType () |
virtual unsigned long | SetIntrinsics (cv::Mat &intrinsicMatrix, cv::Mat &undistortMapX, cv::Mat &undistortMapY) |
virtual | ~AbstractRangeImagingSensor () |
Destructor. More... | |
Private Member Functions | |
void | FindSourceImageFormat (std::map< std::string, int >::iterator &itCounter, std::string &ext) |
unsigned long | GetCalibratedXYMatlab (int u, int v, float z, float &x, float &y) |
unsigned long | GetCalibratedZMatlab (int u, int v, float zRaw, float &zCalibrated) |
unsigned long | LoadParameters (const char *filename, int cameraIndex) |
void | UpdateImageDimensionsOnFirstImage (std::string filename, std::string ext=".xml") |
Private Attributes | |
std::vector< std::string > | m_AmplitudeImageFileNames |
std::string | m_CameraDataDirectory |
Directory where the image data resides. More... | |
int | m_CameraIndex |
Index of the specified camera. Important, when several cameras of the same type are present. More... | |
cv::Mat | m_CoeffsA0 |
a0 z-calibration parameters. One matrix entry corresponds to one pixel More... | |
cv::Mat | m_CoeffsA1 |
a1 z-calibration parameters. One matrix entry corresponds to one pixel More... | |
cv::Mat | m_CoeffsA2 |
a2 z-calibration parameters. One matrix entry corresponds to one pixel More... | |
cv::Mat | m_CoeffsA3 |
a3 z-calibration parameters. One matrix entry corresponds to one pixel More... | |
cv::Mat | m_CoeffsA4 |
a4 z-calibration parameters. One matrix entry corresponds to one pixel More... | |
cv::Mat | m_CoeffsA5 |
a5 z-calibration parameters. One matrix entry corresponds to one pixel More... | |
cv::Mat | m_CoeffsA6 |
a6 z-calibration parameters. One matrix entry corresponds to one pixel More... | |
bool | m_CoeffsInitialized |
std::vector< std::string > | m_CoordinateImageFileNames |
int | m_ImageHeight |
Image height. More... | |
int | m_ImageWidth |
Image width. More... | |
std::vector< std::string > | m_IntensityImageFileNames |
double | m_k1 |
double | m_k2 |
double | m_p1 |
double | m_p2 |
Distortion parameters. More... | |
std::vector< std::string > | m_RangeImageFileNames |
Additional Inherited Members | |
Public Attributes inherited from ipa_CameraSensors::AbstractRangeImagingSensor | |
unsigned int | m_ImageCounter |
Holds the index of the image that is extracted during the next call of AcquireImages More... | |
Protected Attributes inherited from ipa_CameraSensors::AbstractRangeImagingSensor | |
unsigned int | m_BufferSize |
Number of images, the camera buffers internally. More... | |
t_CalibrationMethod | m_CalibrationMethod |
Calibration method MATLAB, MATLAB_NO_Z or SWISSRANGER. More... | |
t_cameraType | m_CameraType |
Camera Type. More... | |
bool | m_initialized |
True, when the camera has sucessfully been initialized. More... | |
cv::Mat | m_intrinsicMatrix |
Intrinsic parameters [fx 0 cx; 0 fy cy; 0 0 1]. More... | |
bool | m_open |
True, when the camera has sucessfully been opend. More... | |
t_RangeCameraParameters | m_RangeCameraParameters |
Storage for xml configuration file parmeters. More... | |
cv::Mat | m_undistortMapX |
The output array of x coordinates for the undistortion map. More... | |
cv::Mat | m_undistortMapY |
The output array of Y coordinates for the undistortion map. More... | |
Interface class to virtual range camera like Swissranger 3000/4000. The class offers an interface to a virtual range camera, that is equal to the interface of a real range camera. However, pictures are read from a directory instead of the camera.
Definition at line 50 of file VirtualRangeCam.h.
VirtualRangeCam::VirtualRangeCam | ( | ) |
Definition at line 40 of file VirtualRangeCam.cpp.
VirtualRangeCam::~VirtualRangeCam | ( | ) |
Definition at line 51 of file VirtualRangeCam.cpp.
|
virtual |
Acquires an image from SwissRanger. This implementation is designated for people that do not use openCV image type.
widthStepRange | The stride of a row from the range image. |
widthStepGray | The stride of a row from the grayscale intensity image. |
widthStepCartesian | The stride of a row from the cartesian image. |
rangeImage | character array with depth information. |
grayImage | character array with intensity (grayscale) information. |
cartesianImage | character array with cartesian (x,y,z) information in meters. |
getLatestFrame | Set true to acquire a new image on calling instead of returning the one acquired last time |
useCalibratedZ | Calibrate z values |
grayImageType | Either gray image data is filled with amplitude image or intensity image |
Implements ipa_CameraSensors::AbstractRangeImagingSensor.
Definition at line 539 of file VirtualRangeCam.cpp.
|
virtual |
Acquires an image from SwissRanger camera. Data is read from the camera and put into a corresponding OpenCV cv::Mat
data type. The cv::Mat
are allocated on demand.
rangeImage | OpenCV conform image with depth information. |
grayImage | OpenCV conform image with grayscale information. |
cartesianImage | OpenCV conform image with cartesian (x,y,z) information in meters. |
getLatestFrame | Set true to acquire a new image on calling instead of returning the one acquired last time |
useCalibratedZ | Calibrate z values |
grayImageType | Either gray image data is filled with amplitude image or intensity image |
IPA_Exception | Throws an exception, if camera access failed |
Implements ipa_CameraSensors::AbstractRangeImagingSensor.
Definition at line 496 of file VirtualRangeCam.cpp.
|
virtual |
Close camera device.
Implements ipa_CameraSensors::AbstractRangeImagingSensor.
Definition at line 431 of file VirtualRangeCam.cpp.
|
inlineprivate |
Compares the value of the iterator with ext in order to find the extension which has instances in the directory. Throws an error if different file formats are present at the same time.
itCounter | Iterator containing a file extension and a number of instances. |
ext | Is empty if no extension was found before, otherwise it contains the found extension. |
Definition at line 227 of file VirtualRangeCam.cpp.
unsigned long VirtualRangeCam::GetCalibratedUV | ( | double | x, |
double | y, | ||
double | z, | ||
double & | u, | ||
double & | v | ||
) |
Definition at line 924 of file VirtualRangeCam.cpp.
|
private |
Definition at line 885 of file VirtualRangeCam.cpp.
|
private |
Definition at line 873 of file VirtualRangeCam.cpp.
|
virtual |
Returns the number of images in the directory
Reimplemented from ipa_CameraSensors::AbstractRangeImagingSensor.
Definition at line 839 of file VirtualRangeCam.cpp.
|
virtual |
Function to set properties of the range imaging sensor.
propertyID | The ID of the property. |
cameraProperty | The value of the property. |
Implements ipa_CameraSensors::AbstractRangeImagingSensor.
Definition at line 467 of file VirtualRangeCam.cpp.
|
virtual |
Initializes Swissranger.
directory | Path to the directory of the range imaging sensor parameter file. |
cameraIndex | It is possible to have several cameras of the same type on the system. One may use the camera index to apply different configuration files to each of them. |
Implements ipa_CameraSensors::AbstractRangeImagingSensor.
Definition at line 59 of file VirtualRangeCam.cpp.
|
inlinevirtual |
Determines if range imaging camera has successfully been initialized.
Implements ipa_CameraSensors::AbstractRangeImagingSensor.
Definition at line 81 of file VirtualRangeCam.h.
|
inlinevirtual |
Determines if range imaging camera camera has successfully been opened.
Implements ipa_CameraSensors::AbstractRangeImagingSensor.
Definition at line 82 of file VirtualRangeCam.h.
|
privatevirtual |
Load general range camera parameters .
filename | Configuration file-path and file-name. |
cameraIndex | The index of the camera within the configuration file i.e. SR_CAM_0 or SR_CAM_1 |
Implements ipa_CameraSensors::AbstractRangeImagingSensor.
Definition at line 969 of file VirtualRangeCam.cpp.
|
virtual |
Opens the camera device. All camera specific parameters for opening the camera should have been set within the Init()
function.
Implements ipa_CameraSensors::AbstractRangeImagingSensor.
Definition at line 242 of file VirtualRangeCam.cpp.
|
virtual |
Save camera parameters. Saves the on-line set parameters for the range imaging camera to a file.
filename | Configuration file name. |
Implements ipa_CameraSensors::AbstractRangeImagingSensor.
Definition at line 865 of file VirtualRangeCam.cpp.
|
virtual |
Function specific to virtual camera. Resets the image directory read from the configuration file.
path | The camera path |
Reimplemented from ipa_CameraSensors::AbstractRangeImagingSensor.
Definition at line 859 of file VirtualRangeCam.cpp.
|
virtual |
Function to set properties of the range imaging sensor.
propertyID | The ID of the property. |
cameraProperty | The value of the property. |
Implements ipa_CameraSensors::AbstractRangeImagingSensor.
Definition at line 444 of file VirtualRangeCam.cpp.
|
virtual |
Function to set property defaults of the range imaging sensor.
Implements ipa_CameraSensors::AbstractRangeImagingSensor.
Definition at line 461 of file VirtualRangeCam.cpp.
|
inlineprivate |
Reads out the image width and height from the first image found in the filesystem.
filename | The name of that image. |
Definition at line 205 of file VirtualRangeCam.cpp.
|
private |
Definition at line 136 of file VirtualRangeCam.h.
|
private |
Directory where the image data resides.
Definition at line 133 of file VirtualRangeCam.h.
|
private |
Index of the specified camera. Important, when several cameras of the same type are present.
Definition at line 134 of file VirtualRangeCam.h.
|
private |
a0 z-calibration parameters. One matrix entry corresponds to one pixel
Given a 32 bit swissranger depth value, the real depth value in meteres is given by: z(u,v)=a0(u,v)+a1(u,v)*d(u,v)+a2(u,v)*d(u,v)^2 +a3(u,v)*d(u,v)^3+a4(u,v)*d(u,v)^4+a5(u,v)*d(u,v)^5 +a6(u,v)*d(u,v)^6;
Definition at line 125 of file VirtualRangeCam.h.
|
private |
a1 z-calibration parameters. One matrix entry corresponds to one pixel
Definition at line 126 of file VirtualRangeCam.h.
|
private |
a2 z-calibration parameters. One matrix entry corresponds to one pixel
Definition at line 127 of file VirtualRangeCam.h.
|
private |
a3 z-calibration parameters. One matrix entry corresponds to one pixel
Definition at line 128 of file VirtualRangeCam.h.
|
private |
a4 z-calibration parameters. One matrix entry corresponds to one pixel
Definition at line 129 of file VirtualRangeCam.h.
|
private |
a5 z-calibration parameters. One matrix entry corresponds to one pixel
Definition at line 130 of file VirtualRangeCam.h.
|
private |
a6 z-calibration parameters. One matrix entry corresponds to one pixel
Definition at line 131 of file VirtualRangeCam.h.
|
private |
Definition at line 119 of file VirtualRangeCam.h.
|
private |
Definition at line 139 of file VirtualRangeCam.h.
|
private |
Image height.
Definition at line 142 of file VirtualRangeCam.h.
|
private |
Image width.
Definition at line 141 of file VirtualRangeCam.h.
|
private |
Definition at line 137 of file VirtualRangeCam.h.
|
private |
Definition at line 144 of file VirtualRangeCam.h.
|
private |
Definition at line 144 of file VirtualRangeCam.h.
|
private |
Definition at line 144 of file VirtualRangeCam.h.
|
private |
Distortion parameters.
Definition at line 144 of file VirtualRangeCam.h.
|
private |
Definition at line 138 of file VirtualRangeCam.h.