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

    classdef GammaCorrector< matlab.System & matlab.system.mixin.Propagates & matlab.system.mixin.CustomIcon & matlab.system.mixin.Nondirect
%GammaCorrector Applies or removes gamma correction.
%  gamma = visionhdl.GammaCorrector returns a System object, gamma, that 
%  applies or removes gamma correction.
%
%  gamma = visionhdl.GammaCorrector('PropertyName',PropertyValue,...)
%  returns a System object, gamma, with each specified property set to the 
%  specified value.
%
%  gamma = visionhdl.GammaCorrector(OPER,GAMMAVALUE,'PropertyName',PropertyValue,...) 
%  returns a Gamma correction System object, gamma, with the Correction 
%  property set to OPER (OPER is either 'Gamma' or 'De-gamma'), Gamma 
%  property to GAMMAVALUE (a numeric value greater than or equal to 1), and 
%  other specified properties set to the specified values.
%
%  Step method syntax:
%  [pixOut,ctrlOut] = step(gamma,pixIn,ctrlIn)
%  gives the intensity value after Gamma correction and the associated
%  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.
%
%  GammaCorrector methods:
%
%   step     - See above description for use of this method
%   release  - Allow property value and input characteristics changes
%   clone    - Create Gamma correction object with same property values
%   isLocked - Locked status (logical)
%
%  GammaCorrector properties:
%
%   Correction    - Gamma or De-gamma
%   Gamma         - (>=1) The Gamma value
%   LinearSegment - True if there is a linear portion near the origin
%   BreakPoint    - (0~1) Where the linear portion and Gamma curve meet
%
%   % EXAMPLE:
%   % Apply Gamma correction 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);
% 
% gamma = visionhdl.GammaCorrector; 
% 
% 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(gamma,pixInVec(p),ctrlInVec(p));
% end
% [frmOut,frmValid] = step(pix2frm,pixOutVec,ctrlOutVec);    
%     
% if frmValid
%    figure;
%    imshow(frmOut);
% end
%
%   See also vision.GammaCorrector, imadjust.

 
%  Copyright 2014-2016 The MathWorks, Inc.

    methods
        function out=GammaCorrector
            %GammaCorrector Applies or removes gamma correction.
            %  gamma = visionhdl.GammaCorrector returns a System object, gamma, that 
            %  applies or removes gamma correction.
            %
            %  gamma = visionhdl.GammaCorrector('PropertyName',PropertyValue,...)
            %  returns a System object, gamma, with each specified property set to the 
            %  specified value.
            %
            %  gamma = visionhdl.GammaCorrector(OPER,GAMMAVALUE,'PropertyName',PropertyValue,...) 
            %  returns a Gamma correction System object, gamma, with the Correction 
            %  property set to OPER (OPER is either 'Gamma' or 'De-gamma'), Gamma 
            %  property to GAMMAVALUE (a numeric value greater than or equal to 1), and 
            %  other specified properties set to the specified values.
            %
            %  Step method syntax:
            %  [pixOut,ctrlOut] = step(gamma,pixIn,ctrlIn)
            %  gives the intensity value after Gamma correction and the associated
            %  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.
            %
            %  GammaCorrector methods:
            %
            %   step     - See above description for use of this method
            %   release  - Allow property value and input characteristics changes
            %   clone    - Create Gamma correction object with same property values
            %   isLocked - Locked status (logical)
            %
            %  GammaCorrector properties:
            %
            %   Correction    - Gamma or De-gamma
            %   Gamma         - (>=1) The Gamma value
            %   LinearSegment - True if there is a linear portion near the origin
            %   BreakPoint    - (0~1) Where the linear portion and Gamma curve meet
            %
            %   % EXAMPLE:
            %   % Apply Gamma correction 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);
            % 
            % gamma = visionhdl.GammaCorrector; 
            % 
            % 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(gamma,pixInVec(p),ctrlInVec(p));
            % end
            % [frmOut,frmValid] = step(pix2frm,pixOutVec,ctrlOutVec);    
            %     
            % if frmValid
            %    figure;
            %    imshow(frmOut);
            % end
            %
            %   See also vision.GammaCorrector, imadjust.
        end

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

        function FloatDegamma(in) %#ok<MANU>
            %if dataIn < obj.BreakPoint*obj.Sls
        end

        function FloatGamma(in) %#ok<MANU>
            %if dataIn < obj.BreakPoint
        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 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>
            % output, do not update states
        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>
            % update states, no output
        end

        function validateInputsImpl(in) %#ok<MANU>
            %coder.extrinsic('validatecontrolsignals');
        end

    end
    methods (Abstract)
    end
    properties
        %BreakPoint Break point
        %   Enter a scalar value that indicates the I-axis value of the end of 
        %   the linear segment. This parameter is visible if you select the 
        %   Linear segment check box. 
        BreakPoint;

        %Correction Operation
        %   Specify the operation as one of 
        %   [ 'Gamma' | 'De-gamma' ]. 
        Correction;

        %Gamma Gamma
        %   Specify the Gamma value. Typical Gamma values range from 1 to 3.
        Gamma;

        %LinearSegment Linear segment
        %   Select this property to true if you want the Gamma curve to have a 
        %   linear portion near the origin.
        LinearSegment;

        %Table Table data
        %  The actual table contents used by GammaCorrector. 
        Table;

    end
end