3D Point Cloud to Raster Image

11 vues (au cours des 30 derniers jours)
Abdul Hannan Qureshi
Abdul Hannan Qureshi le 22 Avr 2022
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 commentaire
DGM
DGM le 25 Avr 2022
Edited to restore question.

Connectez-vous pour commenter.

Réponse acceptée

Walter Roberson
Walter Roberson le 23 Avr 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.)
  1 commentaire
Abdul Hannan Qureshi
Abdul Hannan Qureshi le 23 Avr 2022
Modifié(e) : Abdul Hannan Qureshi le 23 Avr 2022
ok thank you @Walter Roberson. I will try this.

Connectez-vous pour commenter.

Plus de réponses (0)

Produits


Version

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by