How to visualise data value with x-y coordinate in an image

3 visualizaciones (últimos 30 días)
RAJ DATTA
RAJ DATTA el 14 de Sept. de 2019
Comentada: RAJ DATTA el 16 de Sept. de 2019
Hello, suppose I have x-y coordinate and z value as the grades of the points. How can I visualize my data in 2-D colormap ? (I want to show x-y cordinate and different colors for different values at every points inside the image). I am attachng sample data text file and regarding image.
Please help.
  2 comentarios
Walter Roberson
Walter Roberson el 15 de Sept. de 2019
I suspect you want griddedInterpolant()
Along with a colormap such as 'hot' or perhaps 'autumn'
RAJ DATTA
RAJ DATTA el 16 de Sept. de 2019
yes. I found I need to interpolate to and a matrix should be created for [x,y, data]. only then I can make an image. Thank you sir for your idea.

Iniciar sesión para comentar.

Respuestas (1)

Image Analyst
Image Analyst el 15 de Sept. de 2019
Try something like
data = dlmread(filename, ' ');
x = data(:, 1);
y = data(:, 2);
grayLevel = data(:, 3);
grayImage = zeros(ceil(max(y)), ceil(max(x)));
for k = 1 : length(x)
row = round(y(k));
col = round(x(k));
grayImage(row, col) = grayLevel(k);
end
grayImage = mat2gray(grayImage);
imshow(grayImage, 'ColorMap', jet(256));
colorbar;
  4 comentarios
RAJ DATTA
RAJ DATTA el 15 de Sept. de 2019
sir, again only the blue screen.
Image Analyst
Image Analyst el 15 de Sept. de 2019
Not only the blue, but for most of them. There are 181 pixels that are not zero. But most of your image locations do not have a gray level defined for them, so they are left as zero and appear as blue.
data = dlmread('md1.txt', ' ');
x = data(:, 1);
y = data(:, 2);
grayLevel = data(:, 3);
grayImage = zeros(ceil(max(y)), ceil(max(x)));
for k = 1 : length(x)
row = max([1, round(y(k))]);
col = max([1, round(x(k))]);
grayImage(row, col) = grayLevel(k);
fprintf('Assigning %d to row %d, column %d.\n', grayLevel(k), row, col);
end
minGL = min(grayImage(:))
maxGL = max(grayImage(:))
grayImage = mat2gray(grayImage);
imshow(grayImage, [], 'ColorMap', jet(256));
colorbar;

Iniciar sesión para comentar.

Categorías

Más información sobre Blue en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by