简体   繁体   English

OpenCV中实现的立体BM和SGBM算法中的斑点是什么

[英]What is speckle in stereo BM and SGBM algorithm implemented in OpenCV

While applying the stereo BM & SGBM algorithms implemented in OpenCV, I came across the notion of "Speckle noise", that are filtered by a speckle filter, caracterized by its "speckleWindowSize" & "speckleRange parameters" => see openCV's documentation on that link to OpenCV doc在应用 OpenCV 中实现的立体声 BM 和 SGBM 算法时,我遇到了“散斑噪声”的概念,它由散斑滤波器过滤,由其“散斑窗口大小”和“散斑范围参数”表征 => 请参阅该 链接上的 openCV 文档 到 OpenCV 文档

First of all, what is Speckle noise and what causes it ?首先,什么是斑点噪声,它是由什么原因引起的?

Secondly, in the above link, you can find the below definitions (which don't really explain anything and just give ranges that seem to come from nowhere) :其次,在上面的链接中,您可以找到以下定义(这些定义并没有真正解释任何内容,只是给出了似乎无处不在的范围):

"speckleWindowSize : Maximum size of smooth disparity regions to consider their noise speckles and invalidate. Set it to 0 to disable speckle filtering. Otherwise, set it somewhere in the 50-200 range." “speckleWindowSize:平滑视差区域的最大大小,以考虑它们的噪声斑点并使其无效。将其设置为 0 以禁用斑点过滤。否则,将其设置在 50-200 范围内的某个位置。”

"speckleRange : Maximum disparity variation within each connected component. If you do speckle filtering, set the parameter to a positive value, it will be implicitly multiplied by 16. Normally, 1 or 2 is good enough. " “speckleRange : 每个连通分量内的最大视差变化。如果你做散斑过滤,将参数设置为正值,它将隐式乘以 16。通常,1 或 2 就足够了。“

while the famous "Learning OpenCV" book from Gary Bradski and Adrian Kaehler give a totally other range for speckleWindowSize :而 Gary Bradski 和 Adrian Kaehler 着名的“Learning OpenCV”一书给出了 spekleWindowSize 的完全不同的范围:

"block-based matching has problems near the boundaries of objects because the matching window catches the foreground on one side and the background on the other side. Th is results in a local region of large and small disparities that we call speckle. To prevent these borderline matches, we can set a speckle detector over a speckle window (ranging in size from 5-by-5 up to 21 by-21) by setting speckleWindowSize, which has a default setting of 9 for a 9-by-9 window. Within the speckle window, as long as the minimum and maximum detected disparities are within speckleRange, the match is allowed (the default range is set to 4)." “基于块的匹配在对象边界附近存在问题,因为匹配窗口在一侧捕捉前景,在另一侧捕捉背景。这会导致局部区域存在大小不一的差异,我们称之为斑点。为了防止这些边界匹配,我们可以通过设置斑点窗口大小在斑点窗口(大小范围从 5×5 到 21×21)上设置斑点检测器,9×9 窗口的默认设置为 9。在散斑窗口内,只要检测到的最小和最大视差在散斑范围内,就允许匹配(默认范围设置为 4)。”

By testing it, it seems that I can effectively go up to a 200 window size, but if that is represented in pixels, isn't that a huge window ?通过测试,我似乎可以有效地增加 200 个窗口大小,但如果以像素表示,那不是一个巨大的窗口吗?

Also, the above text gives an explanation on what speckle is.另外,上面的文字解释了什么是散斑。 As I understand it, we juste have small values of disparities for the background and large values for the foreground, which is exactly what is supposed to be...?据我了解,我们认为背景的视差值很小,前景的视差值很大,这正是应该的......? Therefore, I don't understand why it is considered as noise and why we should filter it ?因此,我不明白为什么它被认为是噪音,为什么我们应该过滤它?

Any help would be appreciated,任何帮助,将不胜感激,

Thank you.谢谢你。

While using any of provided disparity algorithms it's likely to have better results if post filtering is applied.在使用任何提供的视差算法时,如果应用后过滤,可能会获得更好的结果。 Typical problem zones of disparity maps from stereo images are object edges , shaded areas , textured regions comes from how disparity map is counted.立体图像视差图的典型问题区域是物体边缘阴影区域纹理区域来自视差图的计算方式。 You may check this tutorial where one type of post filtering is applied to BM disparity algorithm.您可以查看本教程,其中将一种类型的后过滤应用于 BM 视差算法。

"Learning OpenCV" is a great book and your cite from it gives a clear answer to your question. “Learning OpenCV”是一本很棒的书,您从中引用的内容为您的问题提供了明确的答案。

The is results in a local region of large and small disparities that we call speckle.这是导致我们称为散斑的局部区域的大小差异。

没有过滤和使用它的示例视差图

I took an image from the question at answers.opencv.org .我从answers.opencv.org 的问题中获取了一张图片。

Speckle is a region with huge variance between counted disparities which should be considered as a noise (and filtered) .斑点是一个在计数视差之间具有巨大差异的区域,应将其视为噪声(并过滤) And speckles are likely to come in problem areas.斑点很可能出现在问题区域。

The reason for manual setup of speckle-related parameters of algorithm is that this parameters will very between different scenes and setups.手动设置算法散斑相关参数的原因是该参数在不同场景和设置之间会有很大差异。 So there is not a single optimal choice of speckleWindowSize and speckleRange to fit any developer's requirements.因此,没有单一的最佳选择speckleWindowSizespeckleRange任何开发人员的要求。 You may work with large objects close to camera (like on the image) or with small objects far from camera and close to background (cars on bird-view road scene) etc. So you should set parameters which suit your particular camera setup (or provide your user with interface to adjust them if camera setups may vary).您可能会处理靠近相机的大物体(如图像上)或远离相机且靠近背景的小物体(鸟瞰道路场景中的汽车)等。因此,您应该设置适合您特定相机设置的参数(或如果相机设置可能会有所不同,请为您的用户提供调整它们的界面)。 Consider areas around fingers and inside a palm.考虑手指周围和手掌内部的区域。 There are speckles (especially area inside a palm).有斑点(尤其是手掌内的区域)。 The difference in disparity is noise in this case and should be filtered.在这种情况下,视差的差异是噪声,应该被过滤掉。 Choosing very big speckleWindowSize (blue rectangle) will lead to loss of small but important details like fingers.选择非常大的speckleWindowSize (蓝色矩形)会导致手指等小而重要的细节丢失。 It maybe better to choose smaller speckleWindowSize (red rectangle) and bigger speckleRange since disparity variation seems to be big.选择较小的speckleWindowSize (红色矩形)和较大的speckleRange可能更好,因为视差变化似乎很大。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM