Skip to content

Commit

Permalink
Merge branch 'issue-2542' into projfix
Browse files Browse the repository at this point in the history
  • Loading branch information
abellgithub committed May 24, 2019
2 parents d9f6e89 + 31e5cca commit 13588c7
Show file tree
Hide file tree
Showing 20 changed files with 55 additions and 966 deletions.
10 changes: 5 additions & 5 deletions doc/quickstart.rst
Expand Up @@ -38,9 +38,9 @@ Install Conda
Conda installation instructions can be found at the following links. Read
through them a bit for your platform so you have an idea what to expect.

* `Windows <https://conda.io/docs/user-guide/install/windows.html>`__
* `macOS <https://conda.io/docs/user-guide/install/macos.html>`__
* `Linux <https://conda.io/docs/user-guide/install/linux.html>`__
* `Windows <https://conda.io/projects/conda/en/latest/user-guide/install/windows.html>`__
* `macOS <https://conda.io/projects/conda/en/latest/user-guide/install/macos.html>`__
* `Linux <https://conda.io/projects/conda/en/latest/user-guide/install/linux.html>`__

.. note::

Expand All @@ -56,7 +56,7 @@ On macOS and Linux, all Conda commands are typed into a terminal window. On
Windows, commands are typed into the Anaconda Prompt window. Instructions can
be found in the Conda `Getting Started`_ guide.

.. _`Getting Started`: https://conda.io/docs/user-guide/getting-started.html#starting-conda
.. _`Getting Started`: https://conda.io/projects/conda/en/latest/user-guide/getting-started.html#starting-conda


Test Installation
Expand All @@ -79,7 +79,7 @@ the PDAL maintenance branch.
It is a good idea to install PDAL in it's own environment (or
add it to an existing one). You will **NOT** want to add it to your default
environment named ``base``. Managing environments is beyond the scope of
the quickstart, but you can read more about it `here <https://conda.io/docs/user-guide/getting-started.html#managing-envs>`_.
the quickstart, but you can read more about it `here <https://conda.io/projects/conda/en/latest/user-guide/getting-started.html#managing-envs>`_.

To install the PDAL package so that we can use it to run PDAL commands, we run
the following command to create an environment named ``myenv``, installing PDAL
Expand Down
2 changes: 0 additions & 2 deletions doc/references.rst
Expand Up @@ -52,8 +52,6 @@ Reference
.. [Mesh2009] ALoopingIcon. "Meshing Point Clouds." *MESHLAB STUFF*. n.p., 7 Sept. 2009. Web. 13 Nov. 2015.
.. [Mongus2012] Mongus, D., Zalik, B., 2012. Parameter-free ground filtering of LiDAR data for automatic DTM generation. ISPRS J. Photogramm. Remote Sens. 67, 1–12.
.. [Pingel2013] Pingel, Thomas J., Keith C. Clarke, and William A. McBride. “An Improved Simple Morphological Filter for the Terrain Classification of Airborne LIDAR Data.” ISPRS Journal of Photogrammetry and Remote Sensing 77 (2013): 21–30.
.. [Rusu2008] Rusu, Radu Bogdan, et al. "Towards 3D point cloud based object maps for household environments." Robotics and Autonomous Systems 56.11 (2008): 927-941.
Expand Down
40 changes: 0 additions & 40 deletions doc/stages/filters.kdistance.rst

This file was deleted.

64 changes: 0 additions & 64 deletions doc/stages/filters.mongus.rst

This file was deleted.

14 changes: 5 additions & 9 deletions doc/stages/filters.rst
Expand Up @@ -36,16 +36,15 @@ invalidate an existing KD-tree.
filters.cluster
filters.colorinterp
filters.colorization
filters.covariancefeatures
filters.dem
filters.eigenvalues
filters.estimaterank
filters.elm
filters.ferry
filters.hag
filters.info
filters.kdistance
filters.lof
filters.mongus
filters.neighborclassifier
filters.nndistance
filters.normal
Expand Down Expand Up @@ -74,6 +73,10 @@ invalidate an existing KD-tree.
:ref:`filters.colorization`
Fetch and assign RGB color information from a GDAL-readable datasource.

:ref:`filters.covariancefeatures`
Filter that calculates local features based on the covariance matrix of a
point's neighborhood.

:ref:`filters.eigenvalues`
Compute pointwise eigenvalues, based on k-nearest neighbors.

Expand All @@ -90,17 +93,10 @@ invalidate an existing KD-tree.
Compute pointwise height above ground estimate. Requires points to be
classified as ground/non-ground prior to estimating.

:ref:`filters.kdistance`
Compute pointwise K-Distance (the Euclidean distance to a point's k-th
nearest neighbor). [Deprecated - use :ref:`filters.nndistance`]

:ref:`filters.lof`
Compute pointwise Local Outlier Factor (along with K-Distance and Local
Reachability Distance).

:ref:`filters.mongus`
Label ground/non-ground returns using [Mongus2012]_.

:ref:`filters.neighborclassifier`
Update pointwise classification using k-nearest neighbor consensus voting.

Expand Down
2 changes: 1 addition & 1 deletion filters/ApproximateCoplanarFilter.cpp
Expand Up @@ -90,7 +90,7 @@ void ApproximateCoplanarFilter::filter(PointView& view)
auto B = eigen::computeCovariance(view, ids);

// perform the eigen decomposition
SelfAdjointEigenSolver<Matrix3f> solver(B);
SelfAdjointEigenSolver<Matrix3d> solver(B);
if (solver.info() != Success)
throwError("Cannot perform eigen decomposition.");
auto ev = solver.eigenvalues();
Expand Down
28 changes: 14 additions & 14 deletions filters/CovarianceFeaturesFilter.cpp
Expand Up @@ -77,7 +77,7 @@ void CovarianceFeaturesFilter::addDimensions(PointLayoutPtr layout)
if (m_featureSet == "Dimensionality")
{
for (auto dim: {"Linearity", "Planarity", "Scattering", "Verticality"})
m_extraDims[dim] = layout->registerOrAssignDim(dim, Dimension::Type::Float);
m_extraDims[dim] = layout->registerOrAssignDim(dim, Dimension::Type::Double);
}
}

Expand Down Expand Up @@ -113,43 +113,43 @@ void CovarianceFeaturesFilter::setDimensionality(PointView &view, const PointId
auto B = eigen::computeCovariance(view, ids);

// perform the eigen decomposition
SelfAdjointEigenSolver<Matrix3f> solver(B);
SelfAdjointEigenSolver<Matrix3d> solver(B);
if (solver.info() != Success)
throwError("Cannot perform eigen decomposition.");

// Extract eigenvalues and eigenvectors in decreasing order (largest eigenvalue first)
auto ev = solver.eigenvalues();
std::vector<float> lambda = {(std::max(ev[2],0.f)),
(std::max(ev[1],0.f)),
(std::max(ev[0],0.f))};
std::vector<double> lambda = {(std::max(ev[2],0.0)),
(std::max(ev[1],0.0)),
(std::max(ev[0],0.0))};

if (lambda[0] == 0)
throwError("Eigenvalues are all 0. Can't compute local features.");

auto eigenVectors = solver.eigenvectors();
std::vector<float> v1(3), v2(3), v3(3);
std::vector<double> v1(3), v2(3), v3(3);
for (int i=0; i < 3; i++)
{
v1[i] = eigenVectors.col(2)(i);
v2[i] = eigenVectors.col(1)(i);
v3[i] = eigenVectors.col(0)(i);
}

float linearity = (sqrtf(lambda[0]) - sqrtf(lambda[1])) / sqrtf(lambda[0]);
float planarity = (sqrtf(lambda[1]) - sqrtf(lambda[2])) / sqrtf(lambda[0]);
float scattering = sqrtf(lambda[2]) / sqrtf(lambda[0]);
double linearity = (sqrt(lambda[0]) - sqrt(lambda[1])) / sqrt(lambda[0]);
double planarity = (sqrt(lambda[1]) - sqrt(lambda[2])) / sqrt(lambda[0]);
double scattering = sqrt(lambda[2]) / sqrt(lambda[0]);
view.setField(m_extraDims["Linearity"], id, linearity);
view.setField(m_extraDims["Planarity"], id, planarity);
view.setField(m_extraDims["Scattering"], id, scattering);

std::vector<float> unary_vector(3);
float norm = 0;
std::vector<double> unary_vector(3);
double norm = 0;
for (int i=0; i <3 ; i++)
{
unary_vector[i] = lambda[0] * fabsf(v1[i]) + lambda[1] * fabsf(v2[i]) + lambda[2] * fabsf(v3[i]);
unary_vector[i] = lambda[0] * fabs(v1[i]) + lambda[1] * fabs(v2[i]) + lambda[2] * fabs(v3[i]);
norm += unary_vector[i] * unary_vector[i];
}
norm = sqrtf(norm);
norm = sqrt(norm);
view.setField(m_extraDims["Verticality"], id, unary_vector[2] / norm);
}
}
}
2 changes: 1 addition & 1 deletion filters/EigenvaluesFilter.cpp
Expand Up @@ -89,7 +89,7 @@ void EigenvaluesFilter::filter(PointView& view)
auto B = eigen::computeCovariance(view, ids);

// perform the eigen decomposition
SelfAdjointEigenSolver<Matrix3f> solver(B);
SelfAdjointEigenSolver<Matrix3d> solver(B);
if (solver.info() != Success)
throwError("Cannot perform eigen decomposition.");
auto ev = solver.eigenvalues();
Expand Down
2 changes: 1 addition & 1 deletion filters/GreedyProjection.cpp
Expand Up @@ -188,7 +188,7 @@ void GreedyProjection::filter(PointView& view)
std::vector<int> point2index (input_->points.size (), -1);
for (int cp = 0; cp < static_cast<int> (indices_->size ()); ++cp)
{
coords_.push_back(input_->points[(*indices_)[cp]].getVector3fMap());
coords_.push_back(input_->points[(*indices_)[cp]].getVector3dMap());
point2index[(*indices_)[cp]] = cp;
}
**/
Expand Down
92 changes: 0 additions & 92 deletions filters/KDistanceFilter.cpp

This file was deleted.

0 comments on commit 13588c7

Please sign in to comment.