Image Component Library (ICL)
|
#include <ObjectEdgeDetector.h>
Public Types | |
enum | Mode { BEST, GPU, CPU } |
Public Member Functions | |
ObjectEdgeDetector (Mode mode=BEST) | |
Create new ObjectEdgeDetector. More... | |
virtual | ~ObjectEdgeDetector () |
Destructor. More... | |
const core::Img8u & | calculate (const core::Img32f &depthImage, bool filter, bool average, bool gauss) |
One call function for calculation of the complete processingpipeline. More... | |
void | setDepthImage (const core::Img32f &depthImg) |
Sets the input depth image (input for median filter). More... | |
void | applyMedianFilter () |
Calculates a filtered image using a median filter. More... | |
const core::Img32f & | getFilteredDepthImage () |
Returns the filtered depth image. More... | |
void | setFilteredDepthImage (const core::Img32f &filteredImg) |
Sets the (filtered) depth image (input for normal calculation) More... | |
void | applyNormalCalculation () |
Calculates the point normals. More... | |
void | applyLinearNormalAveraging () |
Recalculates the normals by linear averaging. More... | |
void | applyGaussianNormalSmoothing () |
Recalculates the normals by gaussian smoothing in a given range. More... | |
const core::DataSegment< float, 4 > | getNormals () |
Returns the Pointer to the normals. More... | |
void | applyWorldNormalCalculation (const Camera &cam) |
Transforms the normals to the world space and calculates normal image. More... | |
const core::DataSegment< float, 4 > | getWorldNormals () |
Returns the point normals in world space. More... | |
const core::Img8u & | getRGBNormalImage () |
Returns the RGB normal image. More... | |
void | setNormals (core::DataSegment< float, 4 > pNormals) |
Sets the point normals (input for angle image calculation). More... | |
void | applyAngleImageCalculation () |
Calculates the angle image. More... | |
const core::Img32f & | getAngleImage () |
Returns the angle image. More... | |
void | setAngleImage (const core::Img32f &angleImg) |
Sets the angle image (input for image binarization). More... | |
void | applyImageBinarization () |
Binarizes the angle image to detect edges. More... | |
const core::Img8u & | getBinarizedAngleImage () |
Returns the binarized angle image (final output). More... | |
void | setMedianFilterSize (int size) |
Sets the mask size for applyMedianFilter() More... | |
void | setNormalCalculationRange (int range) |
Sets the range for applyNormalCalculation(). More... | |
void | setNormalAveragingRange (int range) |
Sets the averaging range for applyNormalAveraging() More... | |
void | setAngleNeighborhoodMode (int mode) |
Sets the neighborhood mode for applyAngleImageCalculation() More... | |
void | setAngleNeighborhoodRange (int range) |
Sets the neighborhood range for applyAngleImageCalculation() More... | |
void | setBinarizationThreshold (float threshold) |
Sets the binarization threshold for applyImageBinarization(). More... | |
void | setUseNormalAveraging (bool use) |
Sets normal averaging enabled/disabled. More... | |
void | setUseGaussSmoothing (bool use) |
Sets normal averaging by gauss smoothing enabled/disabled. More... | |
Private Member Functions | |
void | initialize (utils::Size size) |
Private Attributes | |
Data * | m_data |
internal data type More... | |
ObjectEdgeDetectorPlugin * | objectEdgeDetector |
This class calculates an edge image based on angles between normals from an input depth image (e.g. Kinect). The common way to use this class is the calculate() method, getting a depth image and returning an edge image. This method computes the whole pipeline (image filtering, normal calculation and smoothing, angle image calculation and binarization). The performance of this method is optimized with minimal read/write for the underlying OpenCL implementation. The interim results can be accessed with getNormals() and getAngleImage() afterwards. It is also possible to use subparts of the pipeline using the setter methods to set the interim data.
Create new ObjectEdgeDetector.
Constructs an object of this class. All default parameters are set. Use setters for desired values.
mode | selects the implementation (GPU, CPU or BEST) |
|
virtual |
Destructor.
void icl::geom::ObjectEdgeDetector::applyAngleImageCalculation | ( | ) |
Calculates the angle image.
The mode is set by setAngleNeighborhoodMode(int mode). The range is set by setAngleNeighborhoodRange(int range)
void icl::geom::ObjectEdgeDetector::applyGaussianNormalSmoothing | ( | ) |
Recalculates the normals by gaussian smoothing in a given range.
Alternative to applyTemporalNormalAveraging that uses a simpler gaussian filter for smoothing
if it is enabled width setUseNormalAveraging(bool use). The range is set by setNormalAveragingRange(int range). Alternative: normalAveraging() with setUseGaussSmoothing(false).
void icl::geom::ObjectEdgeDetector::applyImageBinarization | ( | ) |
Binarizes the angle image to detect edges.
The threshold is set by setBinarizationThreshold(float threshold).
void icl::geom::ObjectEdgeDetector::applyLinearNormalAveraging | ( | ) |
Recalculates the normals by linear averaging.
This reduces the noise of the normal image. The function is called from calculateNormals() if it is enabled width setUseNormalAveraging(bool use). The range is set by setNormalAveragingRange(int range).
Alternative: normalGaussSmoothing() with setUseGaussSmoothing(true).
void icl::geom::ObjectEdgeDetector::applyMedianFilter | ( | ) |
Calculates a filtered image using a median filter.
The mask size is set by setMedianFilterSize(int size)
void icl::geom::ObjectEdgeDetector::applyNormalCalculation | ( | ) |
Calculates the point normals.
The range for calculation is set by setNormalCalculationRange(int range).
void icl::geom::ObjectEdgeDetector::applyWorldNormalCalculation | ( | const Camera & | cam | ) |
Transforms the normals to the world space and calculates normal image.
cam | the camera of the depth image |
const core::Img8u& icl::geom::ObjectEdgeDetector::calculate | ( | const core::Img32f & | depthImage, |
bool | filter, | ||
bool | average, | ||
bool | gauss | ||
) |
One call function for calculation of the complete processingpipeline.
Order: ((filter)->normals->(normalAvg)->angles->binarization)
depthImage | the input depth image |
filter | enable/disable filtering |
average | enable/disable normal averaging |
gauss | true=gauss smoothing, false=linear smoothing |
const core::Img32f& icl::geom::ObjectEdgeDetector::getAngleImage | ( | ) |
Returns the angle image.
const core::Img8u& icl::geom::ObjectEdgeDetector::getBinarizedAngleImage | ( | ) |
Returns the binarized angle image (final output).
const core::Img32f& icl::geom::ObjectEdgeDetector::getFilteredDepthImage | ( | ) |
Returns the filtered depth image.
const core::DataSegment<float,4> icl::geom::ObjectEdgeDetector::getNormals | ( | ) |
Returns the Pointer to the normals.
const core::Img8u& icl::geom::ObjectEdgeDetector::getRGBNormalImage | ( | ) |
Returns the RGB normal image.
const core::DataSegment<float,4> icl::geom::ObjectEdgeDetector::getWorldNormals | ( | ) |
Returns the point normals in world space.
|
private |
void icl::geom::ObjectEdgeDetector::setAngleImage | ( | const core::Img32f & | angleImg | ) |
Sets the angle image (input for image binarization).
This call is not necessary if angleImageCalculation() is executed before.
angleImg | the angle image |
void icl::geom::ObjectEdgeDetector::setAngleNeighborhoodMode | ( | int | mode | ) |
Sets the neighborhood mode for applyAngleImageCalculation()
0=max, 1=mean. (default 0)
mode | the neighborhood mode |
void icl::geom::ObjectEdgeDetector::setAngleNeighborhoodRange | ( | int | range | ) |
Sets the neighborhood range for applyAngleImageCalculation()
(default 3, min 1)
range | the neighborhood range |
void icl::geom::ObjectEdgeDetector::setBinarizationThreshold | ( | float | threshold | ) |
Sets the binarization threshold for applyImageBinarization().
Value n for acos(n). A value of 0 maps to 90 degree, a value of 1 maps to o degree (default 0.89)
threshold | binarization threshold |
void icl::geom::ObjectEdgeDetector::setDepthImage | ( | const core::Img32f & | depthImg | ) |
Sets the input depth image (input for median filter).
depthImg | the input depth image |
void icl::geom::ObjectEdgeDetector::setFilteredDepthImage | ( | const core::Img32f & | filteredImg | ) |
Sets the (filtered) depth image (input for normal calculation)
This call is not necessary if medianFilter() is executed before
filteredImg | the (filtered) depth image |
void icl::geom::ObjectEdgeDetector::setMedianFilterSize | ( | int | size | ) |
Sets the mask size for applyMedianFilter()
size n corresponds to mask size n x n. (default 3, min 3, max 9, odd only)
size | the mask size |
void icl::geom::ObjectEdgeDetector::setNormalAveragingRange | ( | int | range | ) |
Sets the averaging range for applyNormalAveraging()
(default 1)
range | the normal averaging range |
void icl::geom::ObjectEdgeDetector::setNormalCalculationRange | ( | int | range | ) |
Sets the range for applyNormalCalculation().
(default 2)
range | the normal calculation range |
void icl::geom::ObjectEdgeDetector::setNormals | ( | core::DataSegment< float, 4 > | pNormals | ) |
Sets the point normals (input for angle image calculation).
This call is not necessary if normalCalculation() is executed before.
pNormals | the point normals |
void icl::geom::ObjectEdgeDetector::setUseGaussSmoothing | ( | bool | use | ) |
Sets normal averaging by gauss smoothing enabled/disabled.
(default false=linear smoothing if normal averaging enabled)
use | enable/disable gauss smoothing |
void icl::geom::ObjectEdgeDetector::setUseNormalAveraging | ( | bool | use | ) |
Sets normal averaging enabled/disabled.
(default true=enabled)
use | enable/disable normal averaging |
|
private |
internal data type
internal data pointer
|
private |