Fill gaps in Depth Map [closed]

asked 2015-09-30 05:46:41 -0600

MBodenbenner gravatar image

I have a depth map computed, which is sparse (about 75% of the entries are "empty"). Now I want to fill the empty entries. The problem is that the type of my Mat is CV_32F and "empty entries" are -1. Furthermore the values of the filled entries are quite small. So I can't convert it to CV_8U and use inpaint because I would loose to much precision.

I tried resizing the DepthMap but then, OpenCV uses the "empty entries" for interpolation which leads to distorted values at the edge of the holes of the depthMap.

Is there another OpenCV function I can use to fill those gaps?

edit retag flag offensive reopen merge delete

Closed for the following reason question is not relevant or outdated by sturkmen
close date 2020-11-11 08:52:49.602068

Comments

1
  • it's a bit unclear, what you want to fill in instead of the -1.
  • opencv3 has a alternative xphoto::inpaint version (needs contrib repo) , which should work on float images, too
berak gravatar imageberak ( 2015-10-01 02:04:09 -0600 )edit
1

This seems just interpolation between neighboring pixels right?

StevenPuttemans gravatar imageStevenPuttemans ( 2015-10-01 04:37:51 -0600 )edit

Uh I would want to know that answer as well, filling "holes" in depth maps by approximating the depth values via the neighbours should be not so hard, I think inpaint would do to much, it would even fill areas where there is no depth information by neighbours available

CatKong gravatar imageCatKong ( 2015-10-08 04:28:41 -0600 )edit

If you have point1 and point 2 in 3D space, you first calculate the euclidean distance, then look what the intensity value difference between them is and then rescale all the pixels on the line between them to a value corresponding to the difference interval? Basic interpolation right?

StevenPuttemans gravatar imageStevenPuttemans ( 2015-10-08 04:33:24 -0600 )edit

Wouldn't it be better to do this interpolation directly on the depth map values in terms of efficiency? its much easier to interpolate the 2d depth map before converting it to the 3d point cloud or not?

CatKong gravatar imageCatKong ( 2015-10-16 05:45:43 -0600 )edit