如何在光学测距仪中测量图像重合度 [英] How to measure image coincidence in an optical rangefinder

查看:70
本文介绍了如何在光学测距仪中测量图像重合度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有几个USB网络摄像头(固定焦距)设置为简单的立体测距仪 ,相距N毫米,每次向中心线旋转M度,并且已校准相机以确保对齐.

I have a couple of USB webcams (fixed focal length) setup as a simple stereoscopic rangefinder, spaced N mm apart with each rotated by M degrees towards the centerline, and I've calibrated the cameras to ensure alignment.

调整角度时,我如何测量图像之间的重合度(最好在Python/PIL/OpenCV中),以了解相机何时将焦点对准对象?这样简单到只需在每个图像中选择一个像素部分(A行x B列)并计算像素之间的差之和即可.

When adjusting the angle, how would I measure the coincidence between the images (preferably in Python/PIL/OpenCV) to know when the cameras are focused on an object? Is it as simple as choosing a section of pixels in each image (A rows by B columns) and calculating the sum of the difference between the pixels?

推荐答案

问题是您无法假设摄像头的像素完美对齐

,因此假设x轴是视差移位轴,并且y-轴对齐.您需要识别x轴图像的失真/偏移,以检测视差对齐,即使您已尽可能对齐.绝对差的结果不能保证在min/max中,因此与其减去各个像素,不包括减去半径/尺寸较大的该像素附近区域的平均颜色,然后减去y-axis中的对齐误差.让我们将此半径或大小称为r,这样对齐时得到的差异应该最小.

so let assume x-axis is the parallax shifted axis and y- axis is aligned. You need to identify the x-axis image distortion/shift to detect parallax align even if you are aligned as much as possible. The result of abs difference is not guaranteed to be in min/max so instead of substracting individual pixels substract average color of nearby area of that pixel with radius/size bigger then the align error in y-axis. Let call this radius or size r this way the resulting difference should be minimal when aligned.

近似搜索

您甚至可以通过r

  1. 选择大r
  2. 以步进方式扫描整个x范围,例如0.25*r
  3. 选择差异最小的x位置(x0)
  4. r更改为一半
  5. 转到项目符号2(但这一次,整个x范围仅在<x0-2.0*r,x0+2.0r>
  6. 之间
  7. 如果r小于或小于几个像素,则会停止
  1. select big r
  2. scan whole x-range with step for example 0.25*r
  3. choose the lowest difference x-position (x0)
  4. change r to half
  5. go to bullet 2 (but this time whole x range is just between <x0-2.0*r,x0+2.0r>
  6. stops if r is smaller then few pixels

这样,您可以在O(log2(n))而不是O(n)

This way you can search in O(log2(n)) instead of O(n)

计算机视觉方法

这应该更快:

  1. 检测兴趣点(在展位图片中)
    • 特定的梯度变化等...
  1. detect points of interest (in booth images)
    • specific change in gradient,etc ...

通过这种方式,您可以避免检查整个x范围,因为可以直接获得对齐距离...您只需要将其转换为角度或用于对齐视差的任何内容即可

This way you can avoid checking whole x-range because the align distance is obtained directly ... You just need to convert it to angle or what ever you use to align parallax

[notes]

您无需在整个图像区域上执行此操作,只需在图像上选择几条水平线并扫描其附近区域即可.

You do not need to do this on whole image area just select few horizontal lines along the images and scan their nearby area.

还有其他方法可以检测对准,例如,对于短距离,歪斜是对准的重要标志,因此可以比较摄像机之间物体左右两侧的高度...如果接近,则对准,如果更大/较小的人并没有结成对子,并且知道该怎么转向...

There are also another ways to detect align for example for short distances the skew is significant marker of align so compare the height of object on its left and right side between cameras ... If near the same you are aligned if bigger/smaller you are not aligned and know which way to turn ...

这篇关于如何在光学测距仪中测量图像重合度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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