Presenting set of (x, y, z) points as image

조회 수: 46 (최근 30일)
Itzhak Mamistvalov
Itzhak Mamistvalov 2021년 4월 30일
댓글: Image Analyst 2022년 10월 7일
Hey everyone,
Im trying to figure out how to solve a problem in an academic project im working on.
I have a set of datapoints with (x, y, z) values. The values represent cordinates on a scanned wall. I retrieve the points by scanning a wall with LIDAR, and getting (x, y, z) arrays, with different precision in each axis. The points are in double format. Note that the z axis is actually the depth of the wall on that (x, y) point.
Now, im presenting the data in a scatter3 plot. Is there a way to present it by an image?
I thought of an idea of creating a matrix of (max(y)-min(y), max(x)-min(x)) and fill it with z values. Note that x, y, z arrays are same length.
How can I create such an image?
Is there a way in which I can fill the missing points with interpolation or something similar maybe?
attaching my code and my scatter3 plot.
%
clear all; close all; clc;
fileID = fopen('d.dat', 'r');
data = fscanf(fileID, "%f %f %f", [3 inf]);
fclose(fileID);
data = data';
Dist = 625;
for i=1:length(data)
x(i)=Dist*tand(data(i,2));
y(i)=Dist*tand(data(i,1));
z(i)=data(i,3)*cosd(data(i,1))*cosd(data(i,2));
end
scatter3(x,y,z,5,z)
colorbar('eastoutside')
view(2)
  댓글 수: 2
tejashree
tejashree 2022년 10월 7일
how to convert image to xyz points of that image
Image Analyst
Image Analyst 2022년 10월 7일
@tejashree, see attached demo that makes a list of x,y,r,g,b values into a csv text file. Works for gray scale too.

댓글을 달려면 로그인하십시오.

채택된 답변

Image Analyst
Image Analyst 2021년 4월 30일
편집: Image Analyst 2021년 4월 30일
Try surf() or reshape then into image and call imshow()
columns = 1000; % Whatever you want the image size to be
rows = 1000; % Whatever you want the image size to be
ry = rescale(y, 1, columns);
rx = rescale(x, 1, columns);
grayImage = zeros(rows, columns);
for k = 1 : length(x)
row = round(y(k));
col = round(x(k));
grayImage(row, col) = z(k);
end
imshow(grayImage, []);

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Convert Image Type에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by