Skip to content
Snippets Groups Projects
Commit 4b8077e1 authored by Antoine Lucas's avatar Antoine Lucas ⛷️
Browse files

Replace libLab3_Lidar.py

parent 816af9df
No related branches found
No related tags found
No related merge requests found
......@@ -109,7 +109,7 @@ def getEigenvaluePCA(a, b, c, dim, decim=2):
"""
from sklearn.decomposition import PCA
from scipy import spatial
#from scipy import spatial
......@@ -123,7 +123,7 @@ def getEigenvaluePCA(a, b, c, dim, decim=2):
print("shape of Y " ,np.shape(Y))
# Estimate the distance of one point with every neighbour around
dist = spatial.distance.squareform(spatial.distance.pdist(Y))
#dist = spatial.distance.squareform(spatial.distance.pdist(Y))
......@@ -139,13 +139,18 @@ def getEigenvaluePCA(a, b, c, dim, decim=2):
# 3. Using PCA scikit-learn function, we estimate the 3 eigenvalues of these points
# 4. We concatenate these 3 eigenvalues in a single array which will be return at the end.
for kk in range(0,n_samples):
pts = np.where((dist[kk,:]<=dim/2)) # Mask of values corresp. to the criteria
dist = np.sqrt((Y[kk,0] - Y[:,0])**2 + (Y[kk,1] - Y[:,1])**2 + (Y[kk,2] - Y[:,2])**2)
# Mask of values corresp. to the criteria
pts = np.where((dist<=dim/2))
if np.size(pts)<3: # Check if the number of neighbour is sufficient
print("Revise dims: ")
print(pts)
print(dist)
#print("Revise dims: ")
#print(pts)
#print(dist)
eigenvalues=np.array([0., 0., 0.])
else:
Ytmp = Y[pts,:] # Apply the criteria on the dataset
Ytmp = Ytmp[0,:,:] # Reduce the depth of the array
......@@ -483,7 +488,7 @@ def plot_3dcladd(dx,dy,dz,y,density=1):
for xb, yb, zb in zip(Xb, Yb, Zb):
ax.plot([xb], [yb], [zb], 'w')
plt.show()
def plot_confMat(cnf_matrix,ClaName):
"""
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment