如何将检测到的边缘合并到 Emgu CV 中的颜色捕获
我正在尝试制作一个 C# 桌面应用程序(使用 Emgu CV 包装器),它捕获来自相机的提要,检测提要中的边缘,然后显示带有边缘的原始提要(彩色) - 所以有点组合彩色提要和边缘。我成功地从相机获取了信息。我还使用 Canny 方法检测提要中的边缘。问题在于,虽然原始提要是彩色的,但边缘检测是以灰度(黑色背景,白色边缘)完成的。我想知道如何将颜色源与边缘源“合并”以输出合并的源。
我尝试过使用 Emgu CV 中的 Copy 方法,但它输出黑色背景和正确着色的边缘(因此,例如,如果我在相机前持有一个红色立方体,则立方体周围的边缘将着色为红色)。
非常感谢任何帮助。
I am trying to make a C# desktop application (with Emgu CV wrapper) which captures the feed from the camera, detects edges in the feed and then displays the original feed (coloured) with the edges - so somewhat of a combined coloured feed and edges. I successfully get the feed from the camera. I also detect the edges in the feed by using the Canny method. The problem is that while the original feed is in colour, the detection of edges is done in grayscale (black background, white edges). I would like to know how to "merge" the colour feed with the edge feed to output a merged feed.
I've tried with the Copy method in Emgu CV but it outputs a black background and correctly coloured edges (so for instance if I hold a red cube in front of the camera, the edges around the cube are coloured red).
Any help is very appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好吧,经过一番修改后我找到了解决方案。诀窍是对反转的 Canny 结果和颜色源使用 And 函数。这是我与 Application.Idle 一起使用的函数:
OK, after a little bit of tinkering around I found the solution. The trick is to use the And function on an inverted Canny result and the colour feed. Here's my function that works with Application.Idle: