WLS filtering

asked 2019-06-13 08:51:11 -0600

kobeking gravatar image

Hello everyone,

I have been using stereoSGBM algorithm to compute a disparity map. The result is okay, but too noisy. In order to get a better result, I have used the WLS (weighted least square) filtering algorithm provided by OpenCV and followed the example given by them here . However, the example doesn't explain the algorithm at all and i got really poor results. Even if the contours are better defined after applying the filter, and the smoothing inside the differents object is better, I have this huge problem with the gray levels that doesn't stay stable and that doesn't stay the same even if nothing moves in the image. For examples, see below where you can see 3 images (on the left is the original frame, in the middle is the disparity map computed with SGBM algorithm and on the right there is the disparity map given after WLS filtering). As you can see, the gray level change tremendously between to frame and they are not stable at all.

1st frame taken :

image description

2nd frame taken (just after the 1st one, nothing has moved in the image) :

image description

Has anyone worked with the WLS filter for the disparity map or has anyone an idea on how I can correct this problem ?

Many thanks.

edit retag flag offensive close merge delete

Comments

The exposure/gain/wb looks different. If you have a static scene and a static camera, you can temporally filter your results, otherwise, you might want to look into quantifying the uncertainty for each pixel. Look at the source of DisparityWLSFilter and see that it boils down to about 4 lines of code. Consider improving upon this using the confidence/uncertainty of each pixel. As a start, SGBM will give you a confidence image with a left and right matcher.

Der Luftmensch gravatar imageDer Luftmensch ( 2019-06-13 09:04:05 -0600 )edit

What do you mean by "quantifying the uncertainty for each pixel"?

kobeking gravatar imagekobeking ( 2019-06-13 09:26:35 -0600 )edit

See this example and consider reading the relevant papers: Fast Global Image Smoothing Based on Weighted Least Squares and Fast Guided Global Interpolation for Depth and Motion. You will need to do your own research into how to best come up with a 0-1 confidence per pixel. Look at sparse flow interpolation for inspiration. Also, this is harder when you don't have access to the DSI/cost map.

Der Luftmensch gravatar imageDer Luftmensch ( 2019-06-14 10:21:24 -0600 )edit