フィルターのクリア

3D Point Cloud to Raster Image

13 ビュー (過去 30 日間)
Abdul Hannan Qureshi
Abdul Hannan Qureshi 2022 年 4 月 22 日
編集済み: Abdul Hannan Qureshi 2022 年 4 月 25 日
Is there any guideline available to generate raster image from point cloud (.ply) model ?.
Following is my model:
Following code I have managed to compile:
ptCloud = pcread('M.ply');
c = pca(ptCloud.Location);
TPCA = ptCloud.Location*c(1:3,:);
minX=min(TPCA(:,1));
maxX=max(TPCA(:,2));
minY=min(TPCA(:,2));
maxY=max(TPCA(:,2));
w_m=max(TPCA(:,1))-min(TPCA(:,1));
l_m=max(TPCA(:,2))-min(TPCA(:,2));
w_p=ceil(w_m/resolution);
l_p=ceil(l_m/resolution);
raster=zeros(h_p,w_p);
for i=1:length
for j=1:width
I=find(TPCA(:,1)>minX & TPCA(:,1)< ...
minX+resolution & TPCA(:,2)>minY & ...
TPCA(:,2)<minY+resolution);
if isempty(I)
raster(i,j)=0;
else
raster(i,j)=1;
end
minX=minX+resolution;
end
minY=minY+resolution;
minX=min(TPCA(:,1));
end
imshow(raster)
I am not getting any kind of outcome. Kindly advise.
  1 件のコメント
DGM
DGM 2022 年 4 月 25 日
Edited to restore question.

サインインしてコメントする。

採用された回答

Walter Roberson
Walter Roberson 2022 年 4 月 23 日
I=find(TransformPCA(:,1)>minX & TransformPCA(:,1)< ...
minX+resolution_pix & TransformPCA(:,2)>minY & ...
TransformPCA(:,2)<minY+resolution_pix);
if isempty(I)
raster(i,j)=0;
else
raster(i,j)=1;
end
I would point out to you that you could use a 2D histogram, and then your raster would be sign(the_histogram_values)
There are several ways to do a 2D histogram. One of the ways would be to discretize() the X and Y coordinates separately to get X and Y bin numbers, and then accumarray( [Y(:), X(:}], 1) . (The raw numbers would be a density map, by the way.)
  1 件のコメント
Abdul Hannan Qureshi
Abdul Hannan Qureshi 2022 年 4 月 23 日
編集済み: Abdul Hannan Qureshi 2022 年 4 月 23 日
ok thank you @Walter Roberson. I will try this.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangePoint Cloud Processing についてさらに検索

製品


リリース

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by