Azzera filtri
Azzera filtri

how to extract features from 350 clusters | extractEigenFeatures

2 visualizzazioni (ultimi 30 giorni)
Hello All,
I have around 350 clusters and I am trying to retain only matching clusters and remove unmatched ones. How to use this example in this case https://www.mathworks.com/help/lidar/ref/pcshowmatchedfeatures.html
  2 Commenti
Venkata Ram Prasad Vanguri
Hi,
We can extract matched cluster segments and corresponding features from the matched index pairs as below:
matchedSegments1 = segments1(indexPairs(:,1));
matchedSegments2 = segments2(indexPairs(:,2));
matchedFeatures1 = eigFeatures1(indexPairs(:,1));
matchedFeatures2 = eigFeatures2(indexPairs(:,2));
Pavan Kumar B N
Pavan Kumar B N il 11 Ott 2021
Modificato: Pavan Kumar B N il 11 Ott 2021
@Venkata Ram Prasad Vanguri Thank you so much for your response.
I tried as you suggested on pcap data. When I run the following code it is generating 50 figures of matched segments. I tired visualize these results using pcplayer. But it is giving a error like "Too many input arguments". Could you please help on how to visulize these matching features using pcplayer.?
Eagerly looking forward for your kind help.
veloReader = velodyneFileReader('test.pcap', 'VLP16');
for i = 1:50
ptCloud1 = veloReader.readFrame(i);
ptCloud2 = veloReader.readFrame(i+1);
%remove the ground plane from the scans
maxDistance = 1;
referenceVector = [0 0 1];
[~,~,selectIdx] = pcfitplane(ptCloud1, maxDistance, referenceVector);
ptCloud1 = select(ptCloud1,selectIdx, 'OutputSize', 'full');
[~,~,selectIdx] = pcfitplane(ptCloud2, maxDistance, referenceVector);
ptCloud2 = select(ptCloud2,selectIdx, 'OutputSize', 'full');
%cluster the point cloud with 10 points per cluster
minDistance = 2;
minPoints = 10;
lables1 = pcsegdist(ptCloud1, minDistance, 'NumClusterPoints', minPoints);
lables2 = pcsegdist(ptCloud2, minDistance, 'NumClusterPoints', minPoints);
[eigFeatures1, segments1] = extractEigenFeatures(ptCloud1,lables1);
[eigFeatures2, segments2] = extractEigenFeatures(ptCloud2,lables2);
%create matrices of the features and centroids extracted from each point
%cloud
features1 = vertcat(eigFeatures1.Feature);
features2 = vertcat(eigFeatures2.Feature);
centroids1 = vertcat(eigFeatures1.Centroid);
centroids2 = vertcat(eigFeatures2.Centroid);
%find future matches
indexPairs = pcmatchfeatures(features1,features2, pointCloud(centroids1),pointCloud(centroids2),'MatchThreshold',0.1,'RejectRatio',0.9);
matchedSegments1 = segments1(indexPairs(:,1));
matchedSegments2 = segments2(indexPairs(:,2));
matchedFeatures1 = eigFeatures1(indexPairs(:,1));
matchedFeatures2 = eigFeatures2(indexPairs(:,2));
figure
pcshowMatchedFeatures(matchedSegments1,matchedSegments2,matchedFeatures1,matchedFeatures2)
title('Matched Segments')
xlimits = [-35 118];
ylimits = [-55 75];
zlimits = [-10 10];
player = pcplayer(xlimits,ylimits,zlimits);
%while(hasFrame(ptCloudPlayer))
% ptCloudObj = readFrame(ptCloudPlayer);
view(player,matchedSegments2.Location,matchedSegments2.Intensity);
%end
end

Accedi per commentare.

Risposte (0)

Prodotti


Release

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by