Pixel values to Image
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Nils Boden
el 24 de En. de 2017
Editada: Benjamin Kraus
el 24 de En. de 2017
Hey,
Hopefully someone can help me with my problem, I cant seem to find a proper solution. I have a very big .txt file with depth values, one value per row. I want to create an image using these depth values, the grid has to be 170000x170000.
The color of each Pixel has to be dependend on the Value, so that I get a depth-map visualitsation from my Values.
I hope I described the problem good enough, thanks for any help.
2 comentarios
Jan
el 24 de En. de 2017
If you have "one value per row", how can the information about the X and Y position be obtained?
Respuesta aceptada
Benjamin Kraus
el 24 de En. de 2017
Editada: Benjamin Kraus
el 24 de En. de 2017
You need to read in your text file using one of the methods described on this doc page: Ways to Import Text Files. If your data is just a single column, most of those functions should work.
Then you can call something like imagesc to make it into an image. You may want to adjust the colormap afterward.
Something like this:
vals = dlmread('bigdata.txt');
vals = reshape(vals, 170000, 170000);
imagesc(vals)
Note that MATLAB is column-major, so the first row of vals will be the first 170000, the second row will be the second 170000, etc. You can transpose the matrix if this isn't what you wanted by adding a single quote following the call to reshape:
vals = dlmread('bigdata.txt');
vals = reshape(vals, 170000, 170000)';
imagesc(vals)
0 comentarios
Más respuestas (0)
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!