www.gusucode.com > visionhdl工具箱matlab源码程序 > visionhdl/visionhdl/+visionhdl/en/ImageFilter.m
classdef ImageFilter< visionhdl.internal.abstractLineMemoryKernel & matlab.system.mixin.Propagates & matlab.system.mixin.CustomIcon & matlab.system.mixin.Nondirect %ImageFilter Performs two-dimensional FIR filtering of the input image using the specified filter coefficients. % filt2d = visionhdl.ImageFilter returns a System object, filt2d, % that performs two-dimensional (2-D) spatial FIR filtering of an input % stream based on the input control signals. % % filt2d = visionhdl.ImageFilter('PropertyName',PropertyValue,...) % returns a 2-D FIR filter System object, filt2d, with each specified % property set to the specified value. % % filt2d = visionhdl.ImageFilter(COEFF,MAXLINESIZE,'PropertyName',PropertyValue,...) % returns a 2-D FIR filter System object, filt2d, with the Coefficients % property set to COEFF, LineBufferSize property to MAXLINESIZE, and other % specified properties set to the specified values. % % Step method syntax: % [pixOut,ctrlOut] = step(filt2d,pixIn,ctrlIn) gives the FIR filter output % based on input data, control signals, and FIR coefficients. ctrlIn and % ctrlOut are structures consisting of five control signals. See also % <a href="matlab:doc visionhdl.FrameToPixels">visionhdl.FrameToPixels</a> or <a href="matlab:doc pixelcontrolstruct">pixelcontrolstruct</a>. % % System objects may be called directly like a function instead of using % the step method. For example, y = step(obj, x) and y = obj(x) are % equivalent. % % ImageFilter methods: % % step - See above description for use of this method % release - Allow property value and input characteristics changes % clone - Create 2-D FIR filter object with same property values % isLocked - Locked status (logical) % % ImageFilter properties: % % Coefficients - The kernel of the 2-D FIR filter % PaddingMethod - How to pad boundary of input image % PaddingValue - Constant value with which to pad image % LineBufferSize - Line buffer size % RoundingMethod - Rounding method when a number cannot be represented exactly % OverflowAction - wrap or saturate in the case of overflow % CoefficientsDataType - coefficients data type % CustomCoefficientsDataType - customized coefficients data type % OutputDataType - data type of the output % CustomOutputDataType - customized output data type % % % EXAMPLE: % % Apply a 2-D filter to an image. % frm2pix = visionhdl.FrameToPixels(... % 'VideoFormat','custom',... % 'ActivePixelsPerLine',32,... % 'ActiveVideoLines',18,... % 'TotalPixelsPerLine',42,... % 'TotalVideoLines',28,... % 'StartingActiveLine',6,... % 'FrontPorch',5); % [actPixPerLine,actLine,numPixPerFrm] = getparamfromfrm2pix(frm2pix); % % pix2frm = visionhdl.PixelsToFrame(... % 'VideoFormat','custom',... % 'ActivePixelsPerLine',actPixPerLine,... % 'ActiveVideoLines',actLine); % % filt2d = visionhdl.ImageFilter(... % 'CoefficientsDataType','Custom',... % 'CustomCoefficientsDataType',numerictype(true,2,0),... % 'OverflowAction','Saturate'); % % frmFull = imread('rice.png'); % frmIn = frmFull(74:73+actLine,104:103+actPixPerLine); % imshow(frmIn); % % pixOutVec = zeros(numPixPerFrm,1,'uint8'); % ctrlOutVec = repmat(pixelcontrolstruct,numPixPerFrm,1); % % [pixInVec,ctrlInVec] = step(frm2pix,frmIn); % for p = 1:numPixPerFrm % [pixOutVec(p),ctrlOutVec(p)] = step(filt2d,pixInVec(p),ctrlInVec(p)); % end % [frmOut,frmValid] = step(pix2frm,pixOutVec,ctrlOutVec); % % if frmValid % figure; % imshow(frmOut); % end % % See also vision.ImageFilter, imfilter. % Copyright 2014-2016 The MathWorks, Inc. methods function out=ImageFilter %ImageFilter Performs two-dimensional FIR filtering of the input image using the specified filter coefficients. % filt2d = visionhdl.ImageFilter returns a System object, filt2d, % that performs two-dimensional (2-D) spatial FIR filtering of an input % stream based on the input control signals. % % filt2d = visionhdl.ImageFilter('PropertyName',PropertyValue,...) % returns a 2-D FIR filter System object, filt2d, with each specified % property set to the specified value. % % filt2d = visionhdl.ImageFilter(COEFF,MAXLINESIZE,'PropertyName',PropertyValue,...) % returns a 2-D FIR filter System object, filt2d, with the Coefficients % property set to COEFF, LineBufferSize property to MAXLINESIZE, and other % specified properties set to the specified values. % % Step method syntax: % [pixOut,ctrlOut] = step(filt2d,pixIn,ctrlIn) gives the FIR filter output % based on input data, control signals, and FIR coefficients. ctrlIn and % ctrlOut are structures consisting of five control signals. See also % <a href="matlab:doc visionhdl.FrameToPixels">visionhdl.FrameToPixels</a> or <a href="matlab:doc pixelcontrolstruct">pixelcontrolstruct</a>. % % System objects may be called directly like a function instead of using % the step method. For example, y = step(obj, x) and y = obj(x) are % equivalent. % % ImageFilter methods: % % step - See above description for use of this method % release - Allow property value and input characteristics changes % clone - Create 2-D FIR filter object with same property values % isLocked - Locked status (logical) % % ImageFilter properties: % % Coefficients - The kernel of the 2-D FIR filter % PaddingMethod - How to pad boundary of input image % PaddingValue - Constant value with which to pad image % LineBufferSize - Line buffer size % RoundingMethod - Rounding method when a number cannot be represented exactly % OverflowAction - wrap or saturate in the case of overflow % CoefficientsDataType - coefficients data type % CustomCoefficientsDataType - customized coefficients data type % OutputDataType - data type of the output % CustomOutputDataType - customized output data type % % % EXAMPLE: % % Apply a 2-D filter to an image. % frm2pix = visionhdl.FrameToPixels(... % 'VideoFormat','custom',... % 'ActivePixelsPerLine',32,... % 'ActiveVideoLines',18,... % 'TotalPixelsPerLine',42,... % 'TotalVideoLines',28,... % 'StartingActiveLine',6,... % 'FrontPorch',5); % [actPixPerLine,actLine,numPixPerFrm] = getparamfromfrm2pix(frm2pix); % % pix2frm = visionhdl.PixelsToFrame(... % 'VideoFormat','custom',... % 'ActivePixelsPerLine',actPixPerLine,... % 'ActiveVideoLines',actLine); % % filt2d = visionhdl.ImageFilter(... % 'CoefficientsDataType','Custom',... % 'CustomCoefficientsDataType',numerictype(true,2,0),... % 'OverflowAction','Saturate'); % % frmFull = imread('rice.png'); % frmIn = frmFull(74:73+actLine,104:103+actPixPerLine); % imshow(frmIn); % % pixOutVec = zeros(numPixPerFrm,1,'uint8'); % ctrlOutVec = repmat(pixelcontrolstruct,numPixPerFrm,1); % % [pixInVec,ctrlInVec] = step(frm2pix,frmIn); % for p = 1:numPixPerFrm % [pixOutVec(p),ctrlOutVec(p)] = step(filt2d,pixInVec(p),ctrlInVec(p)); % end % [frmOut,frmValid] = step(pix2frm,pixOutVec,ctrlOutVec); % % if frmValid % figure; % imshow(frmOut); % end % % See also vision.ImageFilter, imfilter. end function FIRCore(in) %#ok<MANU> end function getDiscreteStateSpecificationImpl(in) %#ok<MANU> end function getExecutionSemanticsImpl(in) %#ok<MANU> % works in both classic and synchronous subsystems end function getHeaderImpl(in) %#ok<MANU> %getHeaderImpl Return header for object display end function getIconImpl(in) %#ok<MANU> end function getInputNamesImpl(in) %#ok<MANU> end function getNumInputsImpl(in) %#ok<MANU> end function getNumOutputsImpl(in) %#ok<MANU> end function getOutputDataTypeImpl(in) %#ok<MANU> end function getOutputNamesImpl(in) %#ok<MANU> end function getOutputSizeImpl(in) %#ok<MANU> end function getPropertyGroupsImpl(in) %#ok<MANU> end function int2fitype(in) %#ok<MANU> end function isInactivePropertyImpl(in) %#ok<MANU> end function isOutputComplexImpl(in) %#ok<MANU> end function isOutputFixedSizeImpl(in) %#ok<MANU> end function loadObjectImpl(in) %#ok<MANU> end function outputImpl(in) %#ok<MANU> % outputImpl: send output, no state update end function resetImpl(in) %#ok<MANU> end function saveObjectImpl(in) %#ok<MANU> % Save the public properties end function setDiscreteStateImpl(in) %#ok<MANU> end function setupImpl(in) %#ok<MANU> end function showSimulateUsingImpl(in) %#ok<MANU> end function updateImpl(in) %#ok<MANU> % updateImpl: update states, no output end function validateInputsImpl(in) %#ok<MANU> %coder.extrinsic('validatecontrolsignals'); end end methods (Abstract) end properties %CoeffCastFlip Flipped and cast coefficients % Stores the coefficients that are a flipped version of the Filter % Coefficients, and whose data type is cast according to the % coefficients data type CoeffCastFlip; %Coefficients Filter coefficients % Specify the 2D FIR filter kernel. The maximum size along each % dimension is 16. Coefficients; %CoefficientsDataType Coefficients data type % Specify the coefficient data type as one of % [ 'Same as first input' | 'Custom' ] CoefficientsDataType; %CustomCoefficientsDataType Custom coefficients data type % Customize the coefficients data type when CoefficientsDataType is % selected as 'Custom', default is 'numerictype(1,16,15)'. % The coefficients data type must be scaled and signed or unsigned. CustomCoefficientsDataType; %CustomOutputDataType Custom output date type % Customize the output data type when OutputDataType is % selected as 'Custom', default is 'numerictype(1,8,0)'. % The output data type must be scaled and signed or unsigned. CustomOutputDataType; %LineBufferSize Line buffer size % Specify the size of the line buffer. The value should be greater % than or equal to the number of active pixels per line. % The default value of this property is 2048. LineBufferSize; %OutputDataType Output data type % Specify the output data type as one of % [ 'Same as first input' | 'Full precision' | 'Custom' ] OutputDataType; %OverflowAction Overflow action % Specify the overflow action as one of % [ 'Wrap' | 'Saturate'] OverflowAction; %PaddingMethod Padding method % Indicate how to specify the padding method as one of % [ 'Constant' | 'Replicate' | 'Symmetric' ]. PaddingMethod; %PaddingValue Padding value % Specify the padding value as an integer scalar greater than or equal to % zero. This property is applicable when the PaddingMethod property % is 'Constant'. The default value of this property is 0. PaddingValue; %RoundingMethod Rounding method % Specify the rounding method as one of % [ 'Ceiling' | 'Convergent' | 'Floor' | 'Nearest' | 'Round' | 'Zero' ] RoundingMethod; end end