필터 지우기
필터 지우기

3次元点群の法線ベクトルをもとめる

조회 수: 26 (최근 30일)
H.O
H.O 2023년 10월 15일
편집: H.O 2023년 10월 18일
3次元点群の任意点(point)に対して
・法線ベクトルとその単位ベクトルを求めたいです
・求めた近似平面と法線ベクトルを可視化(グラフ表示)したいです
どのようにするとよろしいでしょうか
%任意点とその半径から捜査範囲を設定
ptCloud=pcread('airplane.ply');%サンプルデータ参照元https://people.sc.fsu.edu/~jburkardt/data/ply/ply.html
point = [901.47 34.53 64.99]; radius = 10;
[indices,dists] = findNeighborsInRadius(ptCloud,point,radius);
ptCloudB = select(ptCloud,indices);
X=ptCloudB.Location;
%参考:主成分分析を使用した直交回帰の近似 - MATLAB & Simulink Example - MathWorks 日本
[coeff,score,roots] = pca(X);
normal = coeff(:,3) %近似平面の法線ベクトル
%%以降に可視化するコードを書きたい

채택된 답변

Tohru Kikawada
Tohru Kikawada 2023년 10월 16일
편집: Tohru Kikawada 2023년 10월 16일
pcnormalsで実現するのはいかがでしょうか。
websave("airplane.ply","https://people.sc.fsu.edu/~jburkardt/data/ply/airplane.ply");
ans = '/users/mss.system.mOV4N3/airplane.ply'
ptCloud=pcread('airplane.ply');
normals = pcnormals(ptCloud);
figure
pcshow(ptCloud)
title('Estimated Normals of Point Cloud')
hold on
% Figure contains an axes object. The axes object with title Estimated Normals of Point Cloud contains an object of type scatter.
x = ptCloud.Location(1:10:end,1);
y = ptCloud.Location(1:10:end,2);
z = ptCloud.Location(1:10:end,3);
u = normals(1:10:end,1);
v = normals(1:10:end,2);
w = normals(1:10:end,3);
% 法線ベクトルをプロットします。
quiver3(x,y,z,u,v,w);
  댓글 수: 1
H.O
H.O 2023년 10월 18일
편집: H.O 2023년 10월 18일
ありがとうございます.参照させていただきます.
また,法線ベクトルを指定した点群の範囲につき1つに定義したく,
例えばPCAで求まる近似平面など から法線ベクトル1つを計算できればと考えています.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 次元削減と特徴抽出에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!