Documentation Center |
Package: vision
Perform 2-D FIR filtering of input matrix
H = vision.ImageFilter returns a System object, H. This object performs two-dimensional FIR filtering of an input matrix using the specified filter coefficient matrix.
H = vision.ImageFilter(Name,Value) returns an image filter System object, H, with each specified property set to the specified value. You can specify additional name-value pair arguments in any order as (Name1, Value1,...,NameN,ValueN).
Code Generation Support |
---|
Supports MATLAB^{®} Function block: Yes |
System Objects in MATLAB Code Generation. |
Code Generation Support, Usage Notes, and Limitations. |
SeparableCoefficients |
Set to true if filter coefficients are separable Using separable filter coefficients reduces the amount of calculations the object must perform to compute the output. The function isfilterseparable can be used to check filter separability. The default is false. | ||||
CoefficientsSource |
Source of filter coefficients Indicate how to specify the filter coefficients as one of Property | Input port. The default is Property. | ||||
Coefficients |
Filter coefficients Specify the filter coefficients as a real or complex-valued matrix. This property applies when you set the SeparableCoefficients property to false and the CoefficientsSource property to Property. The default is [1 0; 0 -1]. | ||||
VerticalCoefficients |
Vertical filter coefficients for the separable filter Specify the vertical filter coefficients for the separable filter as a vector. This property applies when you set the SeparableCoefficients property to true and the CoefficientsSource property to Property. The default is [4 0]. | ||||
HorizontalCoefficients |
Horizontal filter coefficients for the separable filter Specify the horizontal filter coefficients for the separable filter as a vector. This property applies when you set the SeparableCoefficients property to true and the CoefficientsSource property to Property. The default is [4 0]. | ||||
OutputSize |
Output size as full, valid or same as input image size Specify how to control the size of the output as one of Full | Same as first input | Valid. The default is Full. When you set this property to Full, the object outputs the image dimensions in the following way:
When you set this property to Same as first input, the object outputs the same dimensions as the input image. When you set this property to Valid, the object filters the input image only where the coefficient matrix fits entirely within it, and no padding is required. In this case, the dimensions of the output image are as follows:
| ||||
PaddingMethod |
How to pad boundary of input matrix Specify how to pad the boundary of input matrix as one of Constant | Replicate | Symmetric, | Circular. The default is Constant. Set this property to one of the following:
This property applies when you set the OutputSize property to Full or to Same as first input. | ||||
PaddingValueSource |
Source of padding value Specify how to define the constant boundary value as one of Property | Input port. This property applies when you set the PaddingMethod property to Constant. The default is Property. | ||||
PaddingValue |
Constant value with which to pad matrix Specify a constant value with which to pad the input matrix. This property applies when you set the PaddingMethod property to Constant and the PaddingValueSource property to Property. The default is 0. This property is tunable. | ||||
Method |
Method for filtering input matrix Specify the method by which the object filters the input matrix as one of Convolution | Correlation. The default is Convolution. |
clone | Create image filter object with same property values |
getNumInputs | Number of expected inputs to step method |
getNumOutputs | Number of outputs from step method |
isLocked | Locked status for input attributes and nontunable properties |
release | Allow property value and input characteristics changes |
step | Filter input image |
Filter an image to enhance the edges of 45 degree
img = im2single(rgb2gray(imread('peppers.png'))); hfir2d = vision.ImageFilter; hfir2d.Coefficients = [1 0; 0 -.5]; fImg = step(hfir2d, img); subplot(2,1,1);imshow(img);title('Original image') subplot(2,1,2);imshow(fImg);title('Filtered image')
This object implements the algorithm, inputs, and outputs described on the 2-D FIR Filter block reference page. The object properties correspond to the block parameters.