3D Point Cloud to Raster Image

조회 수: 11 (최근 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 CenterFile Exchange에서 Point Cloud Processing에 대해 자세히 알아보기

제품


릴리스

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by