How to save/write video ??

5 views (last 30 days)
umut
umut on 9 May 2018
Commented: umut on 10 May 2018
foregroundDetector = vision.ForegroundDetector('NumGaussians', 3, 'NumTrainingFrames',50);
blobAnalysis = vision.BlobAnalysis('BoundingBoxOutputPort',true,...
'AreaOutputPort',false, 'CentroidOutputPort', false,...
'MinimumBlobArea', 150);
videoFWriter = vision.VideoFileWriter('myFile.avi','FrameRate',...
videoReader.info.VideoFrameRate)
videoReader = vision.VideoFileReader('hareket.avi');
fgPlayer = vision.VideoPlayer;
videoPlayer = vision.VideoPlayer;
while ~isDone(videoReader)
videoFrame = step(videoReader);
% figure,imshow(videoFrame);
foreground = step(foregroundDetector,videoFrame);
cleanForeground = imopen(foreground,strel('Disk',1));
bbox = step(blobAnalysis, cleanForeground);
result = insertShape(videoFrame, 'Rectangle', bbox, 'Color', 'green');
numCars = size(bbox, 1);
result = insertText(result, [10 10], numCars, 'BoxOpacity', 1, ...
'FontSize', 14);
% result = videoFrame;
step(videoPlayer,result);
a=step(videoPlayer,result);
step(videoFWriter,a)
% step(fgPlayer,cleanForeground);
end
step(videoFWriter);
release(videoPlayer);
ı want to save my new video with bounding box. I get an error on this line "a=step(videoPlayer,result);" and it's Error using vision.VideoPlayer/step _ Too many output arguments; 1 output(s) requested but only 0 output(s) available._

Answers (1)

Image Analyst
Image Analyst on 10 May 2018
You need to use VideoWriter, not vision.VideoPlayer. See attached demos.
  1 Comment
umut
umut on 10 May 2018
Sir i dont understand these demos. This my new video with bounding box. it play "step(videoPlayer,result);" with this.
how can i extract frames of this video. maybe this method can help me

Sign in to comment.

Categories

Find more on Computer Vision Toolbox in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!