www.gusucode.com > visionhdl工具箱matlab源码程序 > visionhdl/visionhdl/+visionhdl/en/MeasureTiming.m
classdef MeasureTiming< matlab.System & matlab.system.mixin.Propagates & matlab.system.mixin.CustomIcon & matlab.system.mixin.Nondirect %MeasureTiming Measures the timing of the pixel control bus input. % measure = visionhdl.MeasureTiming returns a System object, measure, that % measures the timing of the control signals in the input pixel control % structure. Use these measurements to characterize an input video stream, and % verify that it confirms to minimum blanking intervals required by some video % processing algorithms. % % There are six outputs which represent the running averages of their respective % timing regions in the current video frame. Each average is of type double. The object % measures intervals in pixel clock cycles. % * activePixels -- average number of active pixels per line % * activeLines -- average number of active lines in the frame % * totalPixels -- average number of pixels in the frame, measured from hStart to % the next hStart % * totalLines -- average number of lines in the frame, measured by the interval from vEnd % to the next vEnd, divided by totalPixels % * horizBlank -- average number of pixels in the horizontal blanking interval, measured % between hEnd and the next hStart % * vertBlank -- average number of lines in the vertical blanking interval, measured by % the interval from vEnd to the next vStart, divided by totalPixels % % Since some of the measurements require more than one frame to be valid, the % first measurements are often incorrect and include the time from the first % usage of the object, not from the previous frame. The results from the second % and subsequent frames are always valid. % % Note that this object does not generate HDL code and is used in simulation only. % % 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. % % % EXAMPLE: % % Measure the timing of a custom frame % 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); % % measure = visionhdl.MeasureTiming; % % 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 f = 1:2 % for p = 1:numPixPerFrm % [activePixels, activeLines, totalPixels, totalLines, horizBlank, vertBlank] = step(measure,ctrlInVec(p)); % end % fprintf('\nFor Frame %d:\n', f); % fprintf('activePixels: %f\n', activePixels); % fprintf('activeLines: %f\n', activeLines); % fprintf('totalPixels: %f\n', totalPixels); % fprintf('totalLines: %f\n', totalLines); % fprintf('horizBlank: %f\n', horizBlank); % fprintf('vertBlank: %f\n', vertBlank); % end % % % See also visionhdl.FrameToPixels, visionhdl.PixelsToFrame % Copyright 2016 The MathWorks, Inc. methods function out=MeasureTiming %MeasureTiming Measures the timing of the pixel control bus input. % measure = visionhdl.MeasureTiming returns a System object, measure, that % measures the timing of the control signals in the input pixel control % structure. Use these measurements to characterize an input video stream, and % verify that it confirms to minimum blanking intervals required by some video % processing algorithms. % % There are six outputs which represent the running averages of their respective % timing regions in the current video frame. Each average is of type double. The object % measures intervals in pixel clock cycles. % * activePixels -- average number of active pixels per line % * activeLines -- average number of active lines in the frame % * totalPixels -- average number of pixels in the frame, measured from hStart to % the next hStart % * totalLines -- average number of lines in the frame, measured by the interval from vEnd % to the next vEnd, divided by totalPixels % * horizBlank -- average number of pixels in the horizontal blanking interval, measured % between hEnd and the next hStart % * vertBlank -- average number of lines in the vertical blanking interval, measured by % the interval from vEnd to the next vStart, divided by totalPixels % % Since some of the measurements require more than one frame to be valid, the % first measurements are often incorrect and include the time from the first % usage of the object, not from the previous frame. The results from the second % and subsequent frames are always valid. % % Note that this object does not generate HDL code and is used in simulation only. % % 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. % % % EXAMPLE: % % Measure the timing of a custom frame % 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); % % measure = visionhdl.MeasureTiming; % % 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 f = 1:2 % for p = 1:numPixPerFrm % [activePixels, activeLines, totalPixels, totalLines, horizBlank, vertBlank] = step(measure,ctrlInVec(p)); % end % fprintf('\nFor Frame %d:\n', f); % fprintf('activePixels: %f\n', activePixels); % fprintf('activeLines: %f\n', activeLines); % fprintf('totalPixels: %f\n', totalPixels); % fprintf('totalLines: %f\n', totalLines); % fprintf('horizBlank: %f\n', horizBlank); % fprintf('vertBlank: %f\n', vertBlank); % end % % % See also visionhdl.FrameToPixels, visionhdl.PixelsToFrame 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 getOutputDataTypeImpl(in) %#ok<MANU> end function getOutputSizeImpl(in) %#ok<MANU> end function isOutputComplexImpl(in) %#ok<MANU> end function isOutputFixedSizeImpl(in) %#ok<MANU> end function lineFrameFSM(in) %#ok<MANU> % Uses the input register in the object to % update InFrame and InLine % ActivePixelCounter % ActiveLineCounter % TotalPixelCounter % TotalLineCounter % VBICounter % HBICounter end function loadObjectImpl(in) %#ok<MANU> end function outputImpl(in) %#ok<MANU> 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> end function validateInputsImpl(in) %#ok<MANU> end end methods (Abstract) end end