Presuming you know which range of light intensities in your TIFF image represent soil and which represent water, the task in IDL requires just a few lines of code. Here is an example, where I assume that the image's values are 8-bit byte values in grayscale and water appears much darker than land. Let's assume that land values are never less than 60.
image = read_tiff('/path/to/myimage.tif')
nPixels = n_elements(image) ; Gets total number of pixels in the image
; WHERE returns both the number of soil pixels and their subscript locations in the array
soilSubscripts = where(image ge 60, nSoilPixels)
percentSoil = float(nSoilPixels) / nPixels ; the FLOAT conversion is required here
percentWater = 1.0 - percentSoilBest of luck with this,
James Jones
|