Main Content

plot

直方体モデルのプロット

R2020b 以降

説明

plot(model) は、現在の Figure の座標軸範囲内に直方体モデルをプロットします。

plot(model,'Parent',ax) は、指定した出力座標軸上に直方体モデルをプロットします。

H = plot(___) はさらに、直方体モデルのプロット (Figure) を patch オブジェクトとして返します。

すべて折りたたむ

関数 pcfitcuboid を使用して点群から直方体を検出します。この関数は直方体のパラメーターを cuboidModel オブジェクトとして格納します。

点群データをワークスペースに読み取ります。

ptCloud = pcread('highwayScene.pcd');

指定した関心領域 (ROI) 内の点群を検索します。検出された点のみを含む点群を作成します。

roi = [-30 30 -20 30 -8 13];
in = findPointsInROI(ptCloud,roi);
ptCloudIn = select(ptCloud,in);

検出された点の点群をプロットします。

   figure
   pcshow(ptCloudIn.Location)
   xlabel('X(m)')
   ylabel('Y(m)')
   zlabel('Z(m)')
   title('Detected Points in ROI')

点群の指定した ROI に含まれる点のインデックスを調べます。

roi = [9.6 13.8 7.9 9.3 -2.5 3];
sampleIndices = findPointsInROI(ptCloudIn,roi);

点群の指定した点集合に直方体を当てはめます。

 model = pcfitcuboid(ptCloudIn,sampleIndices);
  figure
  pcshow(ptCloudIn.Location)
  xlabel('X(m)')
  ylabel('Y(m)')
  zlabel('Z(m)')
  title('Detect a Cuboid in a Point Cloud')

点群の直方体のボックスをプロットします。

hold on
plot(model)

cuboidModel オブジェクトの内部プロパティを表示します。

model
model = 
  cuboidModel with properties:

     Parameters: [11.4873 8.5997 -1.6138 3.6713 1.3220 1.7576 0 0 0.9999]
         Center: [11.4873 8.5997 -1.6138]
     Dimensions: [3.6713 1.3220 1.7576]
    Orientation: [0 0 0.9999]

入力引数

すべて折りたたむ

直方体モデル。cuboidModel オブジェクトとして指定します。

出力座標軸。直方体モデルを表示する Axes オブジェクトとして指定します。プロパティのリストについては、Axes のプロパティを参照してください。

出力引数

すべて折りたたむ

patch オブジェクト。patch オブジェクトとして返されます。

バージョン履歴

R2020b で導入

参考

関数

オブジェクト