Borrar filtros
Borrar filtros

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

21 visualizaciones (últimos 30 días)
Itzhak Mamistvalov
Itzhak Mamistvalov el 30 de Abr. de 2021
Comentada: Image Analyst el 7 de Oct. de 2022
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 comentarios
tejashree
tejashree el 7 de Oct. de 2022
how to convert image to xyz points of that image
Image Analyst
Image Analyst el 7 de Oct. de 2022
@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.

Iniciar sesión para comentar.

Respuesta aceptada

Image Analyst
Image Analyst el 30 de Abr. de 2021
Editada: Image Analyst el 30 de Abr. de 2021
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, []);

Más respuestas (0)

Categorías

Más información sobre Convert Image Type en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by