Kinect によって点群画像から生成されたほぼ配置されたポイント (半径または特定の数の近傍内に編成された) を整理してグループ化し、それを 1 つのポイントに変換するためのアルゴリズムまたはコード スニペットはありますか。サイズを大きくして点数を減らしたい。
質問する
278 次
3 に答える
0
平均的な Shift の使用を検討しましたか?
于 2013-02-02T19:11:02.150 に答える
0
1 つの簡単な方法は次のとおりです。
- クラスタリングに使用する「イプシロン」値を修正します
- 各ポイントについて、座標から「クラスター キー」を計算します。
- クラスタ キーによってインデックス付けされたマップにすべてのポイントを追加します
- クラスターと近くのクラスターのみをチェックして、すべてのグループを収集します
コードで:
std::map<CellIndex, std::vector<P3d> > pmap;
for (int i=0,n=pts.size(); i<n; i++)
{
int ix = int(pts[i].x / eps);
int iy = int(pts[i].y / eps);
int iz = int(pts[i].z / eps);
pmap[CellIndex(ix, iy, iz)].push_back(pts[i]);
}
for (std::map<CellIndex, std::vector<P3d> >::iterator i=pmap.begin(),e=pmap.end();
i != e;
++i)
{
// get cluster center
int cx = i->first.ix;
int cy = i->first.iy;
int cz = i->first.iz;
// collect points from all 9 cluster with x index between cx-1 and cx+1
// between cy-1 and cy+1 and between cz-1 and cz+1 (inclusive).
// Not all clusters are guaranteed to be present in the map.
// You will be considering only points that are at most 1.5*sqrt(3)*eps from
// the center of the (cx, cy, cz) cell.
}
必要な計算によっては、ポイントをセルに格納するのではなく、セル自体に中間結果を保持することで、1 つのパスのみを実行できる場合があります。
于 2013-02-02T12:07:03.520 に答える