Setting up vision.VideoFileWriter in multiObjectTracking.

조회 수: 15 (최근 30일)
Daevin
Daevin 2014년 9월 8일
답변: Dima Lisin 2014년 9월 8일
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.

답변 (1개)

Dima Lisin
Dima Lisin 2014년 9월 8일
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?

카테고리

Help CenterFile Exchange에서 Computer Vision with Simulink에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by