【发布时间】:2014-03-28 02:17:28
【问题描述】:
我正在尝试执行非常基本的 blob 检测,但没有成功。只需使用 VideoSurveillance 示例...它编译并运行良好,但实际上根本没有检测到 blob。 FGDetector 似乎工作得很好,所以我似乎得到了一个很好的前景,但 BlobTrackerAuto.Process 几乎不会导致发现一个斑点……即使前景蒙版图像中似乎有一个非常突出的斑点。这是一段代码 sn-p,展示了我如何捕获和处理图像。
void ProcessFrame(object sender, EventArgs e)
{
Image<Bgr, Byte> frame = _cameraCapture.QueryFrame();
frame._SmoothGaussian(3); //filter out noises
_detector.Update(frame);
Image<Gray, Byte> foregroundMask = _detector.ForegroundMask;
_tracker.Process(frame, foregroundMask);
foreach (MCvBlob blob in _tracker)
{
frame.Draw((Rectangle)blob, new Bgr(255.0, 255.0, 255.0), 2);
frame.Draw(blob.ID.ToString(), ref _font, Point.Round(blob.Center), new Bgr(255.0, 255.0, 255.0));
}
Image<Bgr, Byte> frameDisplay = frame.Resize(imageBox1.Width, imageBox1.Height, INTER.CV_INTER_LINEAR, false);
Image<Gray, Byte> fgMaskDisplay = foregroundMask.Resize(imageBox2.Width, imageBox2.Height, INTER.CV_INTER_LINEAR, false);
imageBox1.Image = frameDisplay;
imageBox2.Image = fgMaskDisplay;
}
这是来自该程序的示例图像,它显示了(在我的幼稚意见中)一个非常明显的未检测到的斑点。
似乎必须有某种方法来配置 blob 检测(阈值设置?),以便它知道如何区分前景和背景。
任何建议将不胜感激。
【问题讨论】:
标签: opencv blob detection emgucv