File Exchange

image thumbnail

Depth Image Based Stereoscopic View Rendering

version 1.1 (1.35 MB) by

This program accepts a color and a depth video and converts them to stereoscopic views



View License

Color image and a corresponding per-pixel depth map is one method of 3D video representation. Based on DIBR, this program performs stereoscopic view generation. The depth maps are interpreted according to the MPEG N8038 informative recommendations and views are rendered. The disocclusions are filled according by background pixel extrapolation.

cd2lr.m is the code for DIBR. cd2lrluma.m is the same code, but applied only on luminance components. Users may run demo_cd2lr.m for a start.

Authors would like to thank Microsoft Research for Providing 'Ballet' Sequence for the demo purpose.

yuvimport.m is a function from the yuv toolbox which can be found at This toolbox enables to do many yuv related functions.

Please contact me if you cant get the yuv toolbox

Comments and Ratings (12)

Sony s

Sony s (view profile)

thanx for sharing code
it works for images as well

jiangfeng li

study for project

Hello Sir,

I can a
run your code using my own data set . I want to know what is the mat file contained in your code and how to generate it using my data.please help me.



leon (view profile)

Hello Sir,

Could you send me the yuvimport? I cannot get it.

Thank you.



I have a depth map which is not in the YUV format.How do I make it compatible with this code ?



elaine (view profile)


Thanks for sharing the code. I have tried your code for two sequences, ballet and 3D room. The rendered right view is fine, but there is a problem with the left view. The first frame of the left view is ok, but the holes are not getting filled starting from the second frame and due to this, patches are appearing at the occlusion spots. The first two frames of the Room sequence (colour and luma components) for the rendered left view can be found here.

Could you please advise?

Thanks & Regards

Varuna De Silva

Hi Jason,

The Ghost artifacts are due to the imperfections of the depth maps. The depth maps may not necessarily align with the color image edges.

Further, such artifacts are due to the hole filling problems that are inherent with DIBR systems. However you may reduce the disparity so that you have less holes.

Thanks for your inquiry.

Jason Yang

Thanks for sharing. However, why there are serious artifacts in the synthesized stereo images (like some kind of ghost artifacts around the head of the person)? Thanks!

Varuna De Silva

The program should be working fine now.

Varuna De Silva

The demo needs to be modified. I have already submitted a new version which is being inspected. Further the new submission is much faster than this.



I have made this code faster now, with a look up table to stop calculating shift every time you read a depth pixel value.

Also, in the earlier version the demo did not work due to differences in file names

MATLAB Release
MATLAB 7.5 (R2007b)

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Win prizes and improve your MATLAB skills

Play today