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.
Any matlab version compatible with code written in R2018a
-
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 theseremoveArtifacts.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.
Input RGB Image | Input Depth Image | Output Image | Output Mask |
---|---|---|---|
Input RGB Image | Input Mask | Output After Median Filter | Output After Impainting |
---|---|---|---|
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
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()