How to save/write video ??
5 views (last 30 days)
Show older comments
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._
0 Comments
Answers (1)
Image Analyst
on 10 May 2018
You need to use VideoWriter, not vision.VideoPlayer. See attached demos.
See Also
Categories
Find more on Computer Vision Toolbox in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!