www.gusucode.com > visionhdl工具箱matlab源码程序 > visionhdl/visionhdl/+visionhdl/en/Opening.m
classdef Opening< visionhdl.internal.abstractLineMemoryKernel & matlab.system.mixin.Propagates & matlab.system.mixin.CustomIcon & matlab.system.mixin.Nondirect %Opening Performs morphological opening on a binary image. % morphOpen = visionhdl.Opening returns a System object, morphOpen, % that performs morphological opening of an input stream based on the % input control signals. % % morphOpen = visionhdl.Opening('PropertyName',PropertyValue,...) % returns an opening System object, morphOpen, with each specified % property set to the specified value. % % morphOpen = visionhdl.Opening(Nhood,'PropertyName',PropertyValue,...) % returns an opening System object, morphOpen, with the Neighborhood % property set to Nhood, other specified properties set to the % specified values. % % Step method syntax: % [pixOut,ctrlOut] = step(morphOpen,pixIn,ctrlIn) performs % morphological opening. 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. % % Opening 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) % % Opening properties: % % Neighborhood - Neighborhood values % LineBufferSize - Line buffer size % % % EXAMPLE: % % Perform morphological opening on 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); % % morphOpen = visionhdl.Opening; % % frmFull = imread('peppers.png'); % frmIn = imresize(rgb2gray(frmFull),[actLine actPixPerLine])>100; % imshow(frmIn); % % pixOutVec = false(numPixPerFrm,1); % ctrlOutVec = repmat(pixelcontrolstruct,numPixPerFrm,1); % % [pixInVec,ctrlInVec] = step(frm2pix,frmIn); % for p = 1:numPixPerFrm % [pixOutVec(p),ctrlOutVec(p)] = step(morphOpen,pixInVec(p),ctrlInVec(p)); % end % [frmOut,frmValid] = step(pix2frm,pixOutVec,ctrlOutVec); % % if frmValid % figure; % imshow(frmOut); % end % % See also imopen. % Copyright 2014-2016 The MathWorks, Inc. methods function out=Opening %Opening Performs morphological opening on a binary image. % morphOpen = visionhdl.Opening returns a System object, morphOpen, % that performs morphological opening of an input stream based on the % input control signals. % % morphOpen = visionhdl.Opening('PropertyName',PropertyValue,...) % returns an opening System object, morphOpen, with each specified % property set to the specified value. % % morphOpen = visionhdl.Opening(Nhood,'PropertyName',PropertyValue,...) % returns an opening System object, morphOpen, with the Neighborhood % property set to Nhood, other specified properties set to the % specified values. % % Step method syntax: % [pixOut,ctrlOut] = step(morphOpen,pixIn,ctrlIn) performs % morphological opening. 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. % % Opening 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) % % Opening properties: % % Neighborhood - Neighborhood values % LineBufferSize - Line buffer size % % % EXAMPLE: % % Perform morphological opening on 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); % % morphOpen = visionhdl.Opening; % % frmFull = imread('peppers.png'); % frmIn = imresize(rgb2gray(frmFull),[actLine actPixPerLine])>100; % imshow(frmIn); % % pixOutVec = false(numPixPerFrm,1); % ctrlOutVec = repmat(pixelcontrolstruct,numPixPerFrm,1); % % [pixInVec,ctrlInVec] = step(frm2pix,frmIn); % for p = 1:numPixPerFrm % [pixOutVec(p),ctrlOutVec(p)] = step(morphOpen,pixInVec(p),ctrlInVec(p)); % end % [frmOut,frmValid] = step(pix2frm,pixOutVec,ctrlOutVec); % % if frmValid % figure; % imshow(frmOut); % end % % See also imopen. 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 isOutputComplexImpl(in) %#ok<MANU> end function isOutputFixedSizeImpl(in) %#ok<MANU> end function loadObjectImpl(in) %#ok<MANU> end function outputImpl(in) %#ok<MANU> % erosion+dilation end function resetImpl(in) %#ok<MANU> % reset states end function saveObjectImpl(in) %#ok<MANU> % Save the public properties end function setupImpl(in) %#ok<MANU> %coder.extrinsic('validatecontrolsignals'); end function showSimulateUsingImpl(in) %#ok<MANU> end function updateImpl(in) %#ok<MANU> % erosion+dilation end end methods (Abstract) end properties %LineBufferSize Line buffer size % Specify the maximum number of pixels in a horizontal line as an % positive integer. The default value of this property is 2048. LineBufferSize; %Neighborhood Neighborhood Neighborhood; end end