/DIBR-Algorithm

Depth Image Based Rendering Algorithm Implementation in MATLAB. For hole filling, impainting algorithm with fast marching method (FMM) known as TELEA algorithm has been used

Primary LanguageMATLAB

Depth Image Based Rendering (DIBR)

This repo contains a Depth Image Based Rendering (DIBR) algorothm. Given original camera's RGB image and depth image, the program can synthesize virtual image from virtual camera's viewpoint. Additionally N number of virtual images can be generated from N viewpoints between original and virtual camera.

1. Requirements

Any matlab version compatible with code written in R2018a

2. Running the code

  • main.m : This function generates single virtual image given both original and virtual camera parameters. The output image will still have generated artifacts. To remove these removeArtifacts.m needs to be used.

  • DIBR_Multiple : This script requires to set value of N for generating N number of views.

  • removeArtifacts.m : This script takes generated virtual image, and mask image (generated by DIBR.m function) and applies median filter (to remove smaller holes), impainting algorithm with FMM.

3. Outputs

3.a. Generting Virtual Image ("main.m")

Input RGB Image Input Depth Image Output Image Output Mask

3.b. Impainting Generated Virtual Image ("removeArtifacts.m")

Input RGB Image Input Mask Output After Median Filter Output After Impainting

4. References

I. Telea, A., 2004. An image inpainting technique based on the fast marching method. Journal of graphics tools, 9(1), pp.23-34. Link to paper

5. Notes

The output of matlab implementation of impainting from this repo can be compared with python3 OpenCV's inbuild Telea algorithm implementation with following snippet.

import numpy as np
import cv2 as cv
img = cv.imread('Output_Virtual_Image.png')
mask = cv.imread('Virtual_Bin_Image.png',0)
dst = cv.inpaint(img,mask,3,cv.INPAINT_TELEA)
cv.imshow('dst',dst)
cv.waitKey(0)
cv.destroyAllWindows()