Into

Modules

Documentation

classPiiLbpOperation

#include <PiiLbpOperation.h>

The LBP texture feature.

Inherits PiiDefaultOperation

Description

Inputs

imagean image the LBP texture feature is extracted from. The image may be of any type. Color images are automatically converted to gray scale before processing.

roiregion-of-interest. See Image plug-in for a description. Optional.

Outputs

featuresall extracted features as a concatenated feature vector. In ImageOutput mode, this output will emit the same feature image as features0.

featuresXa feature vector that contains the extracted LBP features or a feature image that contains the LBP feature code for each pixel, depending on outputType. X stands for the Xth parameter set (zero-based index). The size of the output image is smaller than the size of the input image. By default, one output is created and named features0. It outputs the 256-bin feature vector for LBP 8,1 in Standard mode with nearest neighbor interpolation.

Properties

A type that determines whether histograms or feature images will be produced.

A list of parameters used in extracting the LBP features.

The type or the roi input, if connected.

Public types

enum
{ HistogramOutput, NormalizedHistogramOutput, ImageOutput }

Output types.

Constructors and destructor

Create a new LBP operation.

Public member functions

virtual void
(
  • bool reset
)

Checks the operation for execution.

( )
void
void
( )
void

Protected member functions

virtual void
( )

Called by setState() just before the operation changes to a new state.

virtual void
( )

Executes one round of processing.

Property details

  • OutputType outputType

    [read, write]

    A type that determines whether histograms or feature images will be produced.

    The default value is HistogramOutput.

  • QStringList parameters

    [read, write]

    A list of parameters used in extracting the LBP features.

    If multiple parameters are given, multiple feature vectors are extracted for each input image. The parameters are represented with samples,radius[,threshold][,mode][,interpolation][,smoothing]. Samples is the number of samples taken around each pixel (int), radius is the sampling radius (float), and threshold a "noise canceller threshold" (float). Valid values for mode are Uniform, RotationInvariant, UniformRotationInvariant, and Symmetric. Interpolation can be either LinearInterpolation or NearestNeighborInterpolation. Smoothing can be either Smoothed or NonSmoothed. Everything but samples and radius can be omitted. Default values are "Standard", "NearestNeighborInterpolation", and "NonSmoothed". Threshold, mode, interpolation, and smoothing can be given in any order.

    Notes

    • If mode is "Symmetric", a "symmetric" LBP is used instead of the traditional one. The symmetric version compares opposing pairs of pixels in a neighborhood and doesn't consider the center. See PiiLbp::genericSymmetricLbp() for details. The amount of samples for the symmetric LBP must be even. If an odd number is given, samples-1 will be used. The symmetric version cannot make use of the threshold parameter.

    • If smoothing is set to "Smoothed", the input image will be smoothed prior to applying the LBP operation. The smoothing is performed with Pii::fastMovingAverage() using the distance between neighborhood samples as the size of the smoothing window. Formally, the window size is calculated as , where N is the number of samples and N is the neighborhood radius. Multi-scale LBP with smoothing can be seen as a pyramid description of image texture.

    • The standard LBP, albeit being largely invariant against illumination changes, is quite sensitive to noise on uniformly colored surfaces. LBP's noise tolerance can be increased by adding a constant value ("noise canceller threshold") to each pixel before comparing it to the neighbors. This way, small variations don't get captured. The downside is that one needs to select a suitable threshold value, which is yet another parameter to decide. Furthermore, the threshold makes LBP more dependent on illumination changes.

    Examples of valid parameters:
    • 8,1

    • 8,1,RotationInvariant

    • 16,2,4,UniformRotationInvariant,LinearInterpolation

    • 12,1.5,Uniform,Smoothed

    • 8,1,LinearInterpolation

    • 10,1.7,LinearInterpolation,Symmetric

     lbpOperation.setProperty("parameters", QStringList() << "8,1" << "16,2,Uniform");

  • PiiImage::RoiType roiType

    [read, write]

    The type or the roi input, if connected.

    The default value is AutoRoi.

Enumeration details

  • enum OutputType

    Output types.

    • HistogramOutput - LBP codes are collected to a histogram and output as a row vector (PiiMatrix<int>). In HistogramOutput mode, a separate histogram operation is not needed.

    • NormalizedHistogramOutput - same as HistogramOutput, but the histogram is normalized to sum up to unity. The output type will be PiiMatrix<float>.

    • ImageOutput - the output will be an image (PiiMatrix<int>) in which each pixel is replaced with its LBP code.

Function details

  • PiiLbpOperation

    ()

    Create a new LBP operation.

  • ~PiiLbpOperation

    ()
  • virtual void check

    (
    • bool reset
    )
    [virtual]

    Checks the operation for execution.

    This function creates a suitable flow controller by calling createFlowController(). It then sets the flow controller to the active processor and sets the processor as the input controller for all inputs.

    If you change socket groupings in your overridden implementation, please call PiiDefaultOperation::check() after that. Otherwise, your new groupings will not be in effect.

    Reimplemented from PiiDefaultOperation.

  • OutputType outputType

    ()
  • QStringList parameters

    ()
  • PiiImage::RoiType roiType

    ()
  • void setOutputType

    ()
  • void setParameters

    ()
  • void setRoiType

    ()
  • virtual void aboutToChangeState

    ()
    [protected, virtual]

    Called by setState() just before the operation changes to a new state.

    The function will be called independent of the cause of the state change (internal or external). Derived classes may implement this function to perform whatever functionality is needed when a state changes. The default implementation does nothing.

    Reimplemented from PiiBasicOperation.

  • virtual void process

    ()
    [protected, virtual]

    Executes one round of processing.

    This function is invoked by the processor if the necessary preconditions for a new processing round are met. This function does all the necessary calculations to create output objects and sends them to output sockets.

    Calls to process(), syncEvent(), and setProperty() are synchronized and cannot occur simultaneously. PiiDefaultOperation ensures this by locking processLock() for reading before calling process().

    Note: With time-consuming operations, one should occasionally check that the operation hasn't been interrupted, i.e. that state() returns Running.

    Exceptions
    PiiExecutionException

    whenever an unrecoverable error occurs during a processing round, the operation is interrupted, or finishes execution due to end of input data.

    Reimplemented from PiiDefaultOperation.

Notes (0)

Add a note

Not a single note added yet. Be the first, add yours.