Common Pipeline Library Reference 7.3.2
Loading...
Searching...
No Matches
Typedefs | Enumerations
Filters

Typedefs

typedef enum _cpl_border_mode_ cpl_border_mode
 The border mode type.
 
typedef enum _cpl_filter_mode_ cpl_filter_mode
 The filter mode type.
 

Enumerations

enum  _cpl_border_mode_ {
  CPL_BORDER_FILTER ,
  CPL_BORDER_ZERO ,
  CPL_BORDER_CROP ,
  CPL_BORDER_NOP ,
  CPL_BORDER_COPY
}
 These are the supported border modes. For a kernel of width 2n+1, the n left- and rightmost image/mask columns do not have elements for the whole kernel. The same holds for the top and bottom image/mask rows. The border mode defines the filtering of such border pixels. More...
 
enum  _cpl_filter_mode_ {
  CPL_FILTER_EROSION ,
  CPL_FILTER_DILATION ,
  CPL_FILTER_OPENING ,
  CPL_FILTER_CLOSING ,
  CPL_FILTER_LINEAR ,
  CPL_FILTER_LINEAR_SCALE ,
  CPL_FILTER_AVERAGE ,
  CPL_FILTER_AVERAGE_FAST ,
  CPL_FILTER_MEDIAN ,
  CPL_FILTER_STDEV ,
  CPL_FILTER_STDEV_FAST ,
  CPL_FILTER_MORPHO ,
  CPL_FILTER_MORPHO_SCALE
}
 These are the supported filter modes. More...
 

Detailed Description

This module provides definitions for filtering of a cpl_image and a cpl_mask. The actual filtering functions are defined in the cpl_image and cpl_mask modules.

Synopsis:
#include "cpl_filter.h"

Typedef Documentation

◆ cpl_border_mode

The border mode type.

◆ cpl_filter_mode

The filter mode type.

Enumeration Type Documentation

◆ _cpl_border_mode_

These are the supported border modes. For a kernel of width 2n+1, the n left- and rightmost image/mask columns do not have elements for the whole kernel. The same holds for the top and bottom image/mask rows. The border mode defines the filtering of such border pixels.

Enumerator
CPL_BORDER_FILTER 

Filter the border using the reduced number of pixels. If in median filtering the number of pixels is even choose the mean of the two central values, after the borders have been filled with a chess-like pattern of +- inf

CPL_BORDER_ZERO 

Set the border of the filtered image/mask to zero.

CPL_BORDER_CROP 

Crop the filtered image/mask.

CPL_BORDER_NOP 

Do not modify the border of the filtered image/mask.

CPL_BORDER_COPY 

Copy the border of the input image/mask. For an in-place operation this has the no effect, identical to CPL_BORDER_NOP.

◆ _cpl_filter_mode_

These are the supported filter modes.

Enumerator
CPL_FILTER_EROSION 

The erosion filter (for a cpl_mask).

See also
cpl_mask_filter()
CPL_FILTER_DILATION 

The dilation filter (for a cpl_mask).

See also
cpl_mask_filter()
CPL_FILTER_OPENING 

The opening filter (for a cpl_mask).

See also
cpl_mask_filter()
CPL_FILTER_CLOSING 

The closing filter (for a cpl_mask).

See also
cpl_mask_filter()
CPL_FILTER_LINEAR 

A linear filter (for a cpl_image). The kernel elements are normalized with the sum of their absolute values. This implies that there must be at least one non-zero element in the kernel. The normalisation makes the kernel useful for filtering where flux conservation is desired.

The kernel elements are thus used as weights like this:

    Kernel        Image
                          ...
    1 2 3         ... 1.0 2.0 3.0 ...
    4 5 6         ... 4.0 5.0 6.0 ...
    7 8 9         ... 7.0 8.0 9.0 ...
                          ...

The filtered value corresponding to the pixel whose value is 5.0 is: $\frac{(1*1.0+2*2.0+3*3.0+4*4.0+5*5.0+6*6.0+7*7.0+8*8.0+9*9.0)}
          {1+2+3+4+5+6+7+8+9}$

Filtering with CPL_FILTER_LINEAR and a flat kernel can be done faster with CPL_FILTER_AVERAGE.

See also
CPL_FILTER_LINEAR_SCALE, CPL_FILTER_AVERAGE, cpl_image_filter()
CPL_FILTER_LINEAR_SCALE 

A linear filter (for a cpl_image). Unlike CPL_FILTER_LINEAR the kernel elements are not normalized, so the filtered image will have its flux scaled with the sum of the weights of the kernel. Examples of linear, scaling kernels are gradient operators and edge detectors.

The kernel elements are thus applied like this:

    Kernel        Image
                          ...
    1 2 3         ... 1.0 2.0 3.0 ...
    4 5 6         ... 4.0 5.0 6.0 ...
    7 8 9         ... 7.0 8.0 9.0 ...
                          ...

The filtered value corresponding to the pixel whose value is 5.0 is: $1*1.0+2*2.0+3*3.0+4*4.0+5*5.0+6*6.0+7*7.0+8*8.0+9*9.0$

See also
CPL_FILTER_LINEAR, cpl_image_filter()
CPL_FILTER_AVERAGE 

An average filter, i.e. the output pixel is the arithmetic average of the surrounding (1 + 2 * hsizex) (1 + 2 * hsizey) pixels. The cost per pixel is O(hsizex*hsizey). The two images may have different pixel types. When the input and output pixel types are identical, the arithmetic is done with that type, e.g. int for two integer images. When the input and output pixel types differ, the arithmetic is done in double precision when one of the two images have pixel type CPL_TYPE_DOUBLE, otherwise float is used.

See also
CPL_FILTER_AVERAGE_FAST, cpl_image_filter_mask()
CPL_FILTER_AVERAGE_FAST 

The same as CPL_FILTER_AVERAGE, except that it uses a running average, which will lead to a significant loss of precision if there are large differences in the magnitudes of the input pixels. The cost per pixel is O(1) if all elements in the kernel are used, otherwise the filtering is done as for CPL_FILTER_AVERAGE.

See also
cpl_image_filter_mask()
CPL_FILTER_MEDIAN 

A median filter (for a cpl_image). The pixel types of the input and output images must be identical.

See also
cpl_image_filter_mask()
CPL_FILTER_STDEV 

The filtered value is the standard deviation of the included input pixels.

       Kernel              Image
                                ...
       1   0   1           ... 1.0 2.0 3.0 ...
       0   1   0           ... 4.0 5.0 6.0 ...
       1   0   1           ... 7.0 8.0 9.0 ...
                                   ...

The pixel with value 5.0 will have a filtered value of: std_dev(1.0, 3.0, 5.0, 7.0, 9.0)

See also
CPL_FILTER_STDEV_FAST, cpl_image_filter_mask()
CPL_FILTER_STDEV_FAST 

The same as CPL_FILTER_STDEV, except that it uses the same running method employed in CPL_FILTER_AVERAGE_FAST, which will lead to a significant loss of precision if there are large differences in the magnitudes of the input pixels. As for CPL_FILTER_AVERAGE_FAST, the cost per pixel is O(1) if all elements are used, otherwise the filtering is done as for CPL_FILTER_STDEV.

See also
cpl_image_filter_mask()
CPL_FILTER_MORPHO 

A morphological filter (for a cpl_image). The kernel elements are used as weights on the sorted values covered by the kernel. The kernel elements are normalized with the sum of their absolute values. This implies that there must be at least one non-zero element in the kernel. The normalisation makes the kernel useful for filtering where flux conservation is desired.

The kernel elements are used as weights on the sorted values covered by the kernel:

    Kernel        Image
                          ...
    1 2 3         ... 4.0 6.0 5.0 ...
    4 5 6         ... 3.0 1.0 2.0 ...
    7 8 9         ... 7.0 8.0 9.0 ...
                          ...

The filtered value corresponding to the pixel whose value is 5.0 is: $\frac{(1*1.0+2*2.0+3*3.0+4*4.0+5*5.0+6*6.0+7*7.0+8*8.0+9*9.0)}{1+2+3+4+5+6+7+8+9}$

See also
CPL_FILTER_MORPHO_SCALE, cpl_image_filter()
CPL_FILTER_MORPHO_SCALE 

A morphological filter (for a cpl_image). Unlike CPL_FILTER_MORPHO the kernel elements are not normalized, so the filtered image will have its flux scaled with the sum of the weights of the kernel.

The kernel elements are thus applied to the sorted values covered by the kernel:

   Kernel        Image
                         ...
   1 2 3         ... 4.0 6.0 5.0 ...
   4 5 6         ... 3.0 1.0 2.0 ...
   7 8 9         ... 7.0 8.0 9.0 ...
                         ...

The filtered value corresponding to the pixel whose value is 5.0 is: $1*1.0+2*2.0+3*3.0+4*4.0+5*5.0+6*6.0+7*7.0+8*8.0+9*9.0$

See also
CPL_FILTER_MORPHO, cpl_image_filter()