如何找到图像移动的像素量?
我试图计算从固定相机捕获的每个连续图像中对象移动了多少。我们在这里测试的是每次将对象放置在同一位置的设置的可重复性。
该物体的中心有一个印记,上面有一个简单的形状(见下文)。相机的视野只有几平方毫米(~25)。图像中可能还有其他伪影需要清除,但我目前所能展示的只是一张简单的图画。
我想要计算的是每张图像中线条相交位置与前一张图像相比的偏移量。在下图中,红线代表第二张图像中线相交的位置,即。他们已经移动了多远。
我的问题是,使用图像识别 C# 库,最好是 EmguCV,如何计算绿色矩形的尺寸(偏移量)?我遵循了 Emgu 的一些教程,通过精明的转换,该软件只能检测到两条线,但我对如何到达它们相交的位置一无所知,因为该库创建了 500 多条迷你线,而不是 2 条长线。
如有任何帮助、想法和建议,我们将不胜感激。谢谢!
I am trying to calculate by how much an object has moved in each consecutive image captured from a stationary camera. What we're testing here is the repeatability of our setup to place an object in the same place each time.
The object in question has a stamp placed on its center that has a simple shape on it (see below). The camera only has a view of a few square millimeters(~25). There might be other artifacts in the image that will need to be cleared up, but all I can show currently is just a simple drawing.
What I am trying to calculate is the offset of where the lines intersect in each image compared to the previous one. In the picture below, the red lines represent where the lines intersect in the 2nd image, ie. how far they have moved.
My question is, using an image recognition C# library, preferably EmguCV, how can I calculate the dimensions of the green rectangle(the offset)? I have followed a few of Emgu's tutorials, and through canny conversions the software is able to detect just the two lines, but I am clueless as to how to get where they intersect as the library creates over 500 mini lines instead of 2 long ones.
Any help, ideas, and suggestions are appreciated. Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
作为旁注,如果您正在进行大量像素调整,您可能需要认真考虑使用“不安全”属性 - 这将阻止运行时验证对像素数组的每个订阅访问,这将使您回到本机性能范围 - 否则,你的算法将运行得非常慢wwwwwwllllllyyyyyy :-)
As a side note, if you're doing a lot of pixel twiddling, you may want to seriously consider the use of the 'unsafe' attribute - this will stop the runtime from validating each subscriped access to the pixel array, which will get you back into native performance range - otherwise, your algs will run very slooowwwwwwllllllyyyyyy :-)
您需要研究“图像跟踪”算法,例如均值漂移算法: http://en.wikipedia.org/wiki/Mean-shift。
You'll want to look into "image tracking" algorithms, like for example the mean-shift algorithm: http://en.wikipedia.org/wiki/Mean-shift.