Well as the title says I want to smooth a depth map which has blank spots (black spots where there is no depth information). Since this is a problem that other people have faced before I found [this solution](http://www.morethantechnical.com/2011/03/05/neat-opencv-smoothing-trick-when-kineacking-kinect-hacking-w-code/) which works quite nice and it is based on inpainting functionality. However, after applying inpaint on the input image there are still have some black spots on the borders. My first thought was that this might have to do something with the used inpainting method (method by Alexandru Telea `INPAINT_TELEA`), but changing it to the Navier-Stokes `INPAINT_NS` based method didn't change the result. I do not really get what is happening and if it is a bug in the `inpaint()` code or something that I should expect. Any ideas?
Input image:

Mask of no depth information pixels:

Output with the problem (notice the black artifacts on the left and top borders):

code i used:
Mat depth;
const unsigned char noDepth = 0; // change to 255, if values no depth uses max value or use the mask image
cv::inpaint(img, (img == noDepth), depth, 5.0, INPAINT_TELEA); // img is the 8-bit input image (depth map with blank spots) you can just pick it from the above images if you want to replicate the issue
----------------------------------------------------------
Update:
@berak well I used the `xphoto::inpaint()` that you suggested but though I do not get the black spot artifacts in the borders the quality of the image is not that good/smooth compared to the normal `inpaint()` as you can see:

I do not know if I can modify any parameters in order to get a better result but as far as I looked there is not such an option. Therefore, I think I will stick to the normal `inpaint()`hoping to get an answer about what is causing the artifacts in the borders.
↧