DIPlib Documentation - ©1995-2008 Quantitative Imaging Group, Delft University of Technology.

FiniteDifference

A linear gradient filter

SYNOPSIS

#include "dip_linear.h"

dip_Error dip_FiniteDifference ( in, out, boundary, processDim, filter )

DATA TYPES

binary, integer, float, complex

FUNCTION

The FiniteDifference filter implements several basic one dimensional FIR convolution filters. The dimension in which the operation is to be performed is specified by processDim. The operation itself is selected with filter. The (1 0 11)/2, (1 -1 0) & (0 1 -1) are difference filters that approximate a first order derivative, the (1 -2 1) filter approximates a second order derivative operation. The piramid shaped (1 2 1)/4 filter is a local smoothing filter. All filters are normalized (sum of filter coeff. is 0 or 1).

ARGUMENTS

Data typeNameDescription
dip_ImageinInput image
dip_ImageoutOutput image
dip_BoundaryArrayboundaryBoundary conditions
dip_intprocessDimProcessDim
dipf_FiniteDifferencefilterFilter selection

The dipf_FiniteDifference enumeration consists of the following flags:

NameDescription
DIP_FINITE_DIFFERENCE_M101out[ii] = (in[ii+1] - in[ii-1])/2
DIP_FINITE_DIFFERENCE_0M11out[ii] = in[ii+1] - in[ii]
DIP_FINITE_DIFFERENCE_M110out[ii] = in[ii] - in[ii-1]
DIP_FINITE_DIFFERENCE_1M21out[ii] = in[ii-1] - 2*in[ii] + in[ii+1]
DIP_FINITE_DIFFERENCE_121out[ii] = (in[ii-1] + 2*in[ii] + in[ii+1])/4

SEE ALSO

General information about convolution

FiniteDifferenceEx, SobelGradient, Uniform, Gauss, SeparableConvolution, Convolve1d, Derivative

DIPlib on-line documentation | Function reference | Global function index