DurrLab / C3VD

Colonoscopy 3D Video Dataset (C3VD) acquired with a high definition clinical colonoscope and high-fidelity colon models for benchmarking computer vision methods in colonoscopy.
https://durrlab.github.io/C3VD/
40 stars 3 forks source link

How to output corresponding virtual image? #9

Closed jywu511 closed 1 year ago

jywu511 commented 1 year ago

Thank you very much for sharing your work openly. During the rendering process, this project can output information such as image depth and normals. I would like to simultaneously output corresponding images for the virtual domain. Could you please advise on how to achieve this? Thank you very much.

Best regards

tbobrow1 commented 1 year ago

Hi @jywu511 - When you say "virtual domain," are you referring to diffuse shading, which also appears in the GUI alignment window? If so, you can save these frames by making a few edits to RenderingModule.cpp and RenderingModule.h:

1.) Add "RenderFlags::DIFFUSE" to the flags passed to the context->updateRenderFlags function in the class constructor. This will tell the renderer to render diffuse frames. 2.) Allocate host memory using malloc. This memory will store the rendered frame before it is saved to an image file. The diffuse images are 8-bit with four color channels. 3.) Looking to the for loop in the launch function, copy the data from the device to the host using cudaMemcpy. 4.) Write the data to an image file using stbi_write_png.

If you follow the code, you will see where each step occurs for the other image types. You can insert these functions for the diffuse images at the same lines while using the correct number of bits and color channels for the diffuse image type.

jywu511 commented 1 year ago

@tbobrow1 Thanks!

tbobrow1 commented 1 year ago

No problem! I will close the issue for now - but let me know if you have any trouble with implementing it.