From d1a23d60b9997850cbe99c7dedc1f62e30c5d8cd Mon Sep 17 00:00:00 2001 From: Meiert Grootes Date: Mon, 29 Apr 2019 17:36:11 +0200 Subject: [PATCH 1/2] added alpha to eigenvalue return --- laserchicken/feature_extractor/eigenvals_feature_extractor.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/laserchicken/feature_extractor/eigenvals_feature_extractor.py b/laserchicken/feature_extractor/eigenvals_feature_extractor.py index 0c2b15d..188f980 100644 --- a/laserchicken/feature_extractor/eigenvals_feature_extractor.py +++ b/laserchicken/feature_extractor/eigenvals_feature_extractor.py @@ -13,7 +13,7 @@ def requires(cls): @classmethod def provides(cls): - return ['eigenv_1', 'eigenv_2', 'eigenv_3', 'normal_vector_1', 'normal_vector_2', 'normal_vector_3', 'slope'] + return ['eigenv_1', 'eigenv_2', 'eigenv_3', 'normal_vector_1', 'normal_vector_2', 'normal_vector_3', 'slope', 'alpha'] @staticmethod def _get_cov(xyz): @@ -34,7 +34,7 @@ def extract(self, sourcepc, neighborhoods, targetpc, targetindex, volume): alpha = np.arccos(np.dot(normals, np.array([0., 0., 1.]))) slope = np.tan(alpha) - return e_vals[:, 0], e_vals[:, 1], e_vals[:, 2], normals[:, 0], normals[:, 1], normals[:, 2], slope + return e_vals[:, 0], e_vals[:, 1], e_vals[:, 2], normals[:, 0], normals[:, 1], normals[:, 2], slope, alpha def _get_eigen_vals_and_vects(self, xyz_grp): cov_mat = self._get_cov(xyz_grp) From 7e14130d6908d74fb78749b09833d762cb902b41 Mon Sep 17 00:00:00 2001 From: Meiert Grootes Date: Tue, 30 Apr 2019 16:44:15 +0200 Subject: [PATCH 2/2] questionable maintaining of order dusring sorting of eigenvectors. comment in code --- laserchicken/feature_extractor/eigenvals_feature_extractor.py | 1 + 1 file changed, 1 insertion(+) diff --git a/laserchicken/feature_extractor/eigenvals_feature_extractor.py b/laserchicken/feature_extractor/eigenvals_feature_extractor.py index 188f980..ccc56a6 100644 --- a/laserchicken/feature_extractor/eigenvals_feature_extractor.py +++ b/laserchicken/feature_extractor/eigenvals_feature_extractor.py @@ -29,6 +29,7 @@ def extract(self, sourcepc, neighborhoods, targetpc, targetindex, volume): xyz_grp = get_xyz(sourcepc, neighborhoods) self._mask_rows_with_too_few_points(xyz_grp) + #the selected eigenvector need nit be the one corresponding to the samllest eigenvalue as e_vals return is sorted where as the eigvects aren't e_vals, eigvects = self._get_eigen_vals_and_vects(xyz_grp) normals = eigvects[:, :, 2] # For all instances, take all elements of the 3th (smallest) vector.(normals, axis=1) alpha = np.arccos(np.dot(normals, np.array([0., 0., 1.])))