gusucode.com > visionhdl工具箱matlab源码程序 > visionhdl/visionhdl/+visionhdl/en/ImageStatistics.m

    classdef ImageStatistics< matlab.System & matlab.system.mixin.Propagates & matlab.system.mixin.CustomIcon & matlab.system.mixin.Nondirect
%ImageStatistics Computes the mean, variance and standard deviation of the input image.
%  stat = visionhdl.ImageStatistics returns a System object, stat, that 
%  computes the statistics of a two-dimensional image.   
%
%  Step method syntax:
%  [mean,variance,stdDev,validOut] = step(stat,pixIn,ctrlIn) gives the 
%  first order statistics of the input data, where blanking intervals 
%  are indicated by the input control signals. ctrlIn is a structure 
%  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.
%
%  ImageStatistics methods:
%
%   step     - See above description for use of this method
%   release  - Allow property value and input characteristics changes
%   clone    - Create 2-D Statistics object with same property values
%   isLocked - Locked status (logical)
%
%  ImageStatistics properties: -
%
%   mean     - Enable the computation and output of the mean.
%   variance - Enable the computation and output of the variance.
%   stdDev   - Enable the computation and output of the standard deviation.
%
%   % EXAMPLE:
%   % Calculate image statistic
% frm2pix = visionhdl.FrameToPixels(...
%     'VideoFormat','custom',...
%     'ActivePixelsPerLine',32,...
%     'ActiveVideoLines',18,...
%     'TotalPixelsPerLine',42,...
%     'TotalVideoLines',28,...
%     'StartingActiveLine',6,...
%     'FrontPorch',5);
% [actPixPerLine,actLine,numPixPerFrm] = getparamfromfrm2pix(frm2pix);
%
% stat = visionhdl.ImageStatistics;
%
% frmFull = imread('pout.tif');
% frmIn = frmFull(79:78+actLine,93:92+actPixPerLine);
%
% meanOut = zeros(numPixPerFrm,1,'uint8');
% varOut = zeros(numPixPerFrm,1,'uint16');
% stdDevOut = zeros(numPixPerFrm,1,'uint8');
%
% [pixInVec,ctrlInVec] = step(frm2pix,frmIn);
% for p = 1:numPixPerFrm
%     [meanOut(p),varOut(p),stdDevOut(p),~] = step(stat,pixInVec(p),ctrlInVec(p));
% end
%
%   See also vision.Mean, vision.Variance, vision.StandardDeviation,
%   mean, var, std2.

   
    %   Copyright 2014-2016 The MathWorks, Inc.

    methods
        function out=ImageStatistics
            %ImageStatistics Computes the mean, variance and standard deviation of the input image.
            %  stat = visionhdl.ImageStatistics returns a System object, stat, that 
            %  computes the statistics of a two-dimensional image.   
            %
            %  Step method syntax:
            %  [mean,variance,stdDev,validOut] = step(stat,pixIn,ctrlIn) gives the 
            %  first order statistics of the input data, where blanking intervals 
            %  are indicated by the input control signals. ctrlIn is a structure 
            %  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.
            %
            %  ImageStatistics methods:
            %
            %   step     - See above description for use of this method
            %   release  - Allow property value and input characteristics changes
            %   clone    - Create 2-D Statistics object with same property values
            %   isLocked - Locked status (logical)
            %
            %  ImageStatistics properties: -
            %
            %   mean     - Enable the computation and output of the mean.
            %   variance - Enable the computation and output of the variance.
            %   stdDev   - Enable the computation and output of the standard deviation.
            %
            %   % EXAMPLE:
            %   % Calculate image statistic
            % frm2pix = visionhdl.FrameToPixels(...
            %     'VideoFormat','custom',...
            %     'ActivePixelsPerLine',32,...
            %     'ActiveVideoLines',18,...
            %     'TotalPixelsPerLine',42,...
            %     'TotalVideoLines',28,...
            %     'StartingActiveLine',6,...
            %     'FrontPorch',5);
            % [actPixPerLine,actLine,numPixPerFrm] = getparamfromfrm2pix(frm2pix);
            %
            % stat = visionhdl.ImageStatistics;
            %
            % frmFull = imread('pout.tif');
            % frmIn = frmFull(79:78+actLine,93:92+actPixPerLine);
            %
            % meanOut = zeros(numPixPerFrm,1,'uint8');
            % varOut = zeros(numPixPerFrm,1,'uint16');
            % stdDevOut = zeros(numPixPerFrm,1,'uint8');
            %
            % [pixInVec,ctrlInVec] = step(frm2pix,frmIn);
            % for p = 1:numPixPerFrm
            %     [meanOut(p),varOut(p),stdDevOut(p),~] = step(stat,pixInVec(p),ctrlInVec(p));
            % end
            %
            %   See also vision.Mean, vision.Variance, vision.StandardDeviation,
            %   mean, var, std2.
        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>
            %getPropertyGroupsImpl   Return property groups for object display
        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, do not update states
        end

        function resetImpl(in) %#ok<MANU>
        end

        function saveObjectImpl(in) %#ok<MANU>
            % Save the public properties
        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
        %mean Enable mean output
        %   The logical value returned by the property indicates whether to
        %   output the mean or otherwise.
        mean;

        %stdDev Enable std. deviation output
        %   The logical value returned by the property indicates whether to
        %   output the variance or otherwise.
        stdDev;

        %variance Enable variance output
        %   The logical value returned by the property indicates whether to
        %   output the variance or otherwise.
        variance;

    end
end