ボクセル表現されたモデルの表面部分のみを描画する方法
7 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
nito
am 24 Sep. 2021
Kommentiert: nito
am 24 Sep. 2021
ボクセルで簡易的な切削シミュレータ(被削材の形状変化をボクセルで表現)を実装したいと思っているのですが,オブジェクト数を抑えて描画する方法が分かりません.現状はpatch('Faces',F,'Vertices',V)を用いて,対象の全領域に直方体を描画してしまっているため,まずは表面のみを描画するように変更したいと考えています.
そのため,以下3点を教えていただけますでしょうか.
1. 対象の体積領域を表す元データ(3次元配列)から表面部分のみのデータを取得する方法
2. 1の逆変換
3. 元データの形状が変化した際に素早く対応した表面データを得る方法(※簡易的に実装できるものがあれば)
0 Kommentare
Akzeptierte Antwort
Shunichi Kusano
am 24 Sep. 2021
下のコードのように考えてみました。
モルフォロジー処理を利用していますが、切削形状によっては上手くいかないこともあるかもしれません。
%% ダミーデータ
test = zeros(100,100,100);
test(10:90,10:90,10:90) = 1;
volshow(test)
%% 表面ピクセルの取得
test_erode = imerode(test,strel('cube',3)); % モルフォロジー処理
test_surf = test & ~test_erode; % 元のボリュームからの差分が表面に相当
volshow(test_surf);
%% 復元
test_reconstruct = imfill(test_surf,'holes');
val = test == test_reconstruct;
any(~val(:)) % 復元を確認
%% 削る
test2 = test;
test2(80:90,80:90,80:90) = 0;
volshow(test2);
%% 削った部分
part = test & ~test2;
volshow(part)
%% 削った部分に接する元のボリュームの面
surf_on_part = test2 & imdilate(part,strel('cube',3));
test_label = test2;
test_label(surf_on_part) = 2;
labelvolshow(test_label,test2);
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu 表面プロットとメッシュ プロット finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!