找到相机和检测到的图像之间的距离 [英] Finding the distance between camera and detected image

查看:70
本文介绍了找到相机和检测到的图像之间的距离的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好我是OpenCV的新手,我必须设计一个代码,找出检测到的物体和相机之间的距离,使用opencv和c ++。

任何人都可以帮我解决这个问题??



提前致谢!

Hi everyone i am new to OpenCV and I have to design a code to find out the distance between the detected object and the camera using opencv with c++.
Can any one help me with the code??

Thanks in advance!

推荐答案

你必须知道这是一个正在进行的研究领域,所以对于这个问题并没有真正完美的解决方案,但是有几种使用相机进行距离测量的好方法。



最简单的解决方案当然是如果你的视野中有一个校准物体(例如一个已知长度的尺子),但这种情况很少发生,或者只是在非常特殊的情况下。



如果您有两台摄像机从不同位置拍摄同一场景,可以使用几个立体声算法完成。其中一些是由openCV提供的。例如,请参阅此处的文档: http://docs.opencv.org/modules/calib3d/doc /camera_calibration_and_3d_reconstruction.html#stereosgbm [ ^

使用两个(更多的摄像头)进行精确的深度测量可能是最常用的解决方案。

有很多关于这个在线的教程,你可以轻松找到(关键词:立体视觉,深度图,距离测量)。



如果您只有一台摄像机,可以尝试使用运动算法的结构。例如,这个博客在一个例子中解释了它: http://www.morethantechnical.com/2012/02/07/structure-from-motion-and-3d-reconstruction-on-the-easy-in-opencv -2-3-w-code / [ ^ ]。由于名称应该暗示相机必须在场景中移动才能使用这种算法。



另一种可能性是使用任何类型的距离传感器与相机(例如Kinect相机,光学激光器,传感器)。



祝你好运。
You have to know that this is an ongoing field of research so there isn't really a perfect solution for this problem yet there are several good ways of doing a distance measurement using cameras.

The easiest solution of course would be if you have a calibration object in your field of view (e.g. a ruler of known length), but this is rarely the case or only in very special situations.

If you have two cameras filming the same scene from different positions it can be done using several stereo algorihms. Some of them are provided by openCV. See for example the documentation here: http://docs.opencv.org/modules/calib3d/doc/camera_calibration_and_3d_reconstruction.html#stereosgbm[^].
Using two (ore more cameras) for a precise depth measurement is probably the most often used solution.
There are also many tutorials about this online which you can find easily (keywords: Stereo vision, depth map, distance measurement).

If you have only one camera you can try using structure from motion algorithms. For example this blog explains it on an example: http://www.morethantechnical.com/2012/02/07/structure-from-motion-and-3d-reconstruction-on-the-easy-in-opencv-2-3-w-code/[^]. As the name should imply the camera has to move in a scene to use this kind of algorithms.

Another possibility is to use any kind of distance sensors in combination with a camera (e.g. a Kinect camera, optical laser, accustical sensors).

Good luck.


这篇关于找到相机和检测到的图像之间的距离的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆