lmurmann / multi_illumination

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

MIP5 material maps don't match image size

riceric22 opened this issue · comments

Hi Lukas,

First of all, thanks for releasing such a great dataset! It's clear to me that a lot of effort here was made to make it easy to use.

Just posting an issue here to let you know that the size of the material maps and the image sizes are off by 1 when using MIP=5 (e.g. the fetched material map is 124x187 when the image is 125x187). Reproduced using the following snippet, which throws a corresponding shape mismatch error:

scenes=ml.test_scenes()
S = query_images(scenes, mip=5, hdr=False)
M = query_materials(scenes, mip=5)

For now I've resorted to just downsampling the the higher resolution material map with nearest neighbor interpolation as a temporary stopgap. If this was incorrect, please let me know!

from PIL import Image
M2 = query_materials(scenes, mip=2)
M5 = []
for m in M2: 
    M5.append(np.array(Image.fromarray(m).resize((125, 187), Image.NEAREST)).reshape(1,125,187))
M5 = np.concatenate(M5,0)

~Eric

Strange, thanks for reporting it. Nearest-neighbor downsampling from the next-biggest MIP level should work just fine. The MIP levels in the dataset were rasterized from the original source polygons at lower resolution, and it appears that rounding behaviour was different in material MIP code path. But our low-res basically amounts to nearest-neighbor subsampling as well, so the results that you get should be identical except for the off-by-one.