shi-jian / shapenet-intrinsics

57 stars 14 forks source link

Creating depth maps #4

Closed ibcny closed 7 years ago

ibcny commented 7 years ago

Hi,

I'm using the xml script below to extract depth maps from the shapenet v2 object models. The problem is that depth information around the edges seem to be filtered somehow and the pixels are either blurred or crooked and do not represent the real values of the depth information wrt to the camera positions. Depth values start from zero for the background and grow smoothly around the edges. A snapshot is also attached below. Do you have any idea to resolve this issue?

`<?xml version="1.0" encoding="utf-8"?>

`

screenshot from 2017-09-18 01-24-29

shi-jian commented 7 years ago

Hi @phanax

By default, Mitsuba apply a Gaussian filter to the final render output. You can add <rfilter type="box" /> to the section, it would use a 1x1 box filter instead. It can provide you less 'smooth' result, but still cannot solve this problem. On object boundary, the pixel value is always mixed by object and background.

You can also try spp=1, which means only shoot one ray per pixel. With box filter, it would provide a depth map without averaging samples.

If you don't care too much about boundary pixels (usually I would get rid of them), you can set <spectrum name="undefined" value="1000000" /> in the part, then the backgroud pixel should be a very large value. In this case, the boundary pixels would also contain a large value. You can simply filter it on images by mask out pixels with intensity larger than 100000/spp.

And if you want a exact accurate depth map with clear boundary, maybe you can try to write an OpenGL shader.