23 #include <itkMultiThreader.h>
24 #include <itksys/SystemTools.hxx>
31 m_DistanceDataBuffer(NULL),
32 m_AmplitudeDataBuffer(NULL),
33 m_RGBDataBuffer(NULL),
34 m_DepthBufferSize(sizeof(float)*512*424),
35 m_RGBBufferSize(3*1920*1080)
47 return "Microsoft Kinect 2 Device ";
131 this->m_FreePos = (this->m_FreePos+1) % this->
m_BufferSize;
141 itksys::SystemTools::Delay(10);
154 itksys::SystemTools::Delay(100);
160 itksys::SystemTools::Delay(10);
182 struct itk::MultiThreader::ThreadInfoStruct * pInfo = (
struct itk::MultiThreader::ThreadInfoStruct*)pInfoStruct;
185 return ITK_THREAD_RETURN_VALUE;
187 if (pInfo->UserData == NULL)
189 return ITK_THREAD_RETURN_VALUE;
192 if (toFCameraDevice!=NULL)
197 t1 = realTimeClock->GetCurrentStamp();
199 bool overflow =
false;
200 bool printStatus =
false;
215 toFCameraDevice->Modified();
217 bool generateTriangularMesh =
false;
218 toFCameraDevice->
GetBoolProperty(
"GenerateTriangularMesh", generateTriangularMesh);
219 toFCameraDevice->
m_Controller->SetGenerateTriangularMesh(generateTriangularMesh);
222 toFCameraDevice->
m_Controller->SetTriangulationThreshold(triangulationThreshold);
243 t2 = realTimeClock->GetCurrentStamp() - t1;
245 t1 = realTimeClock->GetCurrentStamp();
250 return ITK_THREAD_RETURN_VALUE;
263 MITK_WARN(
"ToF") <<
"Warning: Data can only be acquired if camera is active.";
282 MITK_WARN(
"ToF") <<
"Warning: Data can only be acquired if camera is active.";
288 int requiredImageSequence,
int& capturedImageSequence,
unsigned char* rgbDataArray)
302 if ((requiredImageSequence < 0) || (requiredImageSequence > this->
m_ImageSequence))
314 capturedImageSequence = requiredImageSequence;
329 surface->SetVtkPolyData( deepCopyOfPoly );
336 MITK_WARN(
"ToF") <<
"Warning: Data can only be acquired if camera is active.";
virtual void StartCamera()
starts the continuous updating of the camera. A separate thread updates the source data...
virtual BaseProperty * GetProperty(const char *propertyKey)
get a BaseProperty from the property list
int GetRGBCaptureHeight()
returns the height of the RGB image
itk::SmartPointer< Self > Pointer
virtual bool DisconnectCamera()
closes the connection to the camera
float ** m_DistanceDataBuffer
buffer holding the last distance images
KinectV2Controller::Pointer GetController()
returns the corresponding camera controller
virtual void UpdateCamera()
updates the camera for image acquisition
bool GetBoolProperty(const char *propertyKey, bool &boolValue)
get a bool from the property list
int m_RGBPixelNumber
number of pixels in the range image (m_RGBImageWidth*m_RGBImageHeight)
virtual void StopCamera()
stops the continuous updating of the camera
int m_PixelNumber
number of pixels in the range image (m_CaptureWidth*m_CaptureHeight)
DataCollection - Class to facilitate loading/accessing structured data.
vcl_size_t m_RGBBufferSize
Size of RGB buffer (i.e. memory size of RGB image)
vcl_size_t m_DepthBufferSize
Size of depth buffer (i.e. memory size of depth and infrared image)
float * m_DistanceArray
float array holding the distance image
int m_ThreadID
ID of the started thread.
KinectV2Controller::Pointer m_Controller
corresponding CameraController
int GetRGBCaptureWidth()
returns the width of the RGB image
itk::FastMutexLock::Pointer m_CameraActiveMutex
mutex for the cameraActive flag
itk::MultiThreader::Pointer m_MultiThreader
itk::MultiThreader used for thread handling
unsigned char ** m_RGBDataBuffer
buffer holding the last RGB image
virtual void GetAllImages(float *distanceArray, float *amplitudeArray, float *intensityArray, char *sourceDataArray, int requiredImageSequence, int &capturedImageSequence, unsigned char *rgbDataArray=NULL)
gets the 3 images (distance, amplitude, intensity) from the ToF camera. Caution! The user is responsi...
int m_FreePos
current position in the buffer which will be filled with data acquired from the hardware ...
virtual void SetProperty(const char *propertyKey, BaseProperty *propertyValue)
set a BaseProperty property in the property list
int m_RGBImageHeight
height of the RGB image (y dimension)
bool m_CameraActive
flag indicating if the camera is currently active or not. Caution: thread safe access only! ...
int m_CurrentPos
current position in the buffer which will be retrieved by the Get methods
bool m_CameraConnected
flag indicating if the camera is successfully connected or not. Caution: thread safe access only! ...
static ITK_THREAD_RETURN_TYPE Acquire(void *pInfoStruct)
Thread method continuously acquiring images from the ToF hardware.
virtual bool OnConnectCamera()
opens a connection to the ToF camera
std::string GetDeviceName()
int m_CaptureWidth
width of the range image (x dimension)
itk::FastMutexLock::Pointer m_ImageMutex
mutex for images provided by the range camera
virtual void GetIntensities(float *intensityArray, int &imageSequence)
Does nothing for Kinect V2 as there is no intensity data provided by the device.
int m_BufferSize
buffer size of the image buffer needed for loss-less acquisition of range data
virtual void GetDistances(float *distanceArray, int &imageSequence)
gets the distance data from the ToF camera measuring the distance between the camera and the differen...
virtual bool IsCameraActive()
returns whether the camera is currently active or not
int m_MaxBufferSize
maximal buffer size needed for initialization of data arrays. Default value is 100.
virtual void GetAmplitudes(float *amplitudeArray, int &imageSequence)
gets the amplitude data from the ToF camera as the strength of the active illumination of every pixel...
int m_CaptureHeight
height of the range image (y dimension)
Interface for all representations of Microsoft Kinect V2 devices. Kinect2Device internally holds an i...
float * m_AmplitudeArray
float array holding the amplitude image
static Pointer New(void)
instanciates a new, operating-system dependant, instance of mitk::RealTimeClock.
int m_RGBImageWidth
width of the RGB image (x dimension)
vtkSmartPointer< vtkPolyData > m_PolyData
Surface generated via the Kinect V2 SDK with default/unknown calibration.
int m_ImageSequence
counter for acquired images
float ** m_AmplitudeDataBuffer
buffer holding the last amplitude images
static itkEventMacro(BoundingShapeInteractionEvent, itk::AnyEvent) class MITKBOUNDINGSHAPE_EXPORT BoundingShapeInteractor Pointer New()
Basic interaction methods for mitk::GeometryData.