This is the code repository implementing the "plane reconstruction from 3D lines" part of the paper "Line-based 3D Building Abstraction and Polygonal Surface Reconstruction from Images".
3D line segments set, obj file.
Planes fitting lines, vg file.
It can be resolved as a clustering problem like GMM(Gaussian Mixture Model), using Bayes theorem, assume the probablity of lines is decided by probability of planes and conditional probability of lines giving plane.
Here I give the details of obtaining the candidate planes (
For a given line segment, I use the 2 end points to represent it as follow:
As for a plane, I use a point in the plane and the normal to represent it:
Assume you already know the
. Then, you can get the joint probability distribution of the line segment
The marginal probability is exactly the probability that the line
Since you get the probability of each sample line segment and each sample is regarded independent, you will maximize the likelihood function
Here I use
The numerical algorithm for estimating plane parameters is given below:

The code is tested on Ubuntu 20.04. To install requirements, use the command below:
pip install -r requirements.txt
use the command below to test the clustering algorithm:
python main.py [-h] [--volume VOLUME] [--line_data LINE_DATA] [--out OUT] [--gui GUI] [--sr SR]
For more details of options, type the command below:
python main.py --help