Save as the format used in the RTMV dataset https://www.cs.umd.edu/~mmeshry/projects/rtmv/. Each scene in the dataset contains - {id:05d}.depth.exr # (h, w, 3) grayscale, float32, background is set to -1e10, "ray traveling distance", not z in camera coordinate - {
(
self,
output_dirs: T.List[str],
start_idx: int = 0,
exist_ok: bool = True,
overwrite: bool = False,
srgb_to_linear: bool = True,
hit_only: bool = False,
)
| 2818 | ) |
| 2819 | |
| 2820 | def save_as_rtmv( |
| 2821 | self, |
| 2822 | output_dirs: T.List[str], |
| 2823 | start_idx: int = 0, |
| 2824 | exist_ok: bool = True, |
| 2825 | overwrite: bool = False, |
| 2826 | srgb_to_linear: bool = True, |
| 2827 | hit_only: bool = False, |
| 2828 | ) -> T.List[str]: |
| 2829 | """ |
| 2830 | Save as the format used in the RTMV dataset https://www.cs.umd.edu/~mmeshry/projects/rtmv/. |
| 2831 | |
| 2832 | Each scene in the dataset contains |
| 2833 | - {id:05d}.depth.exr # (h, w, 3) grayscale, float32, background is set to -1e10, "ray traveling distance", not z in camera coordinate |
| 2834 | - {id:05d}.exr # (h, w, 4), float32, rgba (alpha: foreground mask [0, 1]) |
| 2835 | - {id:05d}.json # camera information, see below |
| 2836 | - {id:05d}.seg.exr # (h, w, 3), float32, [0, 1] 1 foreground, 0 background |
| 2837 | |
| 2838 | ex: |
| 2839 | - 00000.depth.exr |
| 2840 | - 00000.exr |
| 2841 | - 00000.json |
| 2842 | - 00000.seg.exr |
| 2843 | |
| 2844 | RTMV uses blender coordinate system (x to right, y to far, z to up). |
| 2845 | We use opengl's (x to right, y to up, z to us). |
| 2846 | So we need to first convert our H_c2w to H_b2w before saving the camera. |
| 2847 | Moreover, Kaolin uses intrinsic matrix to convert world coordinate |
| 2848 | (x to right, y to up, z to us) to image coordinate (x to right, y to down, |
| 2849 | z to far). So we also need to handle this. |
| 2850 | |
| 2851 | # Camera information |
| 2852 | { |
| 2853 | "camera_data": { |
| 2854 | "cam2world": [ # it is the "transpose" of H_c2w |
| 2855 | [ |
| 2856 | -0.6331584453582764, |
| 2857 | 0.7740222811698914, |
| 2858 | 0.0, |
| 2859 | 0.0 |
| 2860 | ], |
| 2861 | [ |
| 2862 | -0.09314906597137451, |
| 2863 | -0.07619690895080566, |
| 2864 | 0.9927322864532471, |
| 2865 | 0.0 |
| 2866 | ], |
| 2867 | [ |
| 2868 | 0.7683968544006348, |
| 2869 | 0.6285567283630371, |
| 2870 | 0.12034416198730469, |
| 2871 | 0.0 |
| 2872 | ], |
| 2873 | [ |
| 2874 | 0.5917379856109619, |
| 2875 | 0.5100606083869934, |
| 2876 | 0.17243748903274536, |
| 2877 | 1.0 |