Speckle in disparity map

asked 2019-07-09 08:23:54 -0600

kobeking gravatar image

Hello everyone,

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 text.

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) :

image description

while the famous "Learning OpenCV" book from Gary Bradski and Adrian Kaehler gives a totally other range for speckleWindowSize :

image description

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 ?

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.

edit retag flag offensive close merge delete

Comments

The matching solutions are not perfect and the speckles likely represent bad matches. The algorithm is available to you if you want to remove small disparity clusters that disagree with neighboring pixels. The algorithm window size might mean cluster (connected component) area and not square edge length. If you inspect the source code you'll have your answer.

Der Luftmensch gravatar imageDer Luftmensch ( 2019-07-09 09:10:08 -0600 )edit

Thank you for your reply. Any idea where I could find the source code ?

kobeking gravatar imagekobeking ( 2019-07-09 09:14:14 -0600 )edit
Der Luftmensch gravatar imageDer Luftmensch ( 2019-07-09 09:30:09 -0600 )edit

Thank you, I will check for the window size. Also, what did you mean by "disagree with neighboring pixels"?

kobeking gravatar imagekobeking ( 2019-07-09 10:15:06 -0600 )edit

Well I checked and this is what I understood : the window size seems to be for connected component as you suggested, and the algorithm computes the difference between the maximum and the minimum detected disparities inside the window. As long as it is below a defined value (speckleRange), the match is allowed.

However, I never learned C++, and there are some things that I don't really understand. Would you be able to confirme that what I understood is correct ?

kobeking gravatar imagekobeking ( 2019-07-09 10:42:53 -0600 )edit

I meant it in the sense that it is a connected component that is small because it does not agree with neighboring pixels, if it did, it would not be small and would instead be part of a larger connected component. My understanding is that the parameter for window size really means pixel area or number of pixels. I agree that much of the OpenCV source code is inscrutable.

Der Luftmensch gravatar imageDer Luftmensch ( 2019-07-09 10:50:47 -0600 )edit