【问题标题】:How to get text label appearing in MATLAB in Computer Vision Toolbox如何在计算机视觉工具箱中的 MATLAB 中获取文本标签
【发布时间】: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


    【解决方案1】:

    最简单的方法是使用insertObjectAnnotation 函数,它将一个边界框和一个标签一起绘制到图像中。

    【讨论】:

      猜你喜欢
      • 2011-09-13
      • 2013-12-18
      • 1970-01-01
      • 2014-09-22
      • 2014-07-02
      • 2013-12-11
      • 2015-01-30
      • 2014-12-10
      • 1970-01-01
      相关资源
      最近更新 更多