我是 EmguCV 图像处理的新手,正在尝试不同的背景减法方法。我遇到了absdiff方法并尝试了一下但是经过一系列处理后,对象的某些部分似乎是透明的并且可以看到它后面的背景,Background subtraction sample
这是我处理图像的代码部分
img = _capture.QueryFrame().ToImage<Bgr, Byte>();
Mat smoothedFrame = new Mat();
CvInvoke.GaussianBlur(img, smoothedFrame, new Size(3, 3), 1);
img3 = img2gray.AbsDiff(smoothedFrame.ToImage<Gray, Byte>());//.Convert<Gray, Byte>());
img3 = img3.ThresholdBinary(new Gray(60), new Gray(255));
IbOriginal.Image = img;
IbProcessed.Image = img3;
如何删除上图中的那些“空白或空心”空间。任何帮助将不胜感激
最佳答案
我猜您想创建一个仅包含卡车像素的 mask 。您可能已经用
去除了空心区域中的像素ThresholdBinary(new Gray(60), new Gray(255));
降低下限阈值可能是您所需要的,但它也可能包含一些背景噪音。您始终可以首先使用更高的阈值(您在此处所做的)识别卡车的位置,然后识别 ROI 中先前图像的 ThresholdBinary。
ThresholdBinary(new Gray(10), new Gray(255));
或者你可以尝试CvInvoke.FloodFill
关于c# - 背景减法 EMGU CV 后保留一些背景,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35943889/