How to plot the brightness lines in Matlab, as this picture?
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Ray Lee
el 5 de Nov. de 2016
Editada: Walter Roberson
el 11 de Dic. de 2016
Higher dense the path, higher brighness shown on the figure.
0 comentarios
Respuesta aceptada
Image Analyst
el 5 de Nov. de 2016
If you have an image, that starts out as all zeros, and a set of coordinates that define where the lines go, you can simply add 1 to the image everytime you encounter one of those coordinates. Like if you have a set of (x,y) coordinates of a line (perhaps use Bresenham's line algorithm ) then do this
heatmapImage = zeros(rows, columns)
for k = 1 : length(x)
row = round(y(k));
col = round(x(k));
% Don't let go outside image.
if row > rows
row = rows;
end
if col > columns
col = columns;
end
if row < 1
row = 1;
end
if col < 1
col = 1;
end
% Increment the value.
heatmapImage(row, col) = heatmapImage(row, col) + 1;
end
Repeat that for every set of x,y data you have, then display the resulting image:
imshow(heatmapImage, []);
colormap(jet(256));
colorbar;
0 comentarios
Más respuestas (1)
Walter Roberson
el 5 de Nov. de 2016
Editada: Walter Roberson
el 11 de Dic. de 2016
This style is sometimes called a "heat map"
0 comentarios
Ver también
Categorías
Más información sobre Data Distribution Plots 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!