【发布时间】:2014-11-16 06:20:31
【问题描述】:
这是从视频中检测物体的代码。
我想逐帧裁剪此视频中的对象。
videoSource = vision.VideoFileReader('viptraffic.avi','ImageColorSpace','Intensity'...
'VideoOutputDataType','uint8');
detector = vision.ForegroundDetector(...
'NumTrainingFrames', 5, ...
'InitialVariance', 30*30);
blob = vision.BlobAnalysis(...
'CentroidOutputPort', false, 'AreaOutputPort', false, ...
'BoundingBoxOutputPort', true, ...
'MinimumBlobAreaSource', 'Property', 'MinimumBlobArea', 250);
shapeInserter = vision.ShapeInserter('BorderColor','White');
videoPlayer = vision.VideoPlayer();
while ~isDone(videoSource)
frame = step(videoSource);
fgMask = step(detector, frame);
bbox = step(blob, fgMask);
out = step(shapeInserter, frame, bbox);
step(videoPlayer, out);
end
release(videoPlayer);
release(videoSource);
当我想从框架中裁剪 bbox 它总是给我错误“无效的输入参数”
如果我写这个命令。
frame(bbox(1):bbox(1)+bbox(3), bbox(2):bbox(2)+bbox(4), :);
“索引超出矩阵尺寸”错误来了。 请帮助我如何从图像中裁剪对象
【问题讨论】:
标签: matlab image-processing matlab-cvst