-
Notifications
You must be signed in to change notification settings - Fork 137
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
37dd335
commit 76dbac9
Showing
13 changed files
with
1,631 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
# Working with per-scene camera intrinsics in Hypersim | ||
|
||
Each Hypersim scene uses slightly different camera intrinsics for rendering. This issue arises because some scenes make use of non-standard tilt-shift photography parameters in their scene definition files. This directory provides: (1) a modified perspective projection matrix for each scene that can be used as a drop-in replacement for the usual OpenGL perspective projection matrix; (2) example code demonstrating how the modified projection matrix can be used in applications; and (3) code for computing the modified projection matrix for each scene. | ||
|
||
## Obtaining the perspective projection matrix for a given scene | ||
|
||
The [`metadata_camera_parameters.csv`](metadata_camera_parameters.csv) file contains every camera parameter for every scene obtained directly from the corresponding vrscene file. Each row in this CSV file describes a scene, and the `M_proj_00`, `M_proj_01`, ..., `M_proj_44` columns define the entries of the 4x4 perspective projection matrix for that scene, assuming that camera-space points are stored as [x,y,z,w] column-vectors. For many scenes, this matrix will be the usual OpenGL perspective projection matrix. For other scenes with non-standard tilt-shift parameters, this matrix will be modified to account for the non-standard parameters. | ||
|
||
This [example code](jupyter/00_00_projecting_points_into_hypersim_images.ipynb) demonstrates how to use the projection matrix. | ||
|
||
First, list all files with the command: | ||
|
||
``` | ||
./download.py --list | ||
``` | ||
|
||
Output: | ||
|
||
``` | ||
ai_001_001/_detail/cam_00/camera_keyframe_frame_indices.hdf5 | ||
ai_001_001/_detail/cam_00/camera_keyframe_look_at_positions.hdf5 | ||
ai_001_001/_detail/cam_00/camera_keyframe_orientations.hdf5 | ||
ai_001_001/_detail/cam_00/camera_keyframe_positions.hdf5 | ||
ai_001_001/_detail/cam_00/metadata_camera.csv | ||
ai_001_001/_detail/metadata_cameras.csv | ||
ai_001_001/_detail/metadata_node_strings.csv | ||
ai_001_001/_detail/metadata_nodes.csv | ||
ai_001_001/_detail/metadata_scene.csv | ||
ai_001_001/images/scene_cam_00_final_hdf5/frame.0000.color.hdf5 | ||
ai_001_001/images/scene_cam_00_final_hdf5/frame.0000.diffuse_illumination.hdf5 | ||
ai_001_001/images/scene_cam_00_final_hdf5/frame.0000.diffuse_reflectance.hdf5 | ||
ai_001_001/images/scene_cam_00_final_hdf5/frame.0000.residual.hdf5 | ||
ai_001_001/images/scene_cam_00_final_hdf5/frame.0001.color.hdf5 | ||
ai_001_001/images/scene_cam_00_final_hdf5/frame.0001.diffuse_illumination.hdf5 | ||
ai_001_001/images/scene_cam_00_final_hdf5/frame.0001.diffuse_reflectance.hdf5 | ||
ai_001_001/images/scene_cam_00_final_hdf5/frame.0001.residual.hdf5 | ||
ai_001_001/images/scene_cam_00_final_hdf5/frame.0002.color.hdf5 | ||
ai_001_001/images/scene_cam_00_final_hdf5/frame.0002.diffuse_illumination.hdf5 | ||
... | ||
ai_001_001/images/scene_cam_00_final_preview/frame.0000.color.jpg | ||
ai_001_001/images/scene_cam_00_final_preview/frame.0000.diff.jpg | ||
... | ||
ai_001_002/images/scene_cam_03_geometry_hdf5/frame.0000.depth_meters.hdf5 | ||
ai_001_002/images/scene_cam_03_geometry_hdf5/frame.0000.normal_bump_cam.hdf5 | ||
ai_001_002/images/scene_cam_03_geometry_hdf5/frame.0000.normal_bump_world.hdf5 | ||
ai_001_002/images/scene_cam_03_geometry_hdf5/frame.0000.normal_cam.hdf5 | ||
ai_001_002/images/scene_cam_03_geometry_hdf5/frame.0000.normal_world.hdf5 | ||
ai_001_002/images/scene_cam_03_geometry_hdf5/frame.0000.position.hdf5 | ||
ai_001_002/images/scene_cam_03_geometry_hdf5/frame.0000.render_entity_id.hdf5 | ||
ai_001_002/images/scene_cam_03_geometry_hdf5/frame.0000.semantic.hdf5 | ||
ai_001_002/images/scene_cam_03_geometry_hdf5/frame.0000.semantic_instance.hdf5 | ||
ai_001_002/images/scene_cam_03_geometry_hdf5/frame.0000.tex_coord.hdf5 | ||
ai_001_002/images/scene_cam_03_geometry_hdf5/frame.0001.depth_meters.hdf5 | ||
... | ||
ai_001_002/images/scene_cam_03_geometry_preview/frame.0000.color.jpg | ||
... | ||
``` | ||
|
||
Next, specify which files you are interested in and download them. | ||
For example, the following command will download the first preview image of each scene: | ||
|
||
``` | ||
./download.py --contains scene_cam_00_final_preview --contains frame.0000.color.jpg --silent | ||
``` | ||
|
||
# Help | ||
|
||
|
||
``` | ||
usage: download.py [-h] [-d DIRECTORY] [-o] [-c [CONTAINS [CONTAINS ...]]] | ||
[-s] [-l] | ||
optional arguments: | ||
-h, --help show this help message and exit | ||
-d DIRECTORY, --directory DIRECTORY | ||
directory to download to | ||
-o, --overwrite overwrite existing files | ||
-c [CONTAINS [CONTAINS ...]], --contains [CONTAINS [CONTAINS ...]] | ||
only download file if name contains specific word(s) | ||
-s, --silent only print downloaded files | ||
-l, --list only list files, do not download | ||
example: list files without downloading | ||
./download.py --list | ||
example: download the first preview of each scene: | ||
./download.py --contains scene_cam_00_final_preview --contains frame.0000.color.jpg --silent | ||
example: download all files to "all hypersim images" directory | ||
./download.py --directory 'all hypersim images' | ||
example: print help | ||
./download.py --help | ||
``` |
219 changes: 219 additions & 0 deletions
219
contrib/mikeroberts3000/jupyter/00_projecting_points_into_hypersim_images.ipynb
Large diffs are not rendered by default.
Oops, something went wrong.
202 changes: 202 additions & 0 deletions
202
contrib/mikeroberts3000/jupyter/01_casting_rays_that_match_hypersim_images.ipynb
Large diffs are not rendered by default.
Oops, something went wrong.
Binary file added
BIN
+9.03 KB
contrib/mikeroberts3000/jupyter/ai_037_002/_detail/cam_00/camera_keyframe_orientations.hdf5
Binary file not shown.
Binary file added
BIN
+4.34 KB
contrib/mikeroberts3000/jupyter/ai_037_002/_detail/cam_00/camera_keyframe_positions.hdf5
Binary file not shown.
Binary file added
BIN
+246 KB
...rts3000/jupyter/ai_037_002/images/scene_cam_00_geometry_hdf5/frame.0000.depth_meters.hdf5
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# | ||
# For licensing see accompanying LICENSE.txt file. | ||
# Copyright (C) 2020 Apple Inc. All Rights Reserved. | ||
# | ||
|
||
import os, sys, inspect | ||
|
||
def add_path_to_sys_path(path, mode, frame): | ||
assert mode == "unchanged" or mode == "relative_to_cwd" or mode == "relative_to_current_source_dir" | ||
if mode == "unchanged": | ||
if path not in sys.path: | ||
sys.path.insert(0,path) | ||
if mode == "relative_to_cwd": | ||
realpath = os.path.realpath(os.path.abspath(path)) | ||
if realpath not in sys.path: | ||
sys.path.insert(0,realpath) | ||
if mode == "relative_to_current_source_dir": | ||
realpath = os.path.realpath(os.path.abspath(os.path.join(os.path.dirname(inspect.getfile(frame)),path))) | ||
if realpath not in sys.path: | ||
sys.path.insert(0,realpath) | ||
|
||
def get_current_source_file_path(frame): | ||
return os.path.realpath(os.path.abspath(os.path.join(os.path.dirname(inspect.getfile(frame))))) |
Oops, something went wrong.