cmu-ci-lab / MitsubaToFRenderer

Mitsuba time-of-flight renderer.
54 stars 22 forks source link

How to extract full transient image for cbox? #9

Closed kaustubh-sadekar closed 1 year ago

kaustubh-sadekar commented 2 years ago

Hello Adithya,

I appreciate your constant support for this renderer. Thank you very much for actively solving all the queries. I have another issue regarding generating full transient image data:

I am using the scenes/cbox/cbox_unified_all.xml scene file to create a transient image. I want to create a full transient image of n-bins. Hence the desired output for me consists of:

  1. An (NxMx3) RGB image of the scene.
  2. An (NxMxK) Transient image where K = number of time bins representing the transient waveform.

However when I run the following command from usage.txt: mitsuba cbox_unified_all.xml -D samples=16 -D decomposition=transient -D tMin=0.01 -D tMax=2000 -D tRes=2000 -D modulation=none -D lambda=200 -D phase=0 -o out2

I only get the RGB image but there is no transient image data available (I am not aware if there is a different method to extract the full transient data). For this specific case, I was also expecting a (512,512,2000) dimension array storing all the transient values. But when I read out2.exr using the following code I get this output:

image

NOTE 1: Since I needed the entire transient I use tMin=0.01 instead of having tMax - tMin very small.

NOTE 2: I am using this code to read exr image.

I need a transient image with transient information for each pixel. Given below is an example that plots information of a single pixel (highlighted in red) of a transient image from iToF2dToF dataset:

download

Could you please guide me on how to extract such transient images for the cbox scene using the docker you have provided? It will be very helpful for me.

Thank you for your time. Best Regards, Kaustubh

AdithyaPediredla commented 2 years ago

Hello Kaustubh:

You set tMin=0.01 tMax=2000 tRes=2000. Therefore, there is only one RGB frame in your rendering. If you want 2000 frames, set tMin=0 tMax=2000 tRes=1.

Please use ./mfiles/exr/exr2mat.py to convert the exr to .mat file, which you could read in Matlab.

I hope this helps.

Regards, Adithya

kaustubh-sadekar commented 2 years ago

Thank you so much for solving my query. It worked! I misinterpreted the tRes variable.

Also, the exr2mat.py file worked for me thank you for pointing toward the file. I have created a similar file to convert exr data to numpy and gif format. I have created a PR if you find it useful.

Thank you once again for solving my queries. Best Regards, Kaustubh Sadekar