www.gusucode.com > visionhdl工具箱matlab源码程序 > visionhdl/visionhdl/+visionhdl/en/PixelsToFrame.m
classdef PixelsToFrame< matlab.System %PixelsToFrame Converts a pixel stream and control structures into color or greyscale full-frame video. % pix2frm = visionhdl.PixelsToFrame returns a System object, pix2frm, that % converts a 1080p pixel stream, with standard padding, to a greyscale % 1080x1920 frame. % % pix2frm = visionhdl.PixelsToFrame('PropertyName',PropertyValue,...) % returns a System object, pix2frm, with each specified property set to % the specified value. % % Step method syntax: % [frmOut,frmValid] = step(pix2frm,pixOutVec,ctrlOutVec) converts a pixel % stream pixOutVec and a vector of control structures ctrlOutVec to a % full-frame image frmOut. frmOut is valid when frmValid is asserted high. % Each element of ctrlOutVec 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. % % PixelsToFrame 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) % % PixelsToFrame properties: % % NumComponents - Components of each pixel % VideoFormat - Video format % ActivePixelsPerLine - Number of active pixels per line % ActiveVideoLines - Number of active video lines % % % 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.FrameToPixels. % Copyright 2014-2016 The MathWorks, Inc. methods function out=PixelsToFrame %PixelsToFrame Converts a pixel stream and control structures into color or greyscale full-frame video. % pix2frm = visionhdl.PixelsToFrame returns a System object, pix2frm, that % converts a 1080p pixel stream, with standard padding, to a greyscale % 1080x1920 frame. % % pix2frm = visionhdl.PixelsToFrame('PropertyName',PropertyValue,...) % returns a System object, pix2frm, with each specified property set to % the specified value. % % Step method syntax: % [frmOut,frmValid] = step(pix2frm,pixOutVec,ctrlOutVec) converts a pixel % stream pixOutVec and a vector of control structures ctrlOutVec to a % full-frame image frmOut. frmOut is valid when frmValid is asserted high. % Each element of ctrlOutVec 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. % % PixelsToFrame 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) % % PixelsToFrame properties: % % NumComponents - Components of each pixel % VideoFormat - Video format % ActivePixelsPerLine - Number of active pixels per line % ActiveVideoLines - Number of active video lines % % % 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.FrameToPixels. end function DisplayFrame(in) %#ok<MANU> end function endLastVideoLine(in) %#ok<MANU> end function endVideoFrame(in) %#ok<MANU> end function endVideoLine(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 isInputComplexityLockedImpl(in) %#ok<MANU> end function isInputSizeLockedImpl(in) %#ok<MANU> end function isOutputComplexityLockedImpl(in) %#ok<MANU> end function processPixel(in) %#ok<MANU> end function resetStates(in) %#ok<MANU> end function setupImpl(in) %#ok<MANU> end function startFirstVideoLine(in) %#ok<MANU> end function startVideoFrame(in) %#ok<MANU> end function startVideoLine(in) %#ok<MANU> end function stepImpl(in) %#ok<MANU> end function updateFrameStore(in) %#ok<MANU> % Update Ping pong buffer scheme end function validateInputsImpl(in) %#ok<MANU> %coder.extrinsic('validatecontrolsignals'); end end methods (Abstract) end properties ActivePixelsPerLine; ActiveVideoLines; %NumComponents Number of components % Specify the number of color components of the input matrix. % Choose from 1, 3, and 4. NumComponents; VideoFormat; end end