Into

Modules

Documentation

classPiiImageFilterOperation

#include <PiiImageFilterOperation.h>

An operation that implements basic image filtering operations.

Inherits PiiDefaultOperation

Description

It supports the most commonly used edge detection and noise reduction filters and also allows one to specify a custom filter.

Inputs

imagethe image to be filtered. Any image type. For color images, the filter will be applied channel-wise.

Outputs

imagethe filtered image. The type of the output image equals that of the input.

Properties

The method of handling image borders.

The filter as a matrix.

The name of the image filter.

int

The size of the filter mask.

Public types

enum
{ ExtendZeros, ExtendReplicate, ExtendSymmetric, ExtendPeriodic, ExtendNot }

Different ways of extending images in filtering.

Constructors and destructor

Public member functions

virtual void
(
  • bool reset
)

Checks the operation for execution.

( )
int
void
( )
void
( )
void
( )
void
(
  • int filterSize
)

Protected member functions

virtual void

Executes one round of processing.

Property details

  • ExtendMode borderHandling

    [read, write]

    The method of handling image borders.

    The default value is ExtendZeros.

  • PiiVariant filter

    [read, write]

    The filter as a matrix.

    This value is used only if filterName is set to "custom".

     PiiOperation* op = engine.createOperation("PiiImageFilter");
     op->setProperty("filter",
                     PiiVariant(new PiiMatrix<int>(3, 3,
                                                           1, 2, 1,
                                                           2, 4, 2,
                                                           1, 2, 1));
    
  • QString filterName

    [read, write]

    The name of the image filter.

    This is an easy way to set the filter. For valid values see PiiImage::PrebuiltFilterType. Use "sobelx" for SobelXFilter, "gaussian" for GaussianFilter etc. There are two special values not supported by makeFilter():

    • median - a median filter. Median filter is non-linear and cannot be implemented with ordinary correlation masks.

    • custom - filter will be used as the filter mask.

    The default value is "uniform".
  • int filterSize

    [read, write]

    The size of the filter mask.

    This property has no effect if filterName is set to custom. It is also ignored by some filters as described in PiiImage::makeFilter(). Automatically created filters are always square. The default value is 3.

Enumeration details

  • enum ExtendMode

    Different ways of extending images in filtering.

    Copied from PiiMatrixUtil to avoid extensive moc hacking.

    • ExtendZeros - pad with zeros

    • ExtendReplicate - replicate the value on the border

    • ExtendSymmetric - symmetrically mirror boundary values

    • ExtendPeriodic - take values from the opposite border

    • ExtendNot - do not extend

Function details

  • PiiImageFilterOperation

    ()
  • ExtendMode borderHandling

    ()
  • 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.

  • PiiVariant filter

    ()
  • QString filterName

    ()
  • int filterSize

    ()
  • void setBorderHandling

    ( )
  • void setFilter

    ( )
  • void setFilterName

    ( )
  • void setFilterSize

    (
    • int filterSize
    )
  • 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.