Difference between revisions of "MITK-ToF - Getting started"
m (8 revisions) |
|||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
− | + | __NOTOC__ | |
+ | |||
=== Configuration === | === Configuration === | ||
Using MITK-ToF in a given MITK based application requires the following steps: | Using MITK-ToF in a given MITK based application requires the following steps: | ||
Line 15: | Line 16: | ||
# "Configure" and "Generate" will finalize the MITK-ToF configuration for MITK. | # "Configure" and "Generate" will finalize the MITK-ToF configuration for MITK. | ||
# Before starting the application, the file path to the vendor specific library (in the current case the pmdaccess.dll (Windows) or pmdaccess.so (Linux)) has to be added to the system's path variable (Windows: PATH, Linux: LD_LIBRARY_PATH) | # Before starting the application, the file path to the vendor specific library (in the current case the pmdaccess.dll (Windows) or pmdaccess.so (Linux)) has to be added to the system's path variable (Windows: PATH, Linux: LD_LIBRARY_PATH) | ||
+ | |||
=== Implementation Basics === | === Implementation Basics === | ||
Line 24: | Line 26: | ||
A basic tutorial on how to use the existing MITK-ToF classes is included in the source code. Activate MITK_BUILD_org.mitk.gui.qt.toftutorial in the CMakeConfiguration to build it. Currently two tutorial steps are available.The basic ideas are explained below, the source code provides a more detailed description. | A basic tutorial on how to use the existing MITK-ToF classes is included in the source code. Activate MITK_BUILD_org.mitk.gui.qt.toftutorial in the CMakeConfiguration to build it. Currently two tutorial steps are available.The basic ideas are explained below, the source code provides a more detailed description. | ||
+ | |||
==== Step 1 - Acquiring image data ==== | ==== Step 1 - Acquiring image data ==== | ||
Line 53: | Line 56: | ||
* ''tofImageGrabber->StopCamera();'' | * ''tofImageGrabber->StopCamera();'' | ||
* ''tofImageGrabber->DisconnectCamera();'' | * ''tofImageGrabber->DisconnectCamera();'' | ||
+ | |||
==== Step 2 - Generating a surface from the range data ==== | ==== Step 2 - Generating a surface from the range data ==== |
Revision as of 18:57, 23 October 2014
Configuration
Using MITK-ToF in a given MITK based application requires the following steps:
- Activate MITK_ENABLE_TOF_HARDWARE in CMake configuration of MITK. After configuring the project, three new variables should be available to activate camera hardware support:
- Activating the desired hardware and configuring again will require to set the vendors SDK directory. In the current configuration with only PMD devices available this will be PMDSDK2. The following CMake variables must be specified:
- To add the sample application (!ToFUtil) to the MITK main application ExtApp, the CMake variable MITK_BUILD_org.mitk.gui.qt.tofutil has to be activated additionally.
- "Configure" and "Generate" will finalize the MITK-ToF configuration for MITK.
- Before starting the application, the file path to the vendor specific library (in the current case the pmdaccess.dll (Windows) or pmdaccess.so (Linux)) has to be added to the system's path variable (Windows: PATH, Linux: LD_LIBRARY_PATH)
Implementation Basics
Before starting to write MITK-ToF based applications, the dependencies to the required ToF module has to be set. These are:
- mitkToFHardware for module ToFHardware
- mitkToFProcessing for module ToFProcessing
- mitkTOFUI for module ToFUI
A basic tutorial on how to use the existing MITK-ToF classes is included in the source code. Activate MITK_BUILD_org.mitk.gui.qt.toftutorial in the CMakeConfiguration to build it. Currently two tutorial steps are available.The basic ideas are explained below, the source code provides a more detailed description.
Step 1 - Acquiring image data
The ToFImageGrabberCreator is used to create an ready to use instance of a ToFImageGrabber
- mitk::ToFImageGrabber::Pointer tofImageGrabber = mitk::ToFImageGrabberNew();
Assign the used device to this grabber (in this case the MITK Player).
- tofImageGrabber->SetCameraDevice(mitk::ToFCameraMITKPlayerDevice::New());
This ToFImageGrabber is the source of an image-based filter pipeline and is now used to grab the images from the assosicated Device (in our example a player device)
Establish connection to the camera and start camera (i.e. start thread in device)
- tofImageGrabber->ConnectCamera();
- tofImageGrabber->StartCamera();
Update filter pipeline and get output images
- mitk::Image::Pointer distanceImage = tofImageGrabber->GetOutput(0);
- mitk::Image::Pointer amplitudeImage = tofImageGrabber->GetOutput(1);
- mitk::Image::Pointer intensityImage = tofImageGrabber->GetOutput(2);
... Do some image processing ...
Stop camera (terminates acquisition thread) and disconnect
- tofImageGrabber->StopCamera();
- tofImageGrabber->DisconnectCamera();
Step 2 - Generating a surface from the range data
The acquired distance image is now used to calculate a surface representation.
Create CameraIntrinsics which represents the intrinsic camera parameters
- mitk::CameraIntrinsics::Pointer cameraIntrinsics = mitk::CameraIntrinsics::New();
Create an instance of the distance image to surface filter used for processing the distance image and apply the camera intrinsics
- mitk::ToFDistanceImageToSurfaceFilter::Pointer surfaceFilter = mitk::ToFDistanceImageToSurfaceFilter::New(); surfaceFilter->SetCameraModel(cameraIntrinsics);
Set the distance image as input of the surface filter and update the pipeline
- surfaceFilter->SetInput(distanceImage); surfaceFilter->Update();
Get the surface as output of this filter
- mitk::Surface::Pointer surface = surfaceFilter->GetOutput();