examine - function examine(ballMovieFilename) % EXAMINE % *...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
function examine(ballMovieFilename) % EXAMINE % ******* % This function loads the specified avi movie to measure the trajectory of an % object that moves across the frame. The object should be light-colored on a black background. % The function outputs a text file and generates quick plots, using pixels and frames as units. f % Begin by clearing the console and the output variables. clc; clear x y area; c % Set constants. FRAME_WIDTH = 640; % Pixels. FRAME_HEIGHT = 480; % Pixels. TIME_TICK = 1; % Spacing of time ticks, in seconds. MIN_BALL_AREA = 200; % Area in pixels^2 required for an object to be considered the ball. %MAX_VELOCITY = 50; % Maximum velocity to illustrate on plots, in pixels/frame. % % Define sentinel values. NO_OBJECTS = -1; % No objects were located in frame. OBJECT_TOO_SMALL = -2; % No objects over the minimum ball area were found. OBJECT_AT_EDGE = -3; % The object's bounding box is touching the edge of the frame. f % Print a banner. banner = sprintf('\nMEAM 147: Introduction to Mechanics Lab\nUniversity of Pennsylvania\nProfessor K. J. Kuchenbecker\n\n'); disp(banner); clear banner; d % Load the specified avi movie file. disp(['Loading "' ballMovieFilename '" . . .']); ballMovie = aviread(ballMovieFilename); disp(['Done loading "' ballMovieFilename '"']); d % Now tell the user the number of frames in this movie and store in a variable. nFrames = length(ballMovie); disp([sprintf('\n') 'This movie contains ' num2str(nFrames) ' frames.']) d % Now load the camera calibration and tell the user about it. load camera_calibration; disp([sprintf('\n') 'Using a camera view calibration of ' num2str(CAMERA_VIEW_HEIGHT_M) ' m tall and ' num2str(CAMERA_VIEW_WIDTH_M) ' m wide,' sprintf('\n') ' shooting at ' num2str(CAMERA_FRAME_RATE_FPS) ' fps.']) w % Make a time vector. t = (0:(1/CAMERA_FRAME_RATE_FPS):((nFrames-1)/CAMERA_FRAME_RATE_FPS))';
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 09/13/2011 for the course MEAN 147 taught by Professor Pauloe.arratia during the Fall '10 term at UPenn.

Page1 / 5

examine - function examine(ballMovieFilename) % EXAMINE % *...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online