Presenting set of (x, y, z) points as image
17 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
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
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 Center および File Exchange で Image Processing Toolbox についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!