Skip to content

Commit 7e0a53c

Browse files
committed
update README and minor code cleaning
1 parent d134586 commit 7e0a53c

File tree

3 files changed

+30
-21
lines changed

3 files changed

+30
-21
lines changed

README.md

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,11 @@ Our current conversion code supports 2 event file formats:
2626
1. Rosbags with [dvs\_msgs](https://github.com/uzh-rpg/rpg_dvs_ros/tree/master/dvs_msgs)
2727
2. Prophesee Raw Format: Metavision 2.2
2828

29-
First,
30-
* install [Metavision 2.2](https://docs.prophesee.ai/2.2.0/installation/index.html), if you want to use prophesee raw files.
29+
First, install [Metavision 2.2](https://docs.prophesee.ai/2.2.0/installation/index.html), if you want to use prophesee raw files.
3130
Second,
3231
```bash
3332
pip3 install --no-cache-dir -r requirements.txt
34-
pip3 install --extra-index-url https://rospypi.github.io/simple/ rospy rosbag
33+
pip3 install --extra-index-url https://rospypi.github.io/simple/ rospy rosbag sensor-msgs
3534
pip3 install dataclasses # if your system Python version is < 3.7
3635
```
3736

@@ -55,6 +54,15 @@ The reconstruction code uses events saved in the h5 file format to reconstruct i
5554
ToDo: link the test file
5655

5756

57+
### Reconstructions to Rosbag
58+
If you want to use [kalibr](https://github.com/ethz-asl/kalibr), you may want to create a rosbag from the reconstructed images.
59+
To achieve this, additionally install (outside of the conda environment)
60+
61+
```bash
62+
pip3 install tqdm opencv-python
63+
pip3 install --extra-index-url https://rospypi.github.io/simple/ sensor-msgs
64+
```
65+
5866
## Calibration Procedure
5967

6068
The calibration procedure is based on three steps:

python/images_to_rosbag.py

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
import rosbag
2-
import cv2
3-
# from cv_bridge import CvBridge
4-
from os.path import join
5-
import rospy
61
import argparse
7-
import os
82
import glob
9-
import tqdm
3+
import os
4+
from os.path import join
5+
6+
import cv2
7+
import rosbag
8+
import rospy
109
from sensor_msgs.msg import Image
10+
import tqdm
1111

12-
if __name__ == "__main__":
1312

13+
if __name__ == "__main__":
1414
parser = argparse.ArgumentParser()
1515
parser.add_argument("--rosbag_folder", required=True,
1616
type=str, help="Path to the base folder containing the rosbags")
@@ -25,7 +25,6 @@
2525
print('Images to process: {}'.format(args.image_folder))
2626
reconstructed_images_folder = args.image_folder
2727

28-
2928
if not os.path.exists(args.rosbag_folder):
3029
os.makedirs(args.rosbag_folder)
3130

@@ -58,4 +57,4 @@
5857
outbag.write(args.image_topic, rosimage, stamp_ros)
5958
pbar.update(1)
6059
except:
61-
print("error in reading file ", image_path)
60+
print("error in reading file ", image_path)

python/offline_reconstruction.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
1-
import os
2-
import tqdm
3-
import torch
4-
import urllib
51
import argparse
2+
import os
3+
os.environ['CUDA_DEVICE_ORDER'] = 'PCI_BUS_ID'
64
from pathlib import Path
5+
import urllib
6+
7+
import torch
8+
import tqdm
9+
710
from data.provider import DataProvider
811
from data.rectimestamps import TimestampProviderFile, TimestampProviderRate
912
from reconstruction.utils.loading_utils import load_model, get_device
1013
from reconstruction.image_reconstructor import ImageReconstructor
1114
from reconstruction.options.inference_options import set_inference_options
1215
from reconstruction.utils.voxelgrid import VoxelGrid
13-
os.environ['CUDA_DEVICE_ORDER'] = 'PCI_BUS_ID'
14-
1516

1617

1718
def download_checkpoint(path_to_model):
@@ -21,6 +22,7 @@ def download_checkpoint(path_to_model):
2122
f.write(e2vid_model.read())
2223
print('Done with downloading!')
2324

25+
2426
if __name__ == "__main__":
2527

2628
parser = argparse.ArgumentParser(
@@ -44,7 +46,7 @@ def download_checkpoint(path_to_model):
4446
if not os.path.isfile(args.h5file):
4547
print('h5 file not provided')
4648
exit()
47-
49+
4850
h5_path = Path(args.h5file)
4951
freq_hz = args.freq_hz
5052
timestamp_provider = None
@@ -69,7 +71,7 @@ def download_checkpoint(path_to_model):
6971
os.makedirs(args.output_folder)
7072
else:
7173
assert os.path.isdir(args.output_folder)
72-
74+
7375
image_reconstructor = ImageReconstructor(model, args.height, args.width, model.num_bins, args)
7476
print('== Image reconstruction == ')
7577
print('Image size: {}x{}'.format(args.height, args.width))

0 commit comments

Comments
 (0)