필터 지우기
필터 지우기

Create a boundary of real numbers in a two dimentional matrix consisting of nan and real numbers

조회 수: 1 (최근 30일)
I have the organized point cloud data measured by Lidar.
That data is two dimentinal matrix consisting of nan and real numbers.
I want to divide the data by clutering with real number boundary.
Does this algorithm exist in the past? Or Is there a code like that?
Finally, I want to separate the obstacles' information.
  댓글 수: 2
Matt J
Matt J 2022년 11월 29일
It would be a good idea to attach an example set of input data, so that we can demonstrate solutions.
익환 류
익환 류 2022년 11월 29일
a = [nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan;...
nan nan nan 0.5 0.5 0.5 0.5 nan nan nan nan nan nan 0.5 0.5 0.5 nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan;...
nan nan nan 0.5 0.5 0.5 0.5 nan nan nan nan nan nan 0.5 0.5 0.5 nan nan nan nan nan 0.5 0.5 0.5 nan nan nan 0.5 nan nan nan nan;...
nan nan nan 0.5 0.5 0.5 0.5 nan nan nan nan nan nan 0.5 0.5 0.5 nan nan nan nan nan 0.5 0.5 0.5 0.5 0.5 0.5 0.5 nan nan nan nan;...
nan nan nan 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 nan nan nan nan nan 0.5 0.5 0.5 nan nan nan 0.5 nan nan nan nan;...
nan nan nan 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 nan nan nan nan nan nan nan nan nan nan nan 0.5 nan nan nan nan;...
nan nan nan 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan;...
nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan];

댓글을 달려면 로그인하십시오.

답변 (1개)

Kartik
Kartik 2023년 3월 21일
Hi,
Yes, there are several algorithms in MATLAB that you can use to cluster the Lidar data based on real number boundaries. One approach you can use is the 'k-means' clustering algorithm. Here's an example code to get you started:
% Replace NaN values with zeros
a(isnan(a)) = 0;
% Set the number of clusters you want to create
num_clusters = 2;
% Perform k-means clustering
[idx, C] = kmeans(a(:), num_clusters);
% Reshape the clustered data to its original shape
idx = reshape(idx, size(a));
This code uses k-means clustering to create two clusters from the Lidar data. The 'kmeans' function takes the flattened data '(a(:))' and the number of clusters as input and returns the cluster indices '(idx)' and the centroid values '(C)'. The 'reshape' function is used to reshape the clustered data to its original shape.
You can adjust the number of clusters to match your needs. Note that the clustering result might not be perfect, especially if the data has a lot of noise or if the clusters are not well-separated. You might need to experiment with different clustering algorithms and parameters to get the best result for your data.

카테고리

Help CenterFile Exchange에서 Cluster Analysis and Anomaly Detection에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by