How to read arbitrary pixel values from a geotiff image?
5 views (last 30 days)
Show older comments
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
0 Comments
Accepted Answer
Image Analyst
on 6 May 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 Comments
Image Analyst
on 7 May 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.
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!