3D Point Cloud to Raster Image
조회 수: 11 (최근 30일)
이전 댓글 표시
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.
채택된 답변
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.)
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Point Cloud Processing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!