Emgu Cv C中的背景减法# [英] Background Subtraction in Emgu Cv C#
问题描述
如何将图像的背景设为黑色,并且所有存在的对象都是白色的?我已经尝试过AbsDif并保持其结果,但它非常考虑照明。
这是示例图像: http://stackoverflow.com/questions/19699687/algorithm-to-count-people-in-a-crowd [ ^ ]
请帮忙。
How can I make the background of an image black and all the objects present are white? I have tried the AbsDif and thressholding its result but it considers the lighting very much.
Here is the sample image : http://stackoverflow.com/questions/19699687/algorithm-to-count-people-in-a-crowd[^]
Please help.
推荐答案
首先尝试Canny过滤以检测边缘
Try Canny filtering first to detect edges
Dim img As New Image(Of Bgr, Byte)("img.jpg")
Dim imgCANNY As Image(Of Gray, Byte) = img.Canny(90, 70)
然后进行二值化
Then make Binarization
Dim img_BINARY As Image(Of Bgr, Byte) = img.ThresholdBinary(New Bgr(100, 100, 0), New Bgr(0, 100, 100))
转换它可以通过C#和数字来获得最佳效果,也可以尝试不同的过滤以获得更好的结果
(Sobel,Laplace,Sub,EqualizeHist,SmoothBilatral)
Additi这里的信息: www.emgu.com/ wiki /
Best,
Nick
Convert it to C# and play with numbers to get best result, also u can try different filtering to get better result
(Sobel, Laplace, Sub, EqualizeHist, SmoothBilatral)
Additional information here: www.emgu.com/wiki/
Best,
Nick
这篇关于Emgu Cv C中的背景减法#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!