Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Inpainting depth map, still black image borders

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

image description

Mask of no depth information pixels:

image description

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

image description

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)

Inpainting depth map, still black image borders

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

image description

Mask of no depth information pixels:

image description

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

image description

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)

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:

image description

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.

Inpainting depth map, still black image bordersnormal behavior or a bug?

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

image description

Mask of no depth information pixels:

image description

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

image description

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)

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:

image description

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.

Inpainting Inpainting, normal behavior or a bug?

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

image description

Mask of no depth information pixels:

image description

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

image description

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

image description

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.