从图像中减去背景-Emgu CV

问题描述 投票:0回答:1

我有两个图像。其中一个仅显示背景,另一个显示背景和一个对象作为前景。如何将前景对象提取为图像。

我尝试过:

var backgroundsubtractor = new BackgroundSubtractorMOG2();
backgroundsubtractor.Apply(ImageForeground, ImageBackground);

但是这不起作用。我究竟做错了什么?有没有其他方法,因为这种方法仅用于视频输入?

c# opencv emgucv background-subtraction
1个回答
0
投票

您可以使用Image<TColor,TDepth>.AbsDiff(Image<TColor,TDepth>)返回图像,这是两者之间的绝对(无符号)差:

var deltaImage = ImageBackground.AbsDiff(ImageForeground);
© www.soinside.com 2019 - 2024. All rights reserved.