3D Point Cloud to Raster Image

8 visualizzazioni (ultimi 30 giorni)
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.

Risposta accettata

Walter Roberson
Walter Roberson il 23 Apr 2022
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.)

Più risposte (0)

Prodotti


Release

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by