analyze - function analyze(ballMovieFilename) % ANALYZE % *...

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

View Full Document Right Arrow Icon
% ANALYZE % ******* % This function loads the specified avi movie to measure the vertical % trajectory of an object that moves across the frame. The object should % be light-colored on a black background. The function generates % position-time and velocity-time graphs for the vertical motion, using % pixels and frames as units. It also records a .mat data file with % vertical position, velocity, acceleration, and time variables, using the % same name as the movie % % Begin by clearing the output variables. clear px py area; c % Clear the console and close all open figures. clc; close all; c % Set constants. FRAME_WIDTH = 640; % Pixels. FRAME_HEIGHT = 480; % Pixels. MIN_BALL_AREA = 200; % Area in pixels^2 required for an object to be considered the ball. t % Set plotting parameters. FRAME_TICK = 15; % Spacing of frame ticks. MIN_VELOCITY = -50; % Minimum velocity to be displayed on plot, in pixels per frame. MAX_VELOCITY = 50; % Maximum velocity to be displayed on plot, in pixels per frame. VELOCITY_TICK = 25; % Spacing of velocity ticks, in pixels per frame. V % 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'); 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 % Make a time vector with units of frames. t = (1:nFrames)'; t % Set up figure 1 for plotting movie frames and centroids. figure(1);
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 / 6

analyze - function analyze(ballMovieFilename) % ANALYZE % *...

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