フィルターのクリア

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

1 回表示 (過去 30 日間)
익환 류
익환 류 2022 年 11 月 29 日
回答済み: Kartik 2023 年 3 月 21 日
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 Center および File ExchangeCluster 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