Skip to content

Commit

Permalink
Updated chunk parser, lint fix
Browse files Browse the repository at this point in the history
  • Loading branch information
treideme committed Mar 11, 2024
1 parent 4d4c568 commit 60ac277
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 17 deletions.
3 changes: 0 additions & 3 deletions common/chunk_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,9 +243,6 @@ def decode_chunk_pointcloud(data):
x = np.frombuffer(data[i:i + 4], dtype=dt)
y = np.frombuffer(data[i + 4:i + 8], dtype=dt)
z = np.frombuffer(data[i + 8:i + 12], dtype=dt)
# # FIXME: premature abort if decoding fails
# if len(x) == 0 or len(y) == 0 or len(z) == 0:
# return points
pt = Point3D(x[0], y[0], z[0])
points.append(pt)

Expand Down
26 changes: 15 additions & 11 deletions sparse3d/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
***This demo requires Bottlenose Stereo, it will not work with Bottlenose Mono.***

This example assumes that:
- your camera is properly [calibrated and the calibration parameters uploaded the camera](). Checkout the [calibration example](../calibration/README.md) to see how to upload your parameters.
- all the image quality related settings such as `exposure`, `gain`, and `CCM` are set. Please use `Stereo Viewer` or `eBusPlayer` to configure the image quality to your like.
* your camera is properly [calibrated and the calibration parameters uploaded the camera](https://docs.labforge.ca/docs/calibration).
* Use the Bottlenose Utility or checkout the [calibration example](../calibration/README.md) to see how to upload your parameters.
* all the image quality related settings such as `exposure`, `gain`, and `CCM` are set. Please use `Stereo Viewer` or `eBusPlayer` to configure the image quality to your liking.

The Python script shows how to programmatically
- set keypoint parameters, only [FAST](https://en.wikipedia.org/wiki/Features_from_accelerated_segment_test) is shown, but can be adapted for [GFTT](https://ieeexplore.ieee.org/document/323794).
Expand All @@ -14,7 +15,7 @@ The Python script shows how to programmatically
## Output

The script will display the feature points that are detected in the left image that also
have valid 3d correspondences. Each valid frame will yield a `ply` and `png` file that can be viewed with a 3D
have valid 3d correspondences. Each valid frame will yield a `ply` and `png` files that can be viewed with a 3D
viewer such as [MeshLab](https://www.meshlab.net/). For example,

```
Expand All @@ -25,14 +26,17 @@ python demo.py --mac <mac> --offsety1 <offset_from_calibration>

Set the following arguments to the ```demo.py``` file to change demo behavior.

| ***Parameter*** | ***Description*** |
|------------------------|------------------------------------------------------------------------------------------------|
| ```--mac``` | (optional) The MAC address of the camera. Assumes the first available camera if not specified. |
| ```--max_keypoints``` | (optional) Maximum number of keypoints to detect. Default 100. |
| ```--fast_threshold``` | (optional) Keypoint threshold for the Fast9 algorithm. Default 20. |
| ```--match_xoffset``` | (optional) Matcher horizontal search range. Default 0. |
| ```--match_yoffset``` | (optional) Matcher vertical search range. Default 0. |
| ```--offsety1``` | (optional) The Y offset of the right image. Default 440. |
| ***Parameter*** | ***Description*** |
|------------------------|-------------------------------------------------------------------------------------------------|
| ```--mac``` | (optional) The MAC address of the camera. Assumes the first available camera if not specified. |
| ```--max_keypoints``` | (optional) Maximum number of keypoints to detect. Default 1000. |
| ```--fast_threshold``` | (optional) Keypoint threshold for the Fast9 algorithm. Default 10. |
| ```--match_xoffset``` | (optional) Matcher horizontal search range. Default 0 (use existing value) |
| ```--match_yoffset``` | (optional) Matcher vertical search range. Default 0 (use existing value) |
| ```--offsety1``` | (optional) The Y offset of the right image. Default 440. |
| ```--min_threshold``` | (optional) Minimum threshold to accept a matched keypoint. Default 40. |
|```--ratio_threshold``` | (optional) Ratio threshold. Default 1023 |

## Usage

```bash
Expand Down
5 changes: 2 additions & 3 deletions sparse3d/demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import argparse
import eBUS as eb
import cv2
import math
import numpy as np


Expand All @@ -42,15 +41,15 @@ def parse_args():
parser.add_argument("-m", "--mac", default=None, help="MAC address of the Bottlenose camera")
parser.add_argument("-k", "--max_keypoints", type=int, default=1000, choices=range(1, 65535),
help="Maximum number of keypoints to detect")
parser.add_argument("-t", "--fast_threshold", type=int, default=20, choices=range(0, 255),
parser.add_argument("-t", "--fast_threshold", type=int, default=10, choices=range(0, 255),
help="Keypoint threshold for the Fast9 algorithm")
parser.add_argument("-x", "--match_xoffset", type=int, default=0, choices=range(-4095, 4095),
help="Matcher horizontal search range.")
parser.add_argument("-y", "--match_yoffset", type=int, default=0, choices=range(-4095, 4095),
help="Matcher vertical search range.")
parser.add_argument("-y1", "--offsety1", type=int, default=440, choices=range(0, 880),
help="Matcher vertical search range.")
parser.add_argument("-n", "--min_threshold", type=int, default=500, help="Matcher vertical search range.")
parser.add_argument("-n", "--min_threshold", type=int, default=40, help="Matcher vertical search range.")
parser.add_argument("-r", "--ratio_threshold", type=int, default=1023, help="Matcher vertical search range.")
return parser.parse_args()

Expand Down

0 comments on commit 60ac277

Please sign in to comment.