Skip to content

Commit 87ea902

Browse files
committed
Merge README changes
2 parents 66cb580 + 374f10d commit 87ea902

5 files changed

Lines changed: 558 additions & 28 deletions

File tree

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,4 +173,6 @@ GEMstack/offboard/calibration/calibration_by_segmentation/refined_proj_seg.png
173173
GEMstack/offboard/calibration/calibration_by_segmentation/refined_proj.png
174174
GEMstack/offboard/calibration/calibration_by_segmentation/extrinsic.txt
175175

176-
repo/
176+
repo/
177+
GEMstack/offboard/calibration/data/
178+
GEMstack/offboard/calibration/global_registration_result.txt

GEMstack/offboard/calibration/README.md

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ There are two ways to calibrate the intrinsics, depending on what data you have.
2222

2323
To use the `get_intrinsic_by_chessboard.py` script, collect a series of images with a large chessboard using either the data collection scripts or a rosbag. Select images where the chessboard is at different points in the camera frame, different distances including filling the entire frame, and at different angles. The script detects internal corners where four squares meet, so the extreme edge of the chessboard does not need to be in frame.
2424

25-
To use the `get_intrinsic_by_SfM.py` script, *[fill in here]*
25+
To use the `get_intrinsic_by_SfM.py` script, prepare a set of images recorded from the same camera going through a continuous movement, and follow [this](#get_intrinsic_by_sfmpy)
2626

2727
The `undistort_images.py` script can then be used to rectify a set of images using the calibrated intrinsics to evaluate or use in other applications.
2828

2929
**Extrinsic Calibration**
3030

31-
The `img2pc.py` file contains the main part of the extrinsic calibration process. Select a synchronized camera image and lidar pointcloud to align, ideally containing features that are easy to detect in both, such as boards or signs with corners. Alignment can be done with *[explain minimum number of points and any limitations on them]*. The first screen will ask you to select points on the image, and will close on its own once *n_features* points are selected. The second screen will ask you to select points in the point cloud, and will need to be closed manually once exactly *n_features* points are selected, or it will prompt you again. The extrinsic matrices will then be displayed, and if an *out_path* is provided they will also be saved.
31+
The `img2pc.py` file contains the main part of the extrinsic calibration process. Select a synchronized camera image and lidar pointcloud to align, ideally containing features that are easy to detect in both, such as boards or signs with corners. Alignment can be done with 4 feature pairs(must be coplanar) or 6+ points. The first screen will ask you to select points on the image, and will close on its own once *n_features* points are selected. The second screen will ask you to select points in the point cloud, and will need to be closed manually once exactly *n_features* points are selected, or it will prompt you again. The extrinsic matrices will then be displayed, and if an *out_path* is provided they will also be saved.
3232

3333
The `test_transforms.py` file can then be used to manually fine-tune the calculated intrinsics. Use the sliders to change the translation and rotation to project the lidar points onto the image more accurately.
3434

@@ -37,12 +37,14 @@ The `test_transforms.py` file can then be used to manually fine-tune the calcula
3737

3838
Compute camera extrinsic parameters by manually selecting corresponding features in an image and point cloud.
3939

40+
**Note**: On the img prompt, click n points and the window closed itself. On the pc prompt, right click n points and close the window manually.
41+
4042
### Usage
4143
```bash
4244
python3 img2pc.py \
4345
--img_path IMG_PATH \
4446
--pc_path PC_PATH \
45-
--img_intrinsics_path IMG_INTRINSICS_PATH \
47+
--img_intrinsic_path IMG_INTRINSICS_PATH \
4648
[--pc_transform_path PC_TRANSFORM_PATH] \
4749
[--out_path OUT_PATH] \
4850
[--n_features N_FEATURES]
@@ -53,24 +55,26 @@ python3 img2pc.py \
5355
| Parameter | Description | Format | Required | Default |
5456
|-----------|-------------|--------|----------|---------|
5557
| `--img_path` | Input image path | .png | Yes | - |
56-
| `--lidar_path` | Point cloud path | .npz | Yes | - |
57-
| `--img_intrinsics_path` | Camera intrinsics file | .yaml | Yes | - |
58-
| `--lidar_transform_path` | LiDAR extrinsic transform | .yaml | No | Identity |
59-
| `--out_path` | Output extrinsic path | .yaml | No | None |
58+
| `--pc_path` | Point cloud path | .npz | Yes | - |
59+
| `--img_intrinsic_path` | Camera intrinsics file | .yaml | Yes | - |
60+
| `--pc_transform_path` | LiDAR extrinsic transform | .yaml | No | Identity |
6061
| `--n_features` | Manual feature points | int | No | 8 |
61-
| `--undistort` | Flag for using distortion coefficients | - | - | - |
62+
| `--out_path` | Output extrinsic path | .yaml | No | None |
63+
| `--no_undistort` | to undistort | - | - | False |
64+
| `--show` | visualize reprojection | - | - | False |
65+
66+
*`--no_undistort True` is rare because it's almost sure that extrinsic solving performs better after undistortion*
6267

6368
### Example
6469
```bash
6570
root='/mnt/GEMstack'
6671
python3 img2pc.py \
67-
--img_path $root/data/fl/fl16.png \
68-
--lidar_path $root/data/ouster16.npz \
69-
--lidar_transform_path $root/GEMstack/knowledge/calibration/gem_e4_ouster.yaml \
70-
--img_intrinsics_path $root/GEMstack/knowledge/calibration/gem_e4_fl_in.yaml \
71-
--n_features 8 \
72-
--out_path $root/GEMstack/knowledge/calibration/gem_e4_fl.yaml \
73-
--undistort
72+
--img_path $root/data/calib1/img/fl/fl16.png \
73+
--pc_path $root/data/calib1/pc/ouster16.npz \
74+
--pc_transform_path $root/GEMstack/knowledge/calibration/gem_e4_ouster.yaml \
75+
--img_intrinsic_path $root/GEMstack/knowledge/calibration/gem_e4_oak_in.yaml \
76+
--n_features 4 \
77+
--out_path $root/GEMstack/knowledge/calibration/gem_e4_oak.yaml
7478
```
7579

7680
## test_transforms.py
@@ -179,9 +183,10 @@ python3 intrinsic_calibration_chessboard.py \
179183
| Parameter | Description | Required |
180184
|-----------|-------------|----------|
181185
| `--input_imgs` | Input images (glob pattern) | Yes |
182-
| `--workspace` | Temporary directory path | Yes |
186+
| `--workspace` | Temporary directory path (default `/tmp/colmap_tmp`) | No |
183187
| `--out_file` | Output .yaml path | No |
184188

189+
*note:`--workspace` allows you to save running time for continuing/redoing a previous job. you can clean it up after. check [colmap](https://colmap.github.io/) for more infomation*
185190
### Example
186191
```bash
187192
root='/mnt/GEMstack'

GEMstack/offboard/calibration/get_intrinsic_by_SfM.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ def main(input_imgs, output_dir, out, refine=True):
107107
if __name__ == "__main__":
108108
parser = argparse.ArgumentParser(description='Camera calibration using SfM')
109109
parser.add_argument('--input_imgs','-i', nargs='+', help='List of input imgs', required=True)
110-
parser.add_argument('--workspace','-w', type=str, required=True,
110+
parser.add_argument('--workspace','-w', type=str, required=False, default= '/tmp/colmap_tmp',
111111
help='Output directory for results')
112112
parser.add_argument('--out_file','-o', type=str, required=True,
113113
help='output yaml file')

0 commit comments

Comments
 (0)