www.gusucode.com > visionhdl工具箱matlab源码程序 > visionhdl/visionhdl/+visionhdl/en/FrameToPixels.m
classdef FrameToPixels< matlab.System %FrameToPixels Converts color or greyscale full-frame video to a pixel stream and control structure. % frm2pix = visionhdl.FrameToPixels returns a System object, frm2pix, that % serializes a greyscale 1080x1920 frame into a 1080p pixel stream with % standard padding around the active data. % % frm2pix = visionhdl.FrameToPixels('PropertyName',PropertyValue,...) % returns a System object, frm2pix, with each specified property set to % the specified value. % % Step method syntax: % [pixInVec,ctrlInVec] = step(frm2pix,frmIn) converts a full-frame video % frmIn into a pixel stream pixInVec and a vector of control structures % ctrlInVec. Each element of ctrlInVec 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. % % FrameToPixels methods: % % step - See above description for use of this method % release - Allow property value and input characteristics changes % clone - Create chroma resampler object with same property values % isLocked - Locked status (logical) % % FrameToPixels properties: % % NumComponents - Components of each pixel % VideoFormat - Video format % ActivePixelsPerLine - Number of active pixels per line % ActiveVideoLines - Number of active video lines % TotalPixelsPerLine - Number of total pixels per line % TotalVideoLines - Number of total video lines % StartingActiveLine - Line number of the starting active line % FrontPorch - Length of the front porch % % % EXAMPLE: % % Pass through an image via pixel streaming % frm2pix = visionhdl.FrameToPixels(... % 'VideoFormat','custom',... % 'ActivePixelsPerLine',66,... % 'ActiveVideoLines',44,... % 'TotalPixelsPerLine',116,... % 'TotalVideoLines',54,... % 'StartingActiveLine',6,... % 'FrontPorch',25); % [actPixPerLine,actLine,numPixPerFrm] = getparamfromfrm2pix(frm2pix); % % pix2frm = visionhdl.PixelsToFrame(... % 'VideoFormat','custom',... % 'ActivePixelsPerLine',actPixPerLine,... % 'ActiveVideoLines',actLine); % % frmFull = rgb2gray(imread('pears.png')); % frmIn = imresize(frmFull,[actLine actPixPerLine]); % imshow(frmIn); % % pixOutVec = zeros(numPixPerFrm,1,'uint8'); % ctrlOutVec = repmat(pixelcontrolstruct,numPixPerFrm,1); % % [pixInVec,ctrlInVec] = step(frm2pix,frmIn); % for p = 1:numPixPerFrm % % Your pixel-streaming video algorithms here % % A simple pass-through in this example % pixOutVec(p) = pixInVec(p); % ctrlOutVec(p) = ctrlInVec(p); % end % [frmOut,frmValid] = step(pix2frm,pixOutVec,ctrlOutVec); % % if frmValid % figure; % imshow(frmOut); % end % % See also visionhdl.PixelsToFrame. % Copyright 2014-2016 The MathWorks, Inc. methods function out=FrameToPixels %FrameToPixels Converts color or greyscale full-frame video to a pixel stream and control structure. % frm2pix = visionhdl.FrameToPixels returns a System object, frm2pix, that % serializes a greyscale 1080x1920 frame into a 1080p pixel stream with % standard padding around the active data. % % frm2pix = visionhdl.FrameToPixels('PropertyName',PropertyValue,...) % returns a System object, frm2pix, with each specified property set to % the specified value. % % Step method syntax: % [pixInVec,ctrlInVec] = step(frm2pix,frmIn) converts a full-frame video % frmIn into a pixel stream pixInVec and a vector of control structures % ctrlInVec. Each element of ctrlInVec 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. % % FrameToPixels methods: % % step - See above description for use of this method % release - Allow property value and input characteristics changes % clone - Create chroma resampler object with same property values % isLocked - Locked status (logical) % % FrameToPixels properties: % % NumComponents - Components of each pixel % VideoFormat - Video format % ActivePixelsPerLine - Number of active pixels per line % ActiveVideoLines - Number of active video lines % TotalPixelsPerLine - Number of total pixels per line % TotalVideoLines - Number of total video lines % StartingActiveLine - Line number of the starting active line % FrontPorch - Length of the front porch % % % EXAMPLE: % % Pass through an image via pixel streaming % frm2pix = visionhdl.FrameToPixels(... % 'VideoFormat','custom',... % 'ActivePixelsPerLine',66,... % 'ActiveVideoLines',44,... % 'TotalPixelsPerLine',116,... % 'TotalVideoLines',54,... % 'StartingActiveLine',6,... % 'FrontPorch',25); % [actPixPerLine,actLine,numPixPerFrm] = getparamfromfrm2pix(frm2pix); % % pix2frm = visionhdl.PixelsToFrame(... % 'VideoFormat','custom',... % 'ActivePixelsPerLine',actPixPerLine,... % 'ActiveVideoLines',actLine); % % frmFull = rgb2gray(imread('pears.png')); % frmIn = imresize(frmFull,[actLine actPixPerLine]); % imshow(frmIn); % % pixOutVec = zeros(numPixPerFrm,1,'uint8'); % ctrlOutVec = repmat(pixelcontrolstruct,numPixPerFrm,1); % % [pixInVec,ctrlInVec] = step(frm2pix,frmIn); % for p = 1:numPixPerFrm % % Your pixel-streaming video algorithms here % % A simple pass-through in this example % pixOutVec(p) = pixInVec(p); % ctrlOutVec(p) = ctrlInVec(p); % end % [frmOut,frmValid] = step(pix2frm,pixOutVec,ctrlOutVec); % % if frmValid % figure; % imshow(frmOut); % end % % See also visionhdl.PixelsToFrame. end function getHeaderImpl(in) %#ok<MANU> end function getInputNamesImpl(in) %#ok<MANU> end function getNumInputsImpl(in) %#ok<MANU> end function getNumOutputsImpl(in) %#ok<MANU> end function getOutputNamesImpl(in) %#ok<MANU> end function isInactivePropertyImpl(in) %#ok<MANU> end function isInputSizeLockedImpl(in) %#ok<MANU> end function isOutputComplexityLockedImpl(in) %#ok<MANU> end function resetStates(in) %#ok<MANU> end function setupImpl(in) %#ok<MANU> end function stepImpl(in) %#ok<MANU> end end methods (Abstract) end properties ActivePixelsPerLine; ActiveVideoLines; FrontPorch; %NumComponents Number of components % Specify the number of color components of the input matrix. % Choose from 1, 3, and 4. NumComponents; StartingActiveLine; TotalPixelsPerLine; TotalVideoLines; VideoFormat; end end