How to read arbitrary pixel values from a geotiff image?
3 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
Image Analyst
2012-5-6
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 个评论
Image Analyst
2012-5-7
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.
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!