Main Content

pcfitcuboid

点群に直方体を当てはめ

R2020b 以降

説明

model = pcfitcuboid(ptCloudIn) は、入力点群データに直方体を当てはめます。関数は直方体のプロパティを cuboidModel オブジェクト model に格納します。

model = pcfitcuboid(ptCloudIn,indices) は、入力点群の選択された点集合 indices に直方体を当てはめます。

model = pcfitcuboid(___,Name,Value) は、前述の構文の任意の入力引数の組み合わせに加え、1 つ以上の名前と値のペアの引数を使用してオプションを指定します。たとえば、'AzimuthRange',[25 75] は、関数の方位角の角度範囲を設定します。

すべて折りたたむ

点群のクラスターの周囲に直方体の境界ボックスを当てはめます。

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

data = load('drivingLidarPoints.mat');

関心領域 (ROI) を定義して点群からトリミングします。点群の選択した ROI を可視化します。

roi = [-40 40 -6 9 -2 1];
in = findPointsInROI(data.ptCloud,roi);
ptCloudIn = select(data.ptCloud,in);
hcluster = figure;
panel = uipanel('Parent',hcluster,'BackgroundColor',[0 0 0]);
ax = axes('Parent',panel,'Color',[0 0 0]); 
pcshow(ptCloudIn,'MarkerSize',30,'Parent',ax)
title('Input Point Cloud')

Figure contains an axes object and an object of type uipanel. The axes object with title Input Point Cloud contains an object of type scatter.

地面をセグメント化します。セグメント化された地面を可視化します。

maxDistance = 0.3;
referenceVector = [0 0 1];
[~,inliers,outliers] = pcfitplane(ptCloudIn,maxDistance,referenceVector);
ptCloudWithoutGround = select(ptCloudIn,outliers,'OutputSize','full');
hSegment = figure;
panel = uipanel('Parent',hSegment,'BackgroundColor',[0 0 0]);
ax = axes('Parent',panel,'Color',[0 0 0]); 
pcshowpair(ptCloudIn,ptCloudWithoutGround,'Parent',ax)
legend('Ground Region','Non-Ground Region','TextColor', [1 1 1])
title('Segmented Ground Plane')

Figure contains an axes object and an object of type uipanel. The axes object with title Segmented Ground Plane contains 2 objects of type scatter. These objects represent Ground Region, Non-Ground Region.

点群の地面以外の領域をクラスターにセグメント化します。セグメント化された点群を可視化します。

distThreshold = 1;
[labels,numClusters] = pcsegdist(ptCloudWithoutGround,distThreshold);
labelColorIndex = labels;
hCuboid = figure;
panel = uipanel('Parent',hCuboid,'BackgroundColor',[0 0 0]);
ax = axes('Parent',panel,'Color',[0 0 0]); 
pcshow(ptCloudIn.Location,labelColorIndex,'Parent',ax)
title('Fitting Bounding Boxes')
hold on

各クラスターに境界ボックスを当てはめます。オレンジのハイライトで可視化されます。

for i = 1:numClusters
    idx = find(labels == i);
    model = pcfitcuboid(ptCloudWithoutGround,idx);
    plot(model)
end

Figure contains an axes object and an object of type uipanel. The axes object with title Fitting Bounding Boxes contains 4 objects of type scatter, patch.

入力引数

すべて折りたたむ

点群。pointCloud オブジェクトとして指定します。

選択された有効な点のインデックス。正の整数のベクトルとして指定します。

データ型: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64

名前と値の引数

オプションの引数のペアを Name1=Value1,...,NameN=ValueN として指定します。ここで、Name は引数名、Value は対応する値です。名前と値の引数は他の引数の後に表示されなければなりませんが、ペアの順序は重要ではありません。

R2021a より前は、名前と値をそれぞれコンマを使って区切り、Name引用符で囲みます。

例: 'AzimuthRange',[25 75] は、関数の方位角の角度範囲を設定します。

直方体の向きを識別する方位角の範囲。'AzimuthRange' と範囲 [0, 90] の実数値の 2 要素行ベクトルからなるコンマ区切りのペアとして指定します。

データ型: single | double

検索ウィンドウのステップ サイズ。'Resolution' と正のスカラーからなるコンマ区切りのペアとして指定します。指定する値は方位角の範囲の上限と下限の間の距離以下でなければなりません。たとえば、方位角の範囲が [0, 90] の場合、指定する値は 90 以下にする必要があります。

メモ

分解能を低くすると、計算時間とメモリ フットプリントが増えます。

データ型: single | double

出力引数

すべて折りたたむ

直方体モデル。cuboidModel オブジェクトとして返されます。

アルゴリズム

この関数は L 字型ベースの検出アルゴリズムを使用して点群データに直方体を当てはめます。点群にあるすべての点について、この関数は四角形のとりうるすべての方向を反復し、対応する平方誤差を求めます。四角形のとりうる方向は、四角形の 2 辺が直交しているため、[0, 90] 度の範囲内にあります。AzimuthRange 引数を使用して、四角形のとりうる方向を指定できます。次に、この関数は、誤差が最小となる方向を選択し、その方向に沿って四角形を当てはめます。

参照

[1] Xiao Zhang, Wenda Xu, Chiyu Dong and John M. Dolan, "Efficient L-Shape Fitting for Vehicle Detection Using Laser Scanners", IEEE Intelligent Vehicles Symposium, June 2018

拡張機能

C/C++ コード生成
MATLAB® Coder™ を使用して C および C++ コードを生成します。

GPU コード生成
GPU Coder™ を使用して NVIDIA® GPU のための CUDA® コードを生成します。

バージョン履歴

R2020b で導入

参考

関数

オブジェクト