Borrar filtros
Borrar filtros

How to read arbitrary pixel values from a geotiff image?

1 visualización (últimos 30 días)
Hi
I'm looking for a function to read values from a geotiff image for an array of arbitrary lat,lon coordinates.
Something like this:
val = pixtiffread(filename,lat,lon,refmat)
imread for tiff images lets you specify a pixelreagion but I can't find a function that takes lat and lon vectors.
Any help would be appreciated. Regards Neil

Respuesta aceptada

Image Analyst
Image Analyst el 6 de Mayo de 2012
The help for imread says: "'PixelRegion': Cell array, {Rows, Cols}, specifying the boundaries of the region. Rows and Cols must be either two- or three-element vectors. If you specify two elements, the values denote the 1-based indices [start stop]. If you specify three elements, the values denote the 1-based indices [start increment stop], to allow image downsampling."
So why can't you use that? Just have x by the columns, and y be the rows? Or else why can't you just read in the whole image and extract the values like pixelValue = yourImage(y, x), where you do that for each x and y that you have?
  3 comentarios
Image Analyst
Image Analyst el 7 de Mayo de 2012
How big is your image? Can you sort your x and y points into where they would lie if you divided your image up into, say, 10 by 10 blocks? Then you can read in one block at a time, read pixel values for the coordinates that lie in that block, and do this for every block of the image.
Neil Caithness
Neil Caithness el 23 de Ag. de 2012
Thanks, I will probably have to do it that way but I'm still hoping that someone might suggest an efficient solution for reading pixel values directly from geotiff files for arbitrary vectors of x,y coordinates.

Iniciar sesión para comentar.

Más respuestas (0)

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by