hough3d
This is a python library to perform a Hough transform to detect lines in 3D point clouds. We implement the iterative algorithm described in Dalitz et al. (2017):
- Direction vectors in 3D are discretized as the position vectors for the vertices of a tessellated icosahedron.
- All points in the point cloud vote, generating the Hough space representation.
- The highest voted line is selected, and the points surrounding that line are identified.
- Linear regression is performed on the selected points to refine the line parameters.
- All of the votes contributed by the selected points are subtracted from Hough space.
- Steps 3-5 are repeated until there are no satisfactory lines remaining.
This method has the advantage of being able to identify numerous lines without the computational burden of recalculating the entire Hough space each time.
The authors of the cited paper have implemented a C++ version here. I am currently working on trying to improve the algorithm specifically to detect line segments accurately, but for now this library functions equivalently to the C++ one. Functions are transpiled with numba, so there shouldn't be a huge difference in computation time despite this one being written in Python.
Usage
pip install hough3d
For test data, I would recommend looking at the datasets in the C++ repo.
from hough3d import hough3D
data = np.genfromtxt('data.csv', delimiter=',')
# Determines how many tesselations of the icosahedron
# to perform; larger number means more fine direction
# discretization, but larger computation time.
# See genIcosahedron docs for exact numbers.
directionGranularity = 4
directionVectors = genIcosahedron(directionGranularity)
# See docs for specific info on kwargs; generally
# these need to be chosen for each specific dataset.
linePoints = hough3D(data, directionVectors, latticeSize=128,
neighborDistance=0.01, minPointsPerLine=5)
And then visualize the results:
import open3d as o3d
flattenedLinePoints = linePoints.reshape((len(linePoints)*2, 3))
lineSet = o3d.geometry.LineSet()
lineSet.points = o3d.utility.Vector3dVector(flattenedLinePoints)
lineSet.lines = o3d.utility.Vector2iVector([[i,i+1] for i in range(len(flattenedLinePoints))[::2]])
pcd = o3d.geometry.PointCloud()
pcd.points = o3d.utility.Vector3dVector(data)
o3d.visualization.draw_geometries([lineSet, pcd])
Metadata
Release files for hough3d 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| hough3d-1.0.0.tar.gz | 19.2 kB | Without provenance | Details for hough3d-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| hough3d-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for hough3d-1.0.0-py3-none-any.whl |
Total release size: 42.1 kB
Release files / hough3d-1.0.0.tar.gz
| Download URL | hough3d-1.0.0.tar.gz |
|---|---|
| Size | 19.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
63fb87ca4e6f9ad725194a9bf7c584456ee75beb17b79e9fa626f04fbd8e75c0
|
|
BLAKE2b-256 checksum How to use checksums |
217fae4bac251148b4a0670a4179d31258a6eee8e49b91f428581a37d48fc1c6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.11.9
|
Release files / hough3d-1.0.0-py3-none-any.whl
| Download URL | hough3d-1.0.0-py3-none-any.whl |
|---|---|
| Size | 22.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8658c62592a0ef450fff47bf995742b4f322b225b0ef1e17794e9164ee324878
|
|
BLAKE2b-256 checksum How to use checksums |
90a15ac1b0509aff321a628f4626764eaec972e4002756e2e2968c9e57963672
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.11.9
|
Security for hough3d 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.