필터 지우기
필터 지우기

Scatterplot colorise, cloud to cloud insted of ground

조회 수: 2 (최근 30일)
Malte
Malte 2015년 5월 19일
댓글: Malte 2015년 5월 28일
I have two point clouds, where i want to visualize how they fit together. Therefore i want the points in one of the clouds, to go from green to red, doing to the pointdistance to the correlating point in the oppesite cloud. I have worked with Scatter3, but it colorises the cloud in respect to the Z ground, is it possible to do this in respect to the other clout, instead of the ground

답변 (1개)

Nalini Vishnoi
Nalini Vishnoi 2015년 5월 20일
Hi Malte,
It is possible to represent the second point cloud using the colors corresponding to its distance from the first point cloud using scatter3. Here is a short example:
>> P1 = rand(1000,3); % Create two point clouds
>> P2 = rand(1000,3);
% find the distance betweeon point clouds
>> d = sqrt((P1(:,1)-P2(:,1)).^2 + (P1(:,2)-P2(:,2)).^2 + (P1(:,3)-P2(:,3)).^2);
>> figure, scatter3(P1(:,1), P1(:,2), P1(:,3));
>> hold on;
>> scatter3(P2(:,1), P2(:,2), P2(:,3),50, d);
>> colormap('jet');
Please note that you can change the colormap to any of the desired colormaps, for example, if you want the colors to change from green to yellow, you can use 'summer' colormap.
I hope this helps.
Nalini
  댓글 수: 2
Malte
Malte 2015년 5월 28일
i tried to rewrite the function a bet. My point clouds is called PC1 and PC2.
NQ1=[]; NQ2=[];
%Function to find the corellating points for cnt1 = 1:length(PC2(:,1)); XI=PC2(cnt1,:); X=PC1; k=dsearchn(X,XI); Nq1=PC1(k,:); Nq2=PC2(1,:);
NQ1=[NQ1;Nq1];
NQ2=[NQ2;Nq2];
end
dq = sqrt((NQ1(:,1)-NQ2(:,1)).^2 + (NQ1(:,2)-NQ2(:,2)).^2 + (NQ1(:,3)-NQ2(:,3)).^2);
figure, scatter3(NQ1(:,1), NQ1(:,2), NQ1(:,3)); hold on; scatter3(NQ2(:,1), NQ2(:,2), NQ2(:,3),50, dq); colormap('jet'); hold off
But i only get blue points?

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

카테고리

Help CenterFile Exchange에서 Scatter Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by