Setting up vision.VideoFileWriter in multiObjectTracking.

4 views (last 30 days)
I need to write my tracking results to a new video file but Function obj is not accepting the filewriter variable:
obj = setupSystemObjects();
...
function obj = setupSystemObjects()
% Initialize Video I/O
% Create objects for reading a video from a file, drawing the tracked
% objects in each frame, and playing the video.
% Create a video file reader.
obj.reader = vision.VideoFileReader('D4_17.avi');
% Create two video players, one to display the video,
% and one to display the foreground mask.
obj.videoPlayer = vision.VideoPlayer('Position', [20, 200, 700, 400]);
obj.maskPlayer = vision.VideoPlayer('Position', [740, 200, 700, 400]);
obj.videoFWriter = vision.VideoFileWriter('C:\Users\Daevin\Videos\Loop\test.avi', ...
'FrameRate', videoFReader.info.VideoFrameRate');
% Create system objects for foreground detection and blob analysis
% The foreground detector is used to segment moving objects from
% the background. It outputs a binary mask, where the pixel value
% of 1 corresponds to the foreground and the value of 0 corresponds
% to the background.
obj.detector = vision.ForegroundDetector('NumGaussians', 3, ...
'NumTrainingFrames', 40, 'MinimumBackgroundRatio', 0.7);
% Connected groups of foreground pixels are likely to correspond to moving
% objects. The blob analysis system object is used to find such groups
% (called 'blobs' or 'connected components'), and compute their
% characteristics, such as area, centroid, and the bounding box.
obj.blobAnalyser = vision.BlobAnalysis('BoundingBoxOutputPort', true, ...
'AreaOutputPort', true, 'CentroidOutputPort', true, ...
'MinimumBlobArea', 400);
end
Error:Undefined function or variable 'setupSystemObjects'.
Any help would be greatly appriciated.

Answers (1)

Dima Lisin
Dima Lisin on 8 Sep 2014
Hi Daevin,
Are you modifying the example script? Are you running the modified script, or are you trying to run setupSystemObjects on the command line?

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!