【发布时间】:2014-06-15 00:20:02
【问题描述】:
所以我刚刚开始在 MATLAB 中使用计算机视觉工具箱,并且一直在尝试跟踪视频中的 blob。
所以我能够输出检测到的 blob 的数量,并在检测到的 blob 周围有一个边界框。
现在我正在尝试让标签显示在图像上。所以基本上就像显示边界框一样,我希望显示标签(小数字 1、2、3 等)。
知道如何做到这一点吗?
这是我目前的代码:
blobAnalysis = vision.BlobAnalysis('BoundingBoxOutputPort', true, ...
'AreaOutputPort', false, 'CentroidOutputPort', true, ...
'MinimumBlobArea', 0,'LabelMatrixOutputPort', true);
while ~isDone (videoReader)
videoFrame = step(videoReader);
foreground = step (foregroundDetector, videoFrame);
cleanForeground = imopen(foreground, strel('Disk',1));
[centroids, bbox, Label] = step (blobAnalysis, cleanForeground);
Label;
centroids
result = insertShape(videoFrame, 'Rectangle',bbox,'Color','green');
number = size(bbox,1);
result = insertText(result, [10 10], number, 'BoxOpacity', 1, 'FontSize', 14);
step(videoPlayer, result); % display the results
end
release(videoReader); % close the video fil
谢谢大家!
【问题讨论】:
标签: matlab image-processing computer-vision imaging matlab-cvst