Convert Grayscale image to XYZ file..
Mostra commenti meno recenti
How i can convert a GrayScale image to XYZ file ?
Risposte (2)
Image Analyst
il 11 Apr 2013
0 voti
You have row, columns, and at every (row, column) (= (y, x)) location you have a gray level. What are you referring to as "Z"? What does your Z represent? Gray level? If so, then the image array is already what you want. Or were you looking to display the image with surf()?
6 Commenti
George
il 11 Apr 2013
Sukuchha
il 18 Apr 2013
by any chance, do you have access to ArcGIs. If yes, then have a look at http://shreshai.blogspot.ch/2011/01/converting-raster-dataset-to-xyz-in.html
If not, you can still do it in MALTAB. Some f the function that will help is meshgrid, transpose. Try yourself first.
George
il 5 Giu 2013
Image Analyst
il 5 Giu 2013
They should not. See my demo code below. I'd have to see it to believe it.
grayImage = imread('moon.tif');
[height, width] = size(grayImage)
[X, Y] = meshgrid(1:width, 1:height);
numberOfPixels = length(X(:))
points = [X(:) Y(:) grayImage(:)];
whos X Y points
height =
537
width =
358
numberOfPixels =
192246
Name Size Bytes Class Attributes
X 537x358 1537968 double
Y 537x358 1537968 double
points 192246x3 576738 uint8
By the way, don't use image as the name of a variable since it's already the name of a built-in function.
HOSUNG LEE
il 18 Apr 2019
how can I get the Z coordinate form this code?
Image Analyst
il 18 Apr 2019
0 voti
See my attached code. It produces a CSV text file with x,y,gray level.
Categorie
Scopri di più su Convert Image Type in Centro assistenza e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!