Effacer les filtres
Effacer les filtres

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

21 vues (au cours des 30 derniers jours)
Itzhak Mamistvalov
Itzhak Mamistvalov le 30 Avr 2021
Commenté : Image Analyst le 7 Oct 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 commentaires
tejashree
tejashree le 7 Oct 2022
how to convert image to xyz points of that image
Image Analyst
Image Analyst le 7 Oct 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.

Connectez-vous pour commenter.

Réponse acceptée

Image Analyst
Image Analyst le 30 Avr 2021
Modifié(e) : Image Analyst le 30 Avr 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, []);

Plus de réponses (0)

Catégories

En savoir plus sur Convert Image Type dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by