Skip to content

Commit

Permalink
add layout gt samples
Browse files Browse the repository at this point in the history
  • Loading branch information
bertjiazheng committed Oct 12, 2019
1 parent 8a00179 commit 984279c
Show file tree
Hide file tree
Showing 13 changed files with 41 additions and 17 deletions.
27 changes: 24 additions & 3 deletions README.md
Expand Up @@ -15,6 +15,7 @@ Rui Tang,
[Shenghua Gao](http://sist.shanghaitech.edu.cn/sist_en/2018/0820/c3846a31775/page.htm),
[Zihan Zhou](https://faculty.ist.psu.edu/zzhou)


[Preprint](https://arxiv.org/pdf/1908.00222.pdf) / [Supplementary Material](https://drive.google.com/file/d/17F_jIfY_QKFNmsOSvzUFZwWKrr6YUMnQ)

(\* Equal contribution)
Expand Down Expand Up @@ -51,17 +52,36 @@ We use [open3D](https://github.com/intel-isl/Open3D) for wireframe and plane vis
python visualize_3d.py --path /path/to/dataset --scene scene_id --type wireframe/plane/floorplan
```

Wireframe | Plane | Floorplan
---------------------------------- | -------------------------- | ----------------------------------
![Wireframe](assets/wireframe.png) | ![plane](assets/plane.png) | ![floorplan](assets/floorplan.png)
| Wireframe | Plane | Floorplan |
| --- | --- | --- |
| ![Wireframe](assets/3d/wireframe.png) | ![plane](assets/3d/plane.png) | ![floorplan](assets/3d/floorplan.png) |

### Visualize 2D Layout

```bash
python visualize_layout.py --path /path/to/dataset --scene scene_id --type perspective/panorama
```

#### Panorama Layout

<p align="center">
<img src="assets/pano_layout/scene_00000_485142.png" width="250">
<img src="assets/pano_layout/scene_00000_490854.png" width="250">
<img src="assets/pano_layout/scene_00000_492165.png" width="250">
</p>

Please refer to the [Supplementary Material](https://drive.google.com/file/d/17F_jIfY_QKFNmsOSvzUFZwWKrr6YUMnQ) for more example ground truth room layouts.

#### Perspective Layout

<p align="center">
<img src="assets/pers_layout/scene_00000_485142_0.png" width="250">
<img src="assets/pers_layout/scene_00000_485142_1.png" width="250">
<img src="assets/pers_layout/scene_00000_490854_2.png" width="250">
</p>

## Citation

Please cite `Structured3D` in your publications if it helps your research:
```bibtex
@article{Structured3D,
Expand All @@ -78,6 +98,7 @@ Please cite `Structured3D` in your publications if it helps your research:
The data is released under the [Structured3D Terms of Use](https://drive.google.com/open?id=13ZwWpU_557ZQccwOUJ8H5lvXD7MeZFMa), and the code is released under the [MIT license](LICENSE).

## Contact

Please contact us at [Structured3D Group](mailto:structured3d@googlegroups.com) if you have any questions.

## Acknowledgements
Expand Down
File renamed without changes
File renamed without changes
File renamed without changes
Binary file added assets/pano_layout/scene_00000_485142.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/pano_layout/scene_00000_490854.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/pano_layout/scene_00000_492165.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/pers_layout/scene_00000_485142_0.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/pers_layout/scene_00000_485142_1.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/pers_layout/scene_00000_490854_2.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 3 additions & 1 deletion misc/panorama.py
Expand Up @@ -178,7 +178,9 @@ def draw_boundary_from_cor_id(cor_id, img_src):

panoEdgeC = img_src.astype(np.uint8)
for dx, dy in [[-1, 0], [1, 0], [0, 0], [0, 1], [0, -1]]:
panoEdgeC[np.clip(rs+dx, 0, im_h-1), np.clip(cs+dy, 0, im_w-1), 1] = 255
panoEdgeC[np.clip(rs + dx, 0, im_h - 1), np.clip(cs + dy, 0, im_w - 1), 0] = 0
panoEdgeC[np.clip(rs + dx, 0, im_h - 1), np.clip(cs + dy, 0, im_w - 1), 1] = 0
panoEdgeC[np.clip(rs + dx, 0, im_h - 1), np.clip(cs + dy, 0, im_w - 1), 2] = 255

return panoEdgeC

Expand Down
3 changes: 2 additions & 1 deletion visualize_3d.py
Expand Up @@ -8,6 +8,7 @@
import matplotlib.pyplot as plt
from shapely.geometry import Polygon
from descartes.patch import PolygonPatch

from misc.figures import plot_coords
from misc.colors import colormap_255, semantics_cmap

Expand Down Expand Up @@ -352,7 +353,7 @@ def main():
args = parse_args()

# load annotations from json
with open(os.path.join(args.path, args.scene, 'annotation_3d.json')) as file:
with open(os.path.join(args.path, "scene_%05d" % (args.scene, ), 'annotation_3d.json')) as file:
annos = json.load(file)

if args.type == "wireframe":
Expand Down
24 changes: 12 additions & 12 deletions visualize_layout.py
Expand Up @@ -12,17 +12,6 @@
from misc.colors import colormap_255


def parse_args():
parser = argparse.ArgumentParser(description="Structured3D 2D Layout Visualization")
parser.add_argument("--path", required=True,
help="dataset path", metavar="DIR")
parser.add_argument("--scene", required=True,
help="scene id", type=int)
parser.add_argument("--type", choices=["perspective", "panorama"], required=True,
help="type of camera", type=str)
return parser.parse_args()


def visualize_panorama(args):
"""visualize panorama layout
"""
Expand Down Expand Up @@ -71,7 +60,18 @@ def visualize_perspective(args):
ax.add_patch(patch)

plt.title(key)
plt.show()
plt.show()


def parse_args():
parser = argparse.ArgumentParser(description="Structured3D 2D Layout Visualization")
parser.add_argument("--path", required=True,
help="dataset path", metavar="DIR")
parser.add_argument("--scene", required=True,
help="scene id", type=int)
parser.add_argument("--type", choices=["perspective", "panorama"], required=True,
help="type of camera", type=str)
return parser.parse_args()


def main():
Expand Down

0 comments on commit 984279c

Please sign in to comment.