www.gusucode.com > visionhdl工具箱matlab源码程序 > visionhdl/visionhdl/+visionhdl/en/MedianFilter.m
classdef MedianFilter< visionhdl.internal.abstractLineMemoryKernel & matlab.system.mixin.Propagates & matlab.system.mixin.CustomIcon & matlab.system.mixin.Nondirect %MedianFilter Performs median filtering of the input image. % medianFilt = visionhdl.MedianFilter returns a System object, % medianFilt, that performs two-dimensional median filtering of an % input stream based on the input control signals. % % medianFilt = visionhdl.MedianFilter('PropertyName',PropertyValue,...) % returns a median filter System object, medianFilt, with each specified % property set to the specified value. % % medianFilt = visionhdl.MedianFilter(SIZE,'PropertyName',PropertyValue,...) % returns a median filter System object, medianFilt, with the % NeighborhoodSize property set to SIZE and other specified properties % set to the specified values. % % Step method syntax: % [pixOut,CtrlOut] = step(medianFilt,pixIn,CtrlIn) returns a median % value of NeighborhoodSize based on input data and control signals. % 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. % % MedianFilter methods: % % step - See above description for use of this method % release - Allow property value and input characteristics changes % clone - Create median filter object with same property values % isLocked - Locked status (logical) % % MedianFilter properties: % % NeighborhoodSize - Size of neighborhood to compute the median % PaddingMethod - How to pad boundary of input image % PaddingValue - Constant value with which to pad image % LineBufferSize - Line buffer size % % % EXAMPLE: % % Perform median filtering on an image with salt and pepper noise. % 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); % % medianFilt = visionhdl.MedianFilter; % % frmFull = imread('rice.png'); % frmIn = imnoise(frmFull(74:73+actLine,104:103+actPixPerLine),'salt & pepper'); % 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(medianFilt,pixInVec(p),ctrlInVec(p)); % end % [frmOut,frmValid] = step(pix2frm,pixOutVec,ctrlOutVec); % % if frmValid % figure; % imshow(frmOut); % end % % See also medfilt2. % Copyright 2014-2016 The MathWorks, Inc. methods function out=MedianFilter %MedianFilter Performs median filtering of the input image. % medianFilt = visionhdl.MedianFilter returns a System object, % medianFilt, that performs two-dimensional median filtering of an % input stream based on the input control signals. % % medianFilt = visionhdl.MedianFilter('PropertyName',PropertyValue,...) % returns a median filter System object, medianFilt, with each specified % property set to the specified value. % % medianFilt = visionhdl.MedianFilter(SIZE,'PropertyName',PropertyValue,...) % returns a median filter System object, medianFilt, with the % NeighborhoodSize property set to SIZE and other specified properties % set to the specified values. % % Step method syntax: % [pixOut,CtrlOut] = step(medianFilt,pixIn,CtrlIn) returns a median % value of NeighborhoodSize based on input data and control signals. % 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. % % MedianFilter methods: % % step - See above description for use of this method % release - Allow property value and input characteristics changes % clone - Create median filter object with same property values % isLocked - Locked status (logical) % % MedianFilter properties: % % NeighborhoodSize - Size of neighborhood to compute the median % PaddingMethod - How to pad boundary of input image % PaddingValue - Constant value with which to pad image % LineBufferSize - Line buffer size % % % EXAMPLE: % % Perform median filtering on an image with salt and pepper noise. % 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); % % medianFilt = visionhdl.MedianFilter; % % frmFull = imread('rice.png'); % frmIn = imnoise(frmFull(74:73+actLine,104:103+actPixPerLine),'salt & pepper'); % 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(medianFilt,pixInVec(p),ctrlInVec(p)); % end % [frmOut,frmValid] = step(pix2frm,pixOutVec,ctrlOutVec); % % if frmValid % figure; % imshow(frmOut); % end % % See also medfilt2. end function OddEvenMerge(in) %#ok<MANU> end function basicsort(in) %#ok<MANU> % sort 3, 5, 7, 9, 11, 13 elements using the best-known approach % http://www.angelfire.com/blog/ronz/Articles/999SortingNetworksReferen.html % merge table end function compare_exchange(in) %#ok<MANU> end function createParamWithDatatype(in) %#ok<MANU> end function finalCompare(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 isInactivePropertyImpl(in) %#ok<MANU> % switch prop end function isOutputComplexImpl(in) %#ok<MANU> end function isOutputFixedSizeImpl(in) %#ok<MANU> end function loadObjectImpl(in) %#ok<MANU> end function medianCore(in) %#ok<MANU> end function outputImpl(in) %#ok<MANU> % outputImpl: send output, no state update % control signal generation end function resetImpl(in) %#ok<MANU> % resetImpl % since the states have already been appropriately sized by % setupImpl, we just need to initialize them end function saveObjectImpl(in) %#ok<MANU> % Save the public properties end function setupImpl(in) %#ok<MANU> end function showSimulateUsingImpl(in) %#ok<MANU> end function startFrameCleanup(in) %#ok<MANU> end function startFrameCleanupOutputs(in) %#ok<MANU> end function updateImpl(in) %#ok<MANU> % updateImpl: no output, only state update end end methods (Abstract) end properties %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; %NeighborhoodSize Neighborhood size % Indicate how to specify the neighborhood size as one of [ '3x3' % | '5x5' | '7x7' ]. NeighborhoodSize; %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; end end