evaluate - function evaluate(carMovieFilename EVALUATE This...

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

View Full Document Right Arrow Icon
function evaluate(carMovieFilename) % EVALUATE % ******** % This function loads the specified avi movie to measure the trajectory of % two red objects that move across the frame. The function generates % plots and writes a .mat file of the captured horizontal motion data % for the two objects, using meters and seconds as units. %carMovieFilename = 'collision' % % Begin by clearing the output variables and the console. clear px py area; clc; c % Suppress movie output during processing. showMovie = false; s % Set the differentiation mode. secondOrder = false; s % Set constants. FRAME_WIDTH = 640; % Pixels. FRAME_HEIGHT = 480; % Pixels. MIN_CAR_MARKER_AREA = 200; % Area in pixels^2 required for an object to be considered the car. c % Set plotting parameters. TIME_TICK = 0.5; % Spacing of time ticks, in seconds. MIN_VELOCITY = -1.5; % Minimum velocity to be displayed on plot, in m/s. MAX_VELOCITY = 1.5; % Maximum velocity to be displayed on plot, in m/s. VELOCITY_TICK = .5; % Spacing of velocity ticks, in m/s. MIN_ACCELERATION = -15; % Minimum acceleration to be displayed on plot, in m/s^2. MAX_ACCELERATION = 15; % Maximum acceleration to be displayed on plot, in m/s^2. ACCELERATION_TICK = 5; % Spacing of acceleration ticks, in m/s^2. A % Define sentinel values. NO_OBJECTS = -1; % Two objects were not located in frame. OBJECTS_TOO_SMALL = -2; % No objects over the minimum car area were found. OBJECT_AT_EDGE = -3; % The object's bounding box is touching the left or right edge of the frame. e % 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 "' carMovieFilename '" . . .']); carMovie = aviread(carMovieFilename); disp(['Done loading "' carMovieFilename '"']); d % Now tell the user the number of frames in this movie and store in a variable. nFrames = length(carMovie); disp([sprintf('\n') 'This movie contains ' num2str(nFrames) ' frames.']) d % Now load the camera calibration and tell the user about it. try
Background image of page 1

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

View Full DocumentRight Arrow Icon
load camera_calibration; catch calibrate_evaluate; load camera_calibration; end disp([sprintf('\nHello ') STUDENT_NAMES '.']) disp(['I am using a camera view calibration of ' num2str(CAMERA_VIEW_WIDTH_M) ' m wide,']); disp(['shooting at ' num2str(CAMERA_FRAME_RATE_FPS) ' fps.']); d % Wait for a second to let the user read the above messages. pause(1); p % Make a time vector. t = (0:(1/CAMERA_FRAME_RATE_FPS):((nFrames-1)/CAMERA_FRAME_RATE_FPS))'; t % Set up figure 1 for plotting movie frames and centroids. figure(1); clf; set(gcf,'Position',[340 350 600 425]) s % The first plot will hold the frames with overlaid car centroids. axis image
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 8

evaluate - function evaluate(carMovieFilename EVALUATE This...

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

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