owl-project / NVISII

Apache License 2.0
327 stars 28 forks source link

(u,v) coordinate error in meta_data_exporting example #79

Closed manuelli closed 3 years ago

manuelli commented 3 years ago

Changing the height and width parameters in the meta data exporting example to have a non-square image results in incorrect meta data images (e.g. depth) being extracted. I am using --width 640 --height 480. In this case depth.png is 480 x 640 image instead of 640 x 480.

For reference here is the RGB image

img

and the depth image

depth

I believe this is due to an error in reshaping the depth_array in this line. It currently reads

depth_array = np.array(depth_array).reshape(opt.width,opt.height,4)

Changing the order of height and width fixes the issue and produces correct depth images

depth_array = np.array(depth_array).reshape(opt.height,opt.width,4)

depth

Given this I am not sure why the original example worked (even with a square image) since it seems like height and width may still have been swapped in the original example.

Of course the same fix needs to be applied to the other metadata fields as well (normals, positions, segmentations, etc.).

natevm commented 3 years ago

Oof, good catch. I’ll make sure to get this fixed before the next merge into master.

We’ll actually likely be updating this example to use the newer visii.render_to_file API, which supports saving raw segmentations as EXR files with signed 32-bit float channels. There are other examples though where we probably make a similar mistake.

natevm commented 3 years ago

These examples have since been updated to use the newer data exporter, so I'm closing this issue. Thanks for the help