本文介绍了如何计算移动物体的速度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

抱歉,我的错误,我还是新来的c#:(



我正在研究c#项目,其中读取移动物体的样本和然后计算这些物体并计算移动物体的速度



我正在使用aforge.net从网络摄像头读取然后存储了大约25张图片

然后应用阈值除去对象以外的任何东西(当然有错误因素)

阈值后的图像: []



我试图通过计算它在captureFrame1中的第一个位置的距离来计算每个找到的对象的速度,并且它在finalFrame中的位置。



,我想我可以通过知道如何将距离(以像素为单位)转换为mm来计算它?

谢谢



什么我试过了:



Sorry My mistake , I'm still new here and new in c# :(

I'm working on c# project where reads a sample of moving objects and then count these objects and calculate the speed of moving ones

I am using aforge.net to read from web-cam and then stored about 25 pictures
then applying threshold to remove anything but the objects (there's an error factor of course)
the image after threshold : test — imgbb.com[^]

and I was trying to calculate the speed of each found object by calculating the distance of it's first place in capturedFrame1 , and it's place in finalFrame .

and I thought I could calculate it by knowing how to convert distance in pixels to mm ?
Thanks

What I have tried:

https://ibb.co/i2WiZQ

推荐答案

using (Graphics oGraphics = Graphics.FromHwnd(IntPtr.Zero))
{
    float nDPIX = oGraphics.DpiX;
    float nDPIY = oGraphics.DpiY;
}


speed = 20 pixel/second = 20/96 inches/second = 20/99 25.4 mm/second = 5.29 mm/second.





其中 25.4 是英寸/毫米比率。


这篇关于如何计算移动物体的速度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 01:01